engineering_analytics
engineering_analytics

Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed by hour/day/week to fit the window. Success rate covers runs that succeeded or ended in a decisive failure. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. Runs under 10 seconds that did no work are excluded when longer successful runs exist. An all-fast workflow uses every successful run. Optionally scope to a single git branch via branch, to one workflow via workflow_name, or to one run group via run_scope (default_branch, pull_request, merge_queue). Use this for 'is CI getting slower' and 'which workflow is the long pole'; compare two windows to get a trend.

get/api/projects/{project_id}/engineering_analytics/workflow_health/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/engineering_analytics/workflow_health/
  • Auth: HTTP bearer

Path parameters

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

branchstring

Optional exact git branch (head_branch) to scope results to, e.g. 'main'. Omit or leave blank to aggregate across all branches.

date_fromstring

Window start: relative ('-24h', '-7d') or ISO8601. Defaults to -24h.

date_tostring

Window end: relative or ISO8601. Defaults to now.

repostring

'owner/name' repository to scope to when the selected source syncs several repositories (from the sources list). Defaults to the source's first repository.

run_scope'all' | 'default_branch' | 'merge_queue' | 'pull_request'

Which group of runs to report on: 'all' (default) is every run; 'default_branch' is runs on master or main; 'pull_request' is runs on PR branches, excluding default-branch and merge-queue runs; 'merge_queue' is the gate runs the merge queue fired before a merge landed. Fork PRs carry no PR attribution (a GitHub limitation), so they appear only under 'all'. Any other value is a 400.

source_idstring uuid

Connected GitHub data warehouse source to read from. Defaults to the oldest connected GitHub source when the team has more than one.

workflow_namestring

Optional exact workflow name to scope results to, e.g. 'Backend CI'. Omit to rank every workflow. Pass it when you want one workflow's figures over the whole window rather than the top slice.

Response

workflow_namestring required

GitHub Actions workflow name.

run_countinteger required

Total runs started in the window.

successful_run_countinteger required

Completed runs with conclusion 'success'.

conclusive_run_countinteger required

Completed runs that succeeded or ended in failure, timeout, startup failure, or staleness. This is the success_rate denominator.

success_ratenumber double nullable required

Fraction of conclusive runs that succeeded (0-1). Failures include failure, timed_out, startup_failure, and stale. Skipped, cancelled, neutral, and action_required runs are excluded. Null if no run reached a verdict.

p50_secondsnumber double nullable required

Median duration in seconds over successful runs only: cancelled (superseded) and failed runs end early and would bias the percentile. Runs under 10 seconds that did no work are excluded when longer successful runs exist. An all-fast workflow uses every successful run. Null if no run succeeded in the window.

p95_secondsnumber double nullable required

95th-percentile duration in seconds over successful runs only: cancelled (superseded) and failed runs end early and would bias the percentile. Runs under 10 seconds that did no work are excluded when longer successful runs exist. An all-fast workflow uses every successful run. Null if no run succeeded in the window.

last_failure_atstring date-time nullable required

When the most recent decisive failure started, or null.

latest_run_failedboolean nullable required

Whether the most recent completed run ended in failure, timeout, startup failure, or staleness. Null when no run has completed in the window. Powers the OK/RED status badge.

latest_run_conclusionstring nullable required

Raw conclusion of the most recent completed run ('success', 'cancelled', 'skipped', ...), so a real pass can be told from a non-failure non-success. Null when none completed.

latest_run_idinteger nullable required
latest_run_attemptinteger nullable required
granularitystring required

Bucket width of the buckets series, chosen to fit the window: 'hour', 'day', or 'week'.

billable_minutesnumber double nullable

Billable (self-hosted) minutes over this workflow's jobs in the window. Null when the job-level source isn't synced.

estimated_cost_usdnumber double nullable

Estimated cost in USD over this workflow's jobs in the window. Null when nothing was costable or the job source isn't synced.

rerun_cyclesinteger

Runs in the window that were a 2nd+ attempt - retry pressure, a flakiness proxy.

success_rate_prevnumber double nullable

Conclusive-run success rate over the equal-length window before date_from - the delta baseline. Null when that window had no conclusive runs.

percentile_run_countinteger

Successful runs lasting at least 10 seconds. Zero when p50/p95 fall back to shorter successful runs.

merge_queue_run_countinteger

Runs on merge-queue gate branches (trunk-merge/**) in the window, counted regardless of branch or run_scope. Non-zero marks a workflow the queue runs before a merge lands, the closest available proxy for a required check.

Changes

No recorded changes to this operation across all 1 revision of this API.