Skip to content
Ona Docs

GetPrSummary

client.usage.getPrSummary(UsageGetPrSummaryParams { dateRange, projectId, teamId, userId } body, RequestOptionsoptions?): UsageGetPrSummaryResponse { sparkline, summary }
POST/gitpod.v1.UsageService/GetPrSummary

Gets aggregated PR speed summary for the organization or a specific project.

Use this method to:

  • Measure pull request lead time and review latency
  • Calculate deployment frequency from merged pull requests
  • Scope PR speed insights to a project, user, or team

Example

dateRange:
  startTime: "2024-01-01T00:00:00Z"
  endTime: "2024-02-01T00:00:00Z"
projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
ParametersExpand Collapse
body: UsageGetPrSummaryParams { dateRange, projectId, teamId, userId }
dateRange: DateRange { endTime, startTime }

Date range to query within.

endTime: string

End time of the date range (exclusive).

formatdate-time
startTime: string

Start time of the date range (inclusive).

formatdate-time
projectId?: string

Optional project ID to scope results.

teamId?: string

Optional team ID to scope results to a specific team. Mutually exclusive with user_id.

userId?: string

Optional user ID to scope results to a specific user. Mutually exclusive with team_id.

ReturnsExpand Collapse
UsageGetPrSummaryResponse { sparkline, summary }
sparkline?: Array<TimeSeriesPoint { time, value } >

Sparkline data for card rendering.

time?: string

Timestamp for this data point.

formatdate-time
value?: number

The numerical value for this data point.

formatint32
summary?: PrSummary { deploymentFrequency, deploymentFrequencyTrend, leadTimeSeconds, 5 more }

Summary totals and trends for the requested date range.

deploymentFrequency?: number

PRs merged to the default branch per week.

formatdouble
deploymentFrequencyTrend?: number

Fractional change in deployment_frequency vs previous period. Computed as (current - previous) / previous.

formatdouble
leadTimeSeconds?: number

Median lead time for changes in seconds (first commit → merge).

formatdouble
leadTimeTrend?: number

Fractional change in lead_time_seconds vs previous period. Computed as (current - previous) / previous.

formatdouble
prsMergedCount?: string

Total PRs merged in the date range.

prsMergedTrend?: number

Fractional change in prs_merged_count vs previous period. Computed as (current - previous) / previous.

formatdouble
timeToFirstApprovalSeconds?: number

Median time to first approval in seconds. Zero when no PRs in the range had approvals.

formatdouble
timeToFirstApprovalTrend?: number

Fractional change in time_to_first_approval_seconds vs previous period. Computed as (current - previous) / previous.

formatdouble

GetPrSummary

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const response = await client.usage.getPrSummary({
  dateRange: { endTime: '2024-02-01T00:00:00Z', startTime: '2024-01-01T00:00:00Z' },
  projectId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68',
});

console.log(response.sparkline);
{
  "sparkline": [
    {
      "time": "2019-12-27T18:11:19.117Z",
      "value": 0
    }
  ],
  "summary": {
    "deploymentFrequency": 0,
    "deploymentFrequencyTrend": 0,
    "leadTimeSeconds": 0,
    "leadTimeTrend": 0,
    "prsMergedCount": "prsMergedCount",
    "prsMergedTrend": 0,
    "timeToFirstApprovalSeconds": 0,
    "timeToFirstApprovalTrend": 0
  }
}
Returns Examples
{
  "sparkline": [
    {
      "time": "2019-12-27T18:11:19.117Z",
      "value": 0
    }
  ],
  "summary": {
    "deploymentFrequency": 0,
    "deploymentFrequencyTrend": 0,
    "leadTimeSeconds": 0,
    "leadTimeTrend": 0,
    "prsMergedCount": "prsMergedCount",
    "prsMergedTrend": 0,
    "timeToFirstApprovalSeconds": 0,
    "timeToFirstApprovalTrend": 0
  }
}