One health widget of the Analytics page
const url = 'https://beta-api.plune.ai/v1/analytics/health/example?flaky=1&muted=1¬RunDays=30';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://beta-api.plune.ai/v1/analytics/health/example?flaky=1&muted=1¬RunDays=30' \ --header 'Authorization: Bearer <token>'A widget of the Health section of the Analytics page (#1260, epic #1242). Every widget answers the same wrapper — n of N (denominator), the rows behind it, whether they were cut, and what could not be measured. The filter is the one of GET /v1/analytics, and so is the reach: a session reads the projects projects names, a bearer token its own project only. A name that is not a widget is a 404. The page asks once per widget on every change of a filter, so the route has a ceiling of its own: 300 requests a minute per caller, over it 429 with Retry-After. ever_failing — the cases that fail every time: three verdicts or more, every one a failure (the rule of GET /v1/test-cases?health=ever_failing). denominator: n such cases of N — the cases with a pair of verdicts to score, the scored of GET /v1/analytics, so it reads beside the flaky ones («sometimes»). items: up to 20, the longest histories first, { caseId, title, projectId, runs, failures, lastFailedAt }; truncated when there are more. The state now: from and to are ignored. notMeasured says flaky_unscored for the live cases without a pair of verdicts. slowest — the cases that take the longest in the period (from..to, started_at of the runs; with no from the last 90 days, said in notMeasured as period_capped). n of N: the cases whose p95 duration (results.duration_ms) is above the threshold — thresholdMs, or the p95 of all measured results of the own project of the case in the period — of the cases with at least one measured duration. items: up to 20 by p95 descending, { caseId, title, projectId, p50Ms, p95Ms, thresholdMs, runs }; truncated when there are more. A result with no duration is not measured: notMeasured says no_duration with how many of how many, and it is never counted as zero. failures_by_message — the failed results of the period (from..to, started_at of the runs) grouped by their message: failure.headline, else the first line of the error context, normalised as a run’s failure groups are (numbers and quoted values do not split a group). n of N results: the failed or broken results (a muted case’s are not failures) in the groups shown, of all of them. items: up to 20 groups by count descending, { message, count, cases, firstRunId, firstRunProjectId, firstResultId, lastSeenAt } (the first run of the group in the period, with its result); truncated when there are more groups. A failed result with no message is not in a group: notMeasured says failure_no_message with how many of how many. Messages can hold data from tests: they are shown to people who can read the project’s results, as every answer of this route. detached — the cases whose test left the code (state detached): n of N cases, the live manual and automated cases that are not deprecated. items: up to 20, the most recently detached first, { caseId, title, projectId, reason, detachedAt } (reason and detachedAt are the case’s stateReason and stateChangedAt, null when unset); truncated when there are more. The state now: from and to are ignored. cost — what automation spent in the period (from..to, started_at of the runs; with no from the last 90 days, period_capped): the evals’ model calls, priced from the usage of every row of the stored plune sync result, and the project’s AI features (drafts, cases from text, requirements read from a document — what the monthly AI limit counts, by created_at). n of N runs: the runs that spent of the runs of the period. items: up to 3 runs, { runId, projectId, title, kind, startedAt, usd, unknownTokens, tokens, durationMs } — a run with a price nobody knows first, then by usd, then the newest; truncated when the period has more runs. extra: { usd, evalsUsd, aiFeaturesUsd, unknownTokens, evalsUnknownTokens, aiFeaturesUnknownTokens, partlyPricedRuns, usdPerMinute, manualRuns, noModelRuns, cachedRuns, cases, casesTotal } — noModelRuns the runs that are not manual and spent no tokens, cachedRuns those whose tokens all came from the cache; cases up to 3 eval cases by the cost of their rows, { caseId, title, projectId, usd, unknownTokens, runs, rows }, of casesTotal (two live cases with one evalId: the oldest). A price nobody knows is never $0: an eval row with tokens, cost_usd 0 and not from the cache, or an AI feature with tokens and no cost, is counted in unknownTokens, never in usd. usdPerMinute is the evals’ dollars over their minutes, of the runs priced whole; null with none. The run filters narrow the evals only; the AI features belong to no run and are counted for the whole project, said in notMeasured as ai_features_unfiltered. The case filters narrow cases only, said as cost_case_filters_list_only.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The widget’s name.
Query Parameters
Section titled “Query Parameters ”The start of the period, inclusive — ISO 8601 with a time zone. Only the widgets that describe a period read it; the others describe the state now.
The end of the period, inclusive, as from.
Project ids, comma-separated — as on GET /v1/analytics. One you are not in, or one in the bin, is a 404.
Run labels. Repeat for any-of.
Case tags, verbatim and without @. Repeat for any-of.
Run environments. Repeat for any-of.
People, by userId — comma-separated or repeated.
A suite, or a folder with everything beneath it — only with exactly one project in the request.
The case flag isFlaky, as on GET /v1/analytics.
The case flag isMuted, as on GET /v1/analytics.
Widget never_run only (#1260): how many days back it looks for a result; the same bounds and the same 400 as notRunDays on GET /v1/test-cases. Other widgets ignore it.
Widget slowest only (#1260): the duration in milliseconds the p95 of a case must exceed; absent, the p95 of the own project of the case in the period. Outside 1..86400000 is a 400 that names the parameter. Other widgets ignore it.
Responses
Section titled “ Responses ”The widget
object
The name in the path.
n of N units. N = 0 is «no data»; n = 0 with N > 0 is the good state — no row is not a gap.
object
What is counted, a word — cases, suites, results.
The rows behind n; their shape is the widget’s own. May be cut — see truncated.
object
true: more rows than items holds; denominator.n is still the whole count.
A widget’s own figures beside the rows, in its own shape; only cost sends it (#1261).
object
What the widget could not measure, as the notMeasured of GET /v1/analytics: a code, its numbers and the projects it names. [] — everything was measured.
object
object
Example generated
{ "widget": "example", "denominator": { "n": 1, "N": 1, "unit": "example" }, "items": [ {} ], "truncated": true, "extra": {}, "notMeasured": [ { "code": "example", "params": { "additionalProperty": 1 }, "projects": [ "example" ] } ]}A filter GET /v1/analytics would refuse, with the same message
object
Example generated
{ "error": "example"}No / invalid token or session
A widget that does not exist, or a project you are not a member of or one in the bin — the same answer as an id nobody has
object
Example
{ "error": "not found"}Rate-limited: the per-route throttle, or the per-minute request limit of the plan an API token counts by (#1442; the body names the plan, #2092). Retry-After carries the seconds until the window rolls over.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”Seconds until the window rolls over