Skip to content

Reference

Metric and label names

The metric and label names endpoints of the HTTP API.

GET /datasources/{uid}/metrics

List the metric names of a datasource, up to a limit.

The browser’s only path to metric names; it never calls a datasource directly. It runs the same code, validation and limits as the agent’s list_metrics tool: a Prometheus datasource lists its metrics with their type and help, and a ClickHouse datasource lists the OpenTelemetry metric names of its otel_metrics_* tables with the OTel kind as type and the table. The call takes one of the server’s shared upstream slots, waiting at most 5 seconds for one before it answers 429 too_many_requests with Retry-After, counts against the per-caller in-flight limit, times out after 15 seconds and is never cached. Any query parameter not listed below, or one given twice, is a 400.

Parameters

Name In Type Description
uid (required) path string
search query string Case-insensitive substring filter.
limit query integer Maximum names to return. Between 1 and 500. Default 100.

Responses

Status Description Body
200 Up to limit metrics; truncated is true when there were more. object
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
404 The resource does not exist. Error
422 The query or its variables cannot run, or its result exceeds a limit. Error
429 The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. Error
500 The server failed to handle the request. Error
502 The datasource is unavailable. Error
504 The datasource did not answer within the query timeout. Error

GET /datasources/{uid}/labels

List the label names of a datasource, or its OpenTelemetry attribute keys on ClickHouse, up to a limit.

The browser’s only path to label names; it never calls a datasource directly. It runs the same code, validation and limits as the agent’s list_labels tool. ClickHouse labels need table or metric: with only metric the server uses the first otel_metrics_* table that holds it, and answers 404 not_found when none does. A ClickHouse request with neither is a 400. The call takes one of the server’s shared upstream slots, waiting at most 5 seconds for one before it answers 429 too_many_requests with Retry-After, counts against the per-caller in-flight limit, times out after 15 seconds and is never cached. Any query parameter not listed below, or one given twice, is a 400.

Parameters

Name In Type Description
uid (required) path string
metric query string Only names seen on this metric. On ClickHouse it also finds the metric’s table when table is not given.
table query string ClickHouse table such as otel_logs; Prometheus ignores it.
search query string Case-insensitive substring filter.
limit query integer Maximum names to return. Between 1 and 500. Default 100.

Responses

Status Description Body
200 Up to limit label names; truncated is true when there were more. object
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
404 The resource does not exist. Error
422 The query or its variables cannot run, or its result exceeds a limit. Error
429 The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. Error
500 The server failed to handle the request. Error
502 The datasource is unavailable. Error
504 The datasource did not answer within the query timeout. Error

GET /datasources/{uid}/labels/{name}/values

List the values of one label of a datasource, up to a limit.

The browser’s only path to label values; it never calls a datasource directly. It runs the same code, validation and limits as the agent’s list_label_values tool. ClickHouse labels need table or metric, as for the label names operation, and a malformed label name is a 422 query_invalid. The call takes one of the server’s shared upstream slots, waiting at most 5 seconds for one before it answers 429 too_many_requests with Retry-After, counts against the per-caller in-flight limit, times out after 15 seconds and is never cached. Any query parameter not listed below, or one given twice, is a 400.

Parameters

Name In Type Description
uid (required) path string
name (required) path string
metric query string Only names seen on this metric. On ClickHouse it also finds the metric’s table when table is not given.
table query string ClickHouse table such as otel_logs; Prometheus ignores it.
search query string Case-insensitive substring filter.
limit query integer Maximum names to return. Between 1 and 500. Default 100.

Responses

Status Description Body
200 Up to limit values of the label; truncated is true when there were more. object
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
404 The resource does not exist. Error
422 The query or its variables cannot run, or its result exceeds a limit. Error
429 The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. Error
500 The server failed to handle the request. Error
502 The datasource is unavailable. Error
504 The datasource did not answer within the query timeout. Error

Generated from api/openapi.yaml at bac0fe39. Report a problem.

/observeOpen source under Apache-2.0.Grafana is a trademark of Grafana Labs. SlashObserve is not affiliated with or endorsed by Grafana Labs.

Search pages and headings.