> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取拉取请求（PR）指标

> 获取 Enterprise 账户的汇总 PR 指标。

可选地按 playbook_id 进行过滤，只统计由使用特定 playbook 创建的会话产生的 PR 指标。

<div id="permissions">
  ## 权限
</div>

需要一个在 Enterprise 级别拥有 `ViewAccountMetrics` 权限的服务用户。


## OpenAPI

````yaml zh/v3-openapi.yaml GET /v3/enterprise/metrics/prs
openapi: 3.1.0
info:
  description: 采用 Service User 身份验证和 RBAC 的 Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/metrics/prs:
    get:
      tags:
        - metrics
      summary: 获取拉取请求（PR）指标
      description: |-
        获取 Enterprise 账户的汇总 PR 指标。

        可选地按 playbook_id 进行过滤，只统计由使用特定 playbook 创建的会话产生的 PR 指标。
      operationId: handle_get_pr_metrics_v3_enterprise_metrics_prs_get
      parameters:
        - in: query
          name: user_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: User Ids
        - in: query
          name: service_user_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Service User Ids
        - in: query
          name: time_before
          required: true
          schema:
            title: Time Before
            type: integer
        - in: query
          name: time_after
          required: true
          schema:
            title: Time After
            type: integer
        - in: query
          name: org_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Org Ids
        - in: query
          name: playbook_id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Playbook Id
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrMetricsResponse'
          description: 成功响应
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 验证错误
components:
  schemas:
    PrMetricsResponse:
      description: 用于 PR（pull request）指标的响应模型。
      properties:
        prs_closed_count:
          description: 由 Devin 创建、但未合并即关闭的 PR。
          title: Prs Closed Count
          type: integer
        prs_created_count:
          description: 由 Devin 创建的所有状态下的 PR 总数（打开 + 已合并 + 已关闭）。
          title: Prs Created Count
          type: integer
        prs_merged_count:
          description: 由 Devin 创建并已合并的 PR。
          title: Prs Merged Count
          type: integer
        prs_opened_count:
          description: 由 Devin 创建且当前处于打开状态的 PR。
          title: Prs Opened Count
          type: integer
        prs_taken_over_closed_count:
          default: 0
          description: 由 Devin 接管、但未合并即关闭的 PR。
          title: Prs Taken Over Closed Count
          type: integer
        prs_taken_over_count:
          default: 0
          description: >-
            Devin 接管的所有状态下的 PR 总数（打开 + 已合并 + 已关闭）。“接管”是指 Devin 向一个最初并非由其创建的 PR
            推送了提交。
          title: Prs Taken Over Count
          type: integer
        prs_taken_over_merged_count:
          default: 0
          description: 由 Devin 接管并已合并的 PR。
          title: Prs Taken Over Merged Count
          type: integer
        prs_taken_over_opened_count:
          default: 0
          description: 由 Devin 接管且当前处于打开状态的 PR。
          title: Prs Taken Over Opened Count
          type: integer
      required:
        - prs_created_count
        - prs_opened_count
        - prs_merged_count
        - prs_closed_count
      title: PrMetricsResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````