## GetPrSummary `client.Usage.GetPrSummary(ctx, body) (*UsageGetPrSummaryResponse, error)` **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 ```yaml dateRange: startTime: "2024-01-01T00:00:00Z" endTime: "2024-02-01T00:00:00Z" projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body UsageGetPrSummaryParams` - `DateRange param.Field[DateRange]` Date range to query within. - `ProjectID param.Field[string]` Optional project ID to scope results. - `TeamID param.Field[string]` Optional team ID to scope results to a specific team. Mutually exclusive with user_id. - `UserID param.Field[string]` Optional user ID to scope results to a specific user. Mutually exclusive with team_id. ### Returns - `type UsageGetPrSummaryResponse struct{…}` - `Sparkline []TimeSeriesPoint` Sparkline data for card rendering. - `Time Time` Timestamp for this data point. - `Value int64` The numerical value for this data point. - `Summary PrSummary` Summary totals and trends for the requested date range. - `DeploymentFrequency float64` PRs merged to the default branch per week. - `DeploymentFrequencyTrend float64` Fractional change in deployment_frequency vs previous period. Computed as (current - previous) / previous. - `LeadTimeSeconds float64` Median lead time for changes in seconds (first commit → merge). - `LeadTimeTrend float64` Fractional change in lead_time_seconds vs previous period. Computed as (current - previous) / previous. - `PrsMergedCount string` Total PRs merged in the date range. - `PrsMergedTrend float64` Fractional change in prs_merged_count vs previous period. Computed as (current - previous) / previous. - `TimeToFirstApprovalSeconds float64` Median time to first approval in seconds. Zero when no PRs in the range had approvals. - `TimeToFirstApprovalTrend float64` Fractional change in time_to_first_approval_seconds vs previous period. Computed as (current - previous) / previous. ### Example ```go package main import ( "context" "fmt" "time" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" "github.com/gitpod-io/gitpod-sdk-go/shared" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Usage.GetPrSummary(context.TODO(), gitpod.UsageGetPrSummaryParams{ DateRange: gitpod.F(shared.DateRangeParam{ EndTime: gitpod.F(time.Now()), StartTime: gitpod.F(time.Now()), }), ProjectID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Sparkline) } ``` #### Response ```json { "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 } } ```