Project: Grafana (Observability and Analysis / Observability)
File: configure-tempo-data-source.md

description: Guide for configuring Tempo in Grafana keywords: grafana tempo guide tracing labels: products: cloud enterprise oss menuTitle: Configure Tempo title: Configure the Tempo data source weight: 200 To configure basic settings for the Tempo data source, complete the following steps: Click Connections in the left-side menu. Under Your connections, click Data sources. Enter `Tempo` in the search bar. Select Tempo. On the Settings tab, set the data source's basic configuration options: | Name | Description | | -- | | | Name | Sets the name you use to refer to the data source in panels and queries. | | Default | Sets the data source that's pre-selected for new panels. | | URL | Sets the URL of the Tempo instance, such as `http://tempo`. | | Basic Auth | Enables basic authentication to the Tempo data source. | | User | Sets the user name for basic authentication. | | Password | Sets the password for basic authentication. | You can also configure settings specific to the Tempo data source. This video explains how to add data sources, including Loki, Tempo, and Mimir, to Grafana and Grafana Cloud. Tempo data source set up starts at 4:58 in the video. {{< youtube id="cqHO0oYW6Ic" start="298" >}} The Trace to logs setting configures the that is available when you integrate Grafana with Tempo. There are two ways to configure the trace to logs feature: Use a simplified configuration with default query, or Configure a custom query where you can use a to interpolate variables from the trace or span. Select the target data source from the drop-down list. You can also click Open advanced data source picker to see more options, including adding a data source. Set start and end time shift. As the logs timestamps may not exactly match the timestamps of the spans in trace it may be necessary to search in larger or shifted time range to find the desired logs. Select which tags to use in the logs query. The tags you configure must be present in the span's attributes or resources for a trace to logs span link to appear. You can optionally configure a new name for the tag. This is useful, for example, if the tag has dots in the name and the target data source does not allow using dots in labels. In that case, you can for example remap `http.status` (the span attribute) to `http_status` (the data source field). "Data source" in this context can refer to Loki, or another log data source. Optionally switch on the Filter by trace ID and/or Filter by span ID setting to further filter the logs if your logs consistently contain trace or span IDs. Select the target data source from the drop-down list. You can also click Open advanced data source picker to see more options, including adding a data source. Set start and end time shift. As the logs timestamps may not exactly match the timestamps of the spans in the trace it may be necessary to widen or shift the time range to find the desired logs. Optional: Select tags to map. These tags can be used in the custom query with `${tags}`

This variable interpolates the mapped tags as list in an appropriate syntax for the data source. Only the tags that were present in the span are included; tags that aren't present are omitted You can also configure a new name for the tag. This is useful in cases where the tag has dots in the name and the target data source doesn't allow dots in labels. For example, you can remap `http.status` to `http_status`. If you don't map any tags here, you can still use any tag in the query, for example, `method="${span.tags.method}"`. You can learn more about custom query variables . Skip Filter by trace ID and Filter by span ID settings as these cannot be used with a custom query. Switch on Use custom query. Specify a custom query to be used to query the logs. You can use various variables to make that query relevant for current span. The link will only be shown only if all the variables are interpolated with non-empty values to prevent creating an invalid query. The following table describes the ways in which you can configure your trace to logs settings: | Setting name | Description | | - | | | Data source | Defines the target data source. You can select Loki or any compatible log store. | | Span start time shift | Shifts the start time for the logs query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. | | Span end time shift | Shifts the end time for the logs query, based on the span's end time. You can use time units. Default: `0`. | | Tags | Defines the tags to use in the logs query. Default: `cluster`, `hostname`, `namespace`, `pod`, `service.name`, `service.namespace`. You can change the tag name for example to remove dots from the name if they are not allowed in the target data source. For example, map `http.status` to `http_status`. | | Filter by trace ID | Toggles whether to append the trace ID to the logs query. | | Filter by span ID | Toggles whether to append the span ID to the logs query. | | Use custom query | Toggles use of custom query with interpolation. | | Query | Input to write custom query. Use variable interpolation to customize it with variables from span. | The Trace to metrics setting configures the available when integrating Grafana with Tempo. {{< youtube id="TkapvLeMMpc" >}} There are two ways to configure the trace to metrics feature: Use a basic configuration with a default query, or Configure one or more custom queries where you can use a to interpolate variables from the trace or span. To use a simple configuration, follow these steps: Select a metrics data source from the Data source drop-down. Optional: Choose any tags to use in the query. If left blank, the default values of `cluster`, `hostname`, `namespace`, `pod`, `service.name` and `service.namespace` are used. The tags you configure must be present in the spans attributes or resources for a trace to metrics span link to

