Metrics
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
POST | |
GET | |
POST | |
POST | |
GET | |
POST | |
POST |
Retrieve metrics query counts
How often queries read each metric of the team. A metric that no query reads is not in the list.
Required API key scopes
metrics:readQuery parameters
- daysintegerDefault:
30 - limitintegerDefault:
100
Response
Example request
GET /api /projects /:project_id /metrics /query_countsExample response
Status 200
Retrieve metrics query counts
How often queries read each metric of the team. A metric that no query reads is not in the list.
Required API key scopes
metrics:readQuery parameters
- daysintegerDefault:
30 - limitintegerDefault:
100
Response
Example request
GET /api /projects /:project_id /metrics /query_countsExample response
Status 200
List all metrics recording rules
The project's recording rules, by metric name.
Required API key scopes
metrics:readExample request
GET /api /projects /:project_id /metrics /recording_rulesExample response
Status 200
Create metrics recording rules
Create a recording rule. It writes its first result within about a minute.
Required API key scopes
metrics:writeRequest parameters
- metric_namestring
- querystring
- descriptionstringDefault:
- enabledbooleanDefault:
true
Response
Example request
POST /api /projects /:project_id /metrics /recording_rulesExample response
Status 201
Status 400 The rule is not valid, or the project has too many rules.
Retrieve metrics recording rules
Recording rules evaluate a PromQL query every minute and write its result into this project's metrics under a new metric name, so dashboards and alerts can read the stored result instead of the query.
Required API key scopes
metrics:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /metrics /recording_rules /:idExample response
Status 200
Update metrics recording rules
Change a rule's query, description or enabled state. The metric name cannot change.
Required API key scopes
metrics:writePath parameters
- idstring
Request parameters
- querystring
- descriptionstring
- enabledboolean
Response
Example request
PATCH /api /projects /:project_id /metrics /recording_rules /:idExample response
Status 200
Status 400 The edit is not valid, or it tries to change the metric name.
Delete metrics recording rules
Delete a rule. The series it already wrote stay until the project's metrics retention removes them.
Required API key scopes
metrics:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /metrics /recording_rules /:idExample response
Status 204 No response body
Create metrics samples
Raw individual emissions for a metric (the events model), newest first — backs the Samples view and the metric->trace pivot.
Required API key scopes
metrics:readRequest parameters
- query
Response
Example request
POST /api /projects /:project_id /metrics /samplesExample response
Status 200
Create metrics samples
Raw individual emissions for a metric (the events model), newest first — backs the Samples view and the metric->trace pivot.
Required API key scopes
metrics:readRequest parameters
- query
Response
Example request
POST /api /projects /:project_id /metrics /samplesExample response
Status 200
List all metrics suggested dashboards
Dashboards from the metrics dashboard bank that suit the metrics this project sends, best fit first.
Required API key scopes
metrics:readExample request
GET /api /projects /:project_id /metrics /suggested_dashboardsExample response
Status 200
Create metrics suggested dashboards dashboard
Create the suggested dashboard in this project, with only the charts whose metrics the project sends. A second call returns the dashboard that the first one created.
Required API key scopes
metrics:readdashboard:writeinsight:writePath parameters
- idstring
Response
Example request
POST /api /projects /:project_id /metrics /suggested_dashboards /:id /dashboardExample response
Status 201
Status 400 The project no longer sends the metrics of this dashboard.
Create metrics suggested dashboards dismiss
Remove the suggestion from this project's suggested dashboards, for every user of the project. The suggestion does not come back. A dashboard that was created from it stays. A second call does nothing.
Required API key scopes
metrics:writePath parameters
- idstring
Example request
POST /api /projects /:project_id /metrics /suggested_dashboards /:id /dismissExample response
Status 204 The suggestion is dismissed.
Status 404 The project has no such suggestion.
Retrieve metrics values
Distinct metric names for the team. Backs the catalog UI.
Required API key scopes
metrics:readQuery parameters
- first_seenbooleanDefault:
false - fold_histogramsbooleanDefault:
false - limitintegerDefault:
100 - matchstringDefault:
substringOne of:"substring""prefix""regex" - series_statsbooleanDefault:
false - servicestring
- sparklinesbooleanDefault:
true - valuestringDefault:
Response
Example request
GET /api /projects /:project_id /metrics /valuesExample response
Status 200
Retrieve metrics values
Distinct metric names for the team. Backs the catalog UI.
Required API key scopes
metrics:readQuery parameters
- first_seenbooleanDefault:
false - fold_histogramsbooleanDefault:
false - limitintegerDefault:
100 - matchstringDefault:
substringOne of:"substring""prefix""regex" - series_statsbooleanDefault:
false - servicestring
- sparklinesbooleanDefault:
true - valuestringDefault:
Response
Example request
GET /api /projects /:project_id /metrics /valuesExample response
Status 200
Create metrics values
Distinct metric names for the team. Backs the catalog UI.
Required API key scopes
metrics:readRequest parameters
- valuestringDefault:
- limitintegerDefault:
100 - servicestring
- namesarray
Response
Example request
POST /api /projects /:project_id /metrics /valuesExample response
Status 200
Create metrics values
Distinct metric names for the team. Backs the catalog UI.
Required API key scopes
metrics:readRequest parameters
- valuestringDefault:
- limitintegerDefault:
100 - servicestring
- namesarray
Response
Example request
POST /api /projects /:project_id /metrics /valuesExample response
Status 200
Create metrics variable options
The options of one dashboard variable, for the variable selects on dashboards.
Required API key scopes
metrics:readRequest parameters
- source
- querystring | null
- customValuesarray | null
- regexstring | null
- variablesarray
- dateFromstring | null
- dateTostring | null
Response
Example request
POST /api /projects /:project_id /metrics /variable_optionsExample response
Status 200
Create metrics variable options
The options of one dashboard variable, for the variable selects on dashboards.
Required API key scopes
metrics:readRequest parameters
- source
- querystring | null
- customValuesarray | null
- regexstring | null
- variablesarray
- dateFromstring | null
- dateTostring | null
Response
Example request
POST /api /projects /:project_id /metrics /variable_options




