---
title: "GetRunMetrics"
method: POST
path: "/depot.ci.v1.CIService/GetRunMetrics"
tags: ["CIService"]
---

# GetRunMetrics

`POST /depot.ci.v1.CIService/GetRunMetrics`

## Request

- Base URL: `https://api.depot.dev`
- URL: `https://api.depot.dev/depot.ci.v1.CIService/GetRunMetrics`
- Auth: HTTP bearer

Returns workflow, job, and attempt CPU and memory metric summaries for one run.

## Headers

- `Connect-Protocol-Version` 1, required: Define the version of the Connect protocol
- `Connect-Timeout-Ms` number: Define the timeout, in ms

## Request body

- DepotCiV1GetRunMetricsRequest
  - `runId` string, required: Unique identifier for the CI run. Returned by `Run`, `DispatchWorkflow`, and `ListRuns`.

## Response `200`

Success

- DepotCiV1GetRunMetricsResponse
  - `run` DepotCiV1CIMetricsRunContext
    - `runId` string: Unique identifier for the CI run.
    - `repo` string: GitHub repository in `owner/name` format. For example, "depot/cli".
    - `ref` string: Git ref the run was triggered against. Empty when the trigger carries no ref.
    - `sha` string: Commit SHA the run executes against. Empty for open pull_request runs.
    - `headSha` string: Source commit SHA for pull_request and merge_group triggers. Empty for triggers that don't carry a head SHA.
    - `trigger` string: Event that triggered the run. For example, "push", "pull_request", "pull_request_target", "issue_comment", "merge_group", "schedule", "workflow_run", or "workflow_dispatch".
    - `status` string: Current state of the run, for example "queued", "running", "finished", "failed", or "cancelled".
    - `createdAt` string: Run creation time, in RFC 3339 format.
    - `startedAt` string: Run start time, in RFC 3339 format. Empty until the run starts.
    - `finishedAt` string: Run finish time, in RFC 3339 format. Empty until the run finishes.
  - `workflows` DepotCiV1CIMetricsWorkflowMetrics[]: Per-workflow rollups containing each workflow's jobs and per-attempt metric summaries.
    - `workflow` DepotCiV1CIMetricsWorkflowContext
      - `workflowId` string: Unique identifier for the workflow.
      - `workflowPath` string: Workflow file path, for example ".depot/workflows/ci.yml". Empty when the workflow YAML was passed via `workflowContent` in the `Run` request.
      - `name` string: Workflow name from the YAML `name:` key. Falls back to the file path stem when the workflow doesn't set `name:`. Empty when neither is available.
      - `status` string: Current state of the workflow, for example "queued", "running", "finished", "failed", or "cancelled".
      - `createdAt` string: Workflow creation time, in RFC 3339 format.
      - `startedAt` string: Workflow start time, in RFC 3339 format. Empty until the workflow starts.
      - `finishedAt` string: Workflow finish time, in RFC 3339 format. Empty until the workflow finishes.
    - `jobs` DepotCiV1CIMetricsJobMetrics[]: Jobs in the workflow and their per-attempt metric summaries.
      - `job` DepotCiV1CIMetricsJobContext
        - `jobId` string: Unique identifier for the job.
        - `jobKey` string: Job key from the workflow. For example, "build" or "test".
        - `status` string: Current state of the job. Can be "queued", "waiting", "running", "finished", "failed", "cancelled", or "skipped". "waiting" means the job is blocked behind another run that holds the same `concurrency:` group slot.
        - `conclusion` string: Conclusion of the job. Can be "success", "failure", "cancelled", "skipped", or "timed_out". Empty until the job concludes.
        - `currentAttempt` integer: Most recent attempt number for this job. Zero until the first attempt is dispatched.
        - `createdAt` string: Job creation time, in RFC 3339 format.
        - `startedAt` string: Job start time, in RFC 3339 format. Empty until the job starts.
        - `finishedAt` string: Job finish time, in RFC 3339 format. Empty until the job finishes.
      - `attempts` DepotCiV1CIMetricsAttemptSummary[]: Per-attempt metric summaries for this job, ordered by attempt number ascending.
        - `attempt` DepotCiV1CIMetricsAttemptContext
          - `attemptId` string: Unique identifier for the job attempt.
          - `attempt` integer: Attempt number, starting at 1 for the first run.
          - `status` string: Current state of the attempt. Can be "queued", "waiting", "running", "finished", "failed", or "cancelled".
          - `conclusion` string: Conclusion of the attempt. Can be "success", "failure", "cancelled", "skipped", or "timed_out". Empty until the attempt concludes.
          - `sandboxId` string: Unique identifier for the sandbox that ran this attempt, when one exists.
          - `sessionId` string: Unique identifier for the interactive session attached to that sandbox, when one is available.
          - `createdAt` string: Attempt creation time, in RFC 3339 format.
          - `startedAt` string: Attempt start time, in RFC 3339 format. Empty until the attempt starts.
          - `finishedAt` string: Attempt finish time, in RFC 3339 format. Empty until the attempt finishes.
        - `availability` DepotCiV1CIMetricsAvailability
          - `code` 'CI_METRICS_AVAILABILITY_CODE_UNSPECIFIED' | 'CI_METRICS_AVAILABILITY_CODE_AVAILABLE' | 'CI_METRICS_AVAILABILITY_CODE_NO_SANDBOX' | 'CI_METRICS_AVAILABILITY_CODE_NO_TIME_RANGE' | 'CI_METRICS_AVAILABILITY_CODE_NO_SAMPLES': Whether CPU and memory metrics are available for a job attempt, and if not, why. - AVAILABLE: Metrics samples were observed for the attempt. - NO_SANDBOX: The attempt never ran on a sandbox, so no metrics could be collected. - NO_TIME_RANGE: The attempt has no resolvable start and finish time, so no metric window could be queried. - NO_SAMPLES: The attempt ran on a sandbox but no samples were recorded in its time range.
          - `reason` string: Short reason string matching the code, for example "available", "no_sandbox", "no_time_range", or "no_samples".
        - `stats` DepotCiV1CIMetricsStats
          - `sampleCount` integer: Total number of merged samples observed for the attempt.
          - `cpuSampleCount` integer: Number of samples that included a CPU utilization value.
          - `memorySampleCount` integer: Number of samples that included a memory utilization value.
          - `peakCpuUtilization` number, double, nullable: Peak observed CPU utilization as a fraction from 0 to 1. Unset when no CPU samples were observed.
          - `averageCpuUtilization` number, double, nullable: Average observed CPU utilization as a fraction from 0 to 1. Unset when no CPU samples were observed.
          - `peakMemoryUtilization` number, double, nullable: Peak observed memory utilization as a fraction from 0 to 1. Unset when no memory samples were observed.
          - `averageMemoryUtilization` number, double, nullable: Average observed memory utilization as a fraction from 0 to 1. Unset when no memory samples were observed.
          - `observedStartedAt` string: Timestamp of the first observed sample, in RFC 3339 format. Empty when no samples were observed.
          - `observedFinishedAt` string: Timestamp of the last observed sample, in RFC 3339 format. Empty when no samples were observed.
          - `peakMemoryUsageBytes` union: Peak observed memory usage in bytes. Unset when no memory samples were observed.
            - integer
            - string, int64
          - `averageMemoryUsageBytes` number, double, nullable: Average observed memory usage in bytes. Unset when no memory samples were observed.
        - `cap` DepotCiV1CIMetricsCapMetadata
          - `rawSampleCount` integer: Raw sample count observed before downsampling.
          - `returnedSampleCount` integer: Number of samples returned in the response.
          - `maxReturnedSampleCount` integer: Hard cap on the number of samples a single response will return.
          - `downsampled` boolean: True when the raw samples were downsampled to fit maxReturnedSampleCount.
          - `downsampleStrategy` string: Identifier for the downsampling strategy used, for example "peak_preserving_even". Empty when no downsampling was applied.
  - `snapshotAt` string: Server time at which this metrics snapshot was captured, in RFC 3339 format. For attempts that haven't finished yet, CPU and memory data is collected up to this time, so a running attempt's metrics grow on successive calls.

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/depot/apis/depot-ci-api.md) - [All operations](https://skmtc.dev/depot/apis/depot-ci-api/llms.txt) - [OpenAPI document](https://skmtc.dev/depot/apis/depot-ci-api/revisions/6cf759b535b4?raw)