You can optionally configure a new name for the tag. This is useful for example if the tag has dots in the name and the target data source doesn't allow using dots in labels. In that case you can for example remap `service.name` to `service_name`. Do not select Add query. Select Save and Test. To use custom queries with the configuration, follow these steps: Select a metrics data source from the Data source drop-down. Optional: Choose any tags to use in the query. If left blank, the default values of `cluster`, `hostname`, `namespace`, `pod`, `service.name` and `service.namespace` are used. These tags can be used in the custom query with `${tags}` variable. This variable interpolates the mapped tags as list in an appropriate syntax for the data source and will only include the tags that were present in the span omitting those that werent present. You can optionally configure a new name for the tag. This is useful in cases where the tag has dots in the name and the target data source doesn't allow using dots in labels. For example, you can remap `service.name` to `service_name` in such a case. If you dont map any tags here, you can still use any tag in the query like this `method="${span.tags.method}"`. You can learn more about custom query variables . Click Add query to add a custom query. Specify a custom query to be used to query metrics data. Each linked query consists of: Link Label: (Optional) Descriptive label for the linked query. Query: The query ran when navigating from a trace to the metrics data source. Interpolate tags using the `$tags` keyword. For example, when you configure the query `requeststotal{$tags}`with the tags `k8s.pod=pod` and `cluster`, the result looks like `requeststotal{pod="nginx-554b9", cluster="us-east-1"}`. Select Save and Test. | Setting name | Description | | - | | | Data source | Defines the target data source. | | Span start time shift | Shifts the start time for the metrics query, based on the span's start time. You can use time units, such as `5s`, `1m`, `3h`. To extend the time to the past, use a negative value. Default: `0`. | | Span end time shift | Shifts the end time for the metrics query, based on the span's end time. You can use time units. Default: `0`. | | Tags | Defines the tags used in linked queries. The key sets the span attribute name, and the optional value sets the corresponding metric label name. For example, you can map `k8s.pod` to `pod`. To interpolate these tags into queries, use the `$tags` keyword. | | Link Label | (Optional) Descriptive label for the linked query. | | Query | Input to write a custom query. Use variable interpolation to customize it with variables from span. | {{< docs/shared source="grafana" lookup="datasources/tempo-traces-to-profiles.md" leveloffset="+1" version="<GRAFANA VERSION>" >}} To use a variable in your trace to logs, metrics or profiles you need to wrap it in `${}`. For example, `${span.name}`. | Variable name | Description | | - | - | | \_\_tags | This variable uses the tag mapping from the UI to create a label matcher string in the specific data source syntax. The variable only uses tags that are present in the

The link is still created even if only one of those tags is present in the span. You can use this if all tags are not required for the query to be useful. | | \_\_span.spanId | The ID of the span. | | \_\_span.traceId | The ID of the trace. | | \_\_span.duration | The duration of the span. | | \_\_span.name | Name of the span. | | \_\_span.tags | Namespace for the tags in the span. To access a specific tag named `version`, you would use `${span.tags.version}`. In case the tag contains dot, you have to access it as `${span.tags["http.status"]}`. | | \_\_trace.traceId | The ID of the trace. | | \_\_trace.duration | The duration of the trace. | | \_\_trace.name | The name of the trace. | The Service Graph setting configures the feature. Configure the Data source setting to define in which Prometheus instance the Service Graph data is stored. To use the Service Graph, refer to the . The Node Graph setting enables the , which is disabled by default. Once enabled, Grafana displays the node graph above the trace view. The Search setting configures . You can configure the Hide search setting to hide the search query option in Explore if search is not configured in the Tempo instance. The TraceID query setting modifies how TraceID queries are run. The time range can be used when there are performance issues or timeouts since it will narrow down the search to the defined range. This setting is disabled by default. You can configure this setting as follows: | Name | Description | | | -- | | Enable time range | Use a time range in the TraceID query. Default: `disabled`. | | Time shift start | Time shift for start of search. Default: `30m`. | | Time shift end | Time shift for end of search. Default: `30m`. | The Span bar setting helps you display additional information in the span bar row. You can choose one of three options: | Name | Description | | | -- | | None | Adds nothing to the span bar row. | | Duration | (Default) Displays the span duration on the span bar row. | | Tag | Displays the span tag on the span bar row. You must also specify which tag key to use to get the tag value, such as `component`. | You can define and configure the Tempo data source in YAML files as part of Grafana's provisioning system. For more information about provisioning and available configuration options, refer to . Example provision YAML file: ```yaml apiVersion: 1 datasources: name: Tempo type: tempo uid: EbPG8fYoz url: http://localhost:3200 access: proxy basicAuth: false jsonData: tracesToLogsV2: datasourceUid: 'loki' spanStartTimeShift: '1h' spanEndTimeShift: '-1h' tags: ['job', 'instance', 'pod', 'namespace'] filterByTraceID: false filterBySpanID: false customQuery: true query: 'method="$${span.tags.method}"' tracesToMetrics: datasourceUid: 'prom' spanStartTimeShift: '1h' spanEndTimeShift: '-1h' tags: [{ key: 'service.name', value: 'service' }, { key: 'job' }] queries: name: 'Sample query' query: 'sum(rate(tracesspanmetricslatencybucket{$$_tags}[5m]))' tracesToProfiles: datasourceUid: 'grafana-pyroscope-datasource' tags: ['job', 'instance', 'pod', 'namespace'] profileTypeId: 'process_cpu:cpu:nanoseconds:cpu:nanoseconds' customQuery: true query: 'method="$${span.tags.method}"' serviceMap: datasourceUid: 'prometheus' nodeGraph: enabled: true search: hide: false traceQuery: timeShiftEnabled: true spanStartTimeShift: '1h' spanEndTimeShift: '-1h' spanBar: type: 'Tag' tag: 'http.path' ``` {{% docs/reference %}} {{% /docs/reference %}}