5.7 KiB
+++ title = "Tempo" description = "High volume, minimal dependency trace storage. OSS tracing solution from Grafana Labs." keywords = ["grafana", "tempo", "guide", "tracing"] aliases = ["/docs/grafana/latest/features/datasources/tempo"] weight = 1400 +++
Tempo data source
Grafana ships with built-in support for Tempo a high volume, minimal dependency trace storage, OSS tracing solution from Grafana Labs. Add it as a data source, and you are ready to query your traces in [Explore]({{< relref "../explore/_index.md" >}}).
Add data source
To access Tempo settings, click the Configuration (gear) icon, then click Data Sources > Tempo.
Name | Description |
---|---|
Name |
The name using which you will refer to the data source in panels, queries, and Explore. |
Default |
The default data source will be pre-selected for new panels. |
URL |
The URL of the Tempo instance, e.g., http://tempo |
Basic Auth |
Enable basic authentication to the Tempo data source. |
User |
User name for basic authentication. |
Password |
Password for basic authentication. |
Trace to logs
Note: This feature is available in Grafana 7.4+.
This is a configuration for the [trace to logs feature]({{< relref "../explore/trace-integration" >}}). Select target data source (at this moment limited to Loki data sources) and select which tags will be used in the logs query.
- Data source - Target data source.
- Tags - The tags that will be used in the Loki query. Default is
'cluster', 'hostname', 'namespace', 'pod'
. - Span start time shift - A shift in the start time for the Loki query based on the start time for the span. To extend the time to the past, use a negative value. You can use time units, for example, 5s, 1m, 3h. The default is 0.
- Span end time shift - Shift in the end time for the Loki query based on the span end time. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
- Filter by Trace ID - Toggle to append the trace ID to the Loki query.
- Filter by Span ID - Toggle to append the span ID to the Loki query.
Query traces
You can query and display traces from Tempo via [Explore]({{< relref "../explore/_index.md" >}}). You can search for traces if you set up the trace to logs setting in the data source configuration page. To find traces to visualize, use the [Loki query editor]({{< relref "loki.md#loki-query-editor" >}}). To get search results, you must have [derived fields]({{< relref "loki.md#derived-fields" >}}) configured, which point to this data source.
{{< figure src="/static/img/docs/tempo/query-editor-search.png" class="docs-image--no-shadow" caption="Screenshot of the Tempo query editor showing the search tab" >}}
To query a particular trace, select the TraceID query type, and then put the ID into the Trace ID field.
{{< figure src="/static/img/docs/tempo/query-editor-traceid.png" class="docs-image--no-shadow" caption="Screenshot of the Tempo TraceID query type" >}}
Upload JSON trace file
You can upload a JSON file that contains a single trace to visualize it. If the file has multiple traces then the first trace is used for visualization.
{{< figure src="/static/img/docs/explore/tempo-upload-json.png" class="docs-image--no-shadow" caption="Screenshot of the Tempo data source in explore with upload selected" >}}
Here is an example JSON:
{
"batches": [
{
"resource": {
"attributes": [
{ "key": "service.name", "value": { "stringValue": "db" } },
{ "key": "job", "value": { "stringValue": "tns/db" } },
{ "key": "opencensus.exporterversion", "value": { "stringValue": "Jaeger-Go-2.22.1" } },
{ "key": "host.name", "value": { "stringValue": "63d16772b4a2" } },
{ "key": "ip", "value": { "stringValue": "0.0.0.0" } },
{ "key": "client-uuid", "value": { "stringValue": "39fb01637a579639" } }
]
},
"instrumentationLibrarySpans": [
{
"instrumentationLibrary": {},
"spans": [
{
"traceId": "AAAAAAAAAABguiq7RPE+rg==",
"spanId": "cmteMBAvwNA=",
"parentSpanId": "OY8PIaPbma4=",
"name": "HTTP GET - root",
"kind": "SPAN_KIND_SERVER",
"startTimeUnixNano": "1627471657255809000",
"endTimeUnixNano": "1627471657256268000",
"attributes": [
{ "key": "http.status_code", "value": { "intValue": "200" } },
{ "key": "http.method", "value": { "stringValue": "GET" } },
{ "key": "http.url", "value": { "stringValue": "/" } },
{ "key": "component", "value": { "stringValue": "net/http" } }
],
"status": {}
}
]
}
]
}
]
}
Linking Trace ID from logs
You can link to Tempo trace from logs in Loki or Elastic by configuring an internal link. See the [Derived fields]({{< relref "loki.md#derived-fields" >}}) section in the [Loki data source]({{< relref "loki.md" >}}) or [Data links]({{< relref "elasticsearch.md#data-links" >}}) section in the [Elastic data source]({{< relref "elasticsearch.md" >}}) for configuration instructions.