provider engineering_analyticsengineering_analytics GET /api/projects/{project_id}/engineering_analytics/flaky_tests/
@utdk/posthog /api/projects/{project_id}/engineering_analytics/flaky_tests/
engineering_analytics_flaky_tests
The flaky-test leaderboard: backend tests ranked by flakiness signal from the per-test CI spans, over a window (default -7d, maximum 30 days). A test qualifies by passing on retry at least min_rerun_passes times OR failing on at least min_failed_prs distinct PRs. All figures are absolute counts, never rates: fast passing runs are not emitted, so denominators are biased. Pass-on-retry counts only flow from CI lanes running with reruns enabled; in other lanes a flake surfaces as a plain failure, which the distinct-PR count catches.
date_from query
Window start: relative ('-7d', '-30d') or ISO8601. Defaults to -7d; the window may span at most 30 days.
string
date_to query
Window end: relative or ISO8601. Defaults to now.
string
limit query
Maximum number of tests to return (1-200). Defaults to 50.
integer
min_failed_prs query
A test qualifies once it failed on at least this many distinct pull requests in the window (OR-ed with min_rerun_passes). Minimum 1. Defaults to 3.
integer
min_rerun_passes query
A test qualifies once it passed on retry at least this many times in the window (OR-ed with min_failed_prs). Minimum 1. Defaults to 1.
integer
project_id path required
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
string
source_id query
Connected GitHub data warehouse source to read from. Defaults to the oldest connected GitHub source when the team has more than one.
string

Try it

Authentication
Configure credentials for PostHog API
engineeringAnalyticsFlakyTests
GET/api/projects/{project_id}/engineering_analytics/flaky_tests/
The flaky-test leaderboard: backend tests ranked by flakiness signal from the per-test CI spans, over a window (default -7d, maximum 30 days). A test qualifies by passing on retry at least min_rerun_passes times OR failing on at least min_failed_prs distinct PRs. All figures are absolute counts, never rates: fast passing runs are not emitted, so denominators are biased. Pass-on-retry counts only flow from CI lanes running with reruns enabled; in other lanes a flake surfaces as a plain failure, which the distinct-PR count catches.

Parameters

required

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

Window start: relative ('-7d', '-30d') or ISO8601. Defaults to -7d; the window may span at most 30 days.

Window end: relative or ISO8601. Defaults to now.

Maximum number of tests to return (1-200). Defaults to 50.

A test qualifies once it failed on at least this many distinct pull requests in the window (OR-ed with min_rerun_passes). Minimum 1. Defaults to 3.

A test qualifies once it passed on retry at least this many times in the window (OR-ed with min_failed_prs). Minimum 1. Defaults to 1.

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

Configure credentials above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import posthog from '@utdk/posthog';

await posthog.engineeringAnalyticsFlakyTests()