threadSingleValueMetric returns one value for the whole date range, such as median resolution time this month or SLA compliance this quarter. With groupBy, it returns one value per group, which suits tables and leaderboards.
For TypeScript, the GraphQL SDK gives you a fully typed client for these operations.
metrics:read permission, or metricsAgent:read for agent_ metrics. See Permissions.
Get a single value
input takes these fields:
metricName: any single value metric from the metrics referencefromandto: the date range, in UTC. Required for every metric exceptthreads_all_time_count_done, which rejects them. Both are widened to whole hoursmode:METRICfor values, orTHREAD_IDSfor the threads behind thempercentile: for duration metrics, an integer from 1 to 99. Defaults to 50filtersandgroupBy: see Filter and group reporting queries
Query
Variables
Read the response
values has one entry per group, or a single entry when there’s no groupBy. Each entry has a value and a group. value is null when the group had no data in the range. Entries aren’t sorted, so sort them yourself.
Get the threads behind a value
Setmode to THREAD_IDS to get the distinct IDs of the threads behind the value in threadIds. values is null in this mode, and groupBy isn’t allowed, so add a group as a filter to get its threads.
