Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Metrics summary API
Warning
The Metrics summary API is an experimental feature that is disabled by default. To enable it, adjust your configuration as suggested below.
This document explains how to use the metrics summary API in Tempo.
This API returns RED metrics (span count, erroring span count, and latency information) for kind=server
spans sent to Tempo in the last hour, grouped by a user-specified attribute.
Configuration
To enable the experimental metrics summary API, you must turn on the local blocks processor in the metrics generator. Be aware that the generator will use considerably more resources, including disk space, if this is enabled:
overrides:
metrics_generator_processors: [..., 'local-blocks']
Request
To make a request to this API, use the following endpoint on the query-frontend:
GET http://<tempo>/api/metrics/summary
Query Parameters
All query parameters must be URL-encoded to preserve non-URL-safe characters in the query such as &
.
Example:
curl "$URL/api/metrics/summary" --data-urlencode 'q={resource.service.name="checkout-service"}' --data-urlencode 'groupBy=name'
Response
The Tempo response is a SpanMetricsSummary
object defined in
tempo.proto, relevant section pasted below:
message SpanMetricsSummaryResponse {
repeated SpanMetricsSummary summaries = 1;
}
message SpanMetricsSummary {
uint64 spanCount = 1;
uint64 errorSpanCount = 2;
TraceQLStatic static = 3;
uint64 p99 = 4;
uint64 p95 = 5;
uint64 p90 = 6;
uint64 p50 = 7;
}
message TraceQLStatic {
int32 type = 1;
int64 n = 2;
double f = 3;
string s = 4;
bool b = 5;
uint64 d = 6;
int32 status = 7;
int32 kind = 8;
}
The response is returned as JSON following standard protobuf->JSON mapping rules.
Note
The
uint64
fields cannot be fully expressed by JSON numeric values so the fields are serialized as strings.
Example:
{
"summaries": [
{
"spanCount": "20",
"series" : [
{
"key": ".attr1",
"value": {
"type": 5,
"s": "foo"
},
},
...
],
"p99": "68719476736",
"p95": "1073741824",
"p90": "1017990479",
"p50": "664499239"
},