> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Grafana: Query Trace Metrics

Runs a TraceQL metrics query against a Grafana Tempo datasource, either as an instant evaluation or a range query over a time window.


> **Availability:** See the [Incident Workflow Actions Overview table](/workflow-actions) for the plans this workflow is available on.

## Description

Execute a TraceQL metrics query, such as `rate()`, `count_over_time()`, or `quantile_over_time()`, against a Grafana Tempo datasource. Use this action to compute request rates, error rates, or latency percentiles from trace data during incident response.

## Instructions

1. If you have not done so, follow the instructions to [Create an Incident Workflow](/ai-automation/automation/incident-workflows#create-an-incident-workflow).
2. When the instructions prompt you to [add actions](/ai-automation/automation/incident-workflows#add-actions), select **this action**.
3. Enter the following **Inputs** and click **Save**.
4. Continue following instructions to **Publish** the Workflow.
5. When the action runs, you will see the **Outputs** listed below.

## Inputs

> **Field References:** Fields with the **\{+\}** icon accept [Field References](/ai-automation/automation/incident-workflows#field-references), which can be useful for referencing incident data or outputs created in prior workflow steps. To add Field References, click **\{+\}**, or enter `{{`, and select relevant fields. Refer to the [Field References](/ai-automation/automation/incident-workflows#field-references) article for more information.

| Name                             | Description                                                                                                                     |
| :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
| **Connection Input**             | The Grafana Connection to use.                                                                                                  |
| **Datasource**                   | The Tempo datasource UID to query.                                                                                              |
| **Query**                        | The TraceQL metrics query. For example, `{ resource.service.name = "checkout" } \| rate() by (span.http.route)`.               |
| **Query Type**<br />_(Optional)_ | `Instant (Single Value)` returns one value per series for the whole window; `Range (Time Series)` returns a time series across it. Defaults to `Range (Time Series)`. |
| **Start Time**<br />_(Optional)_ | The start of the query window, as a listed relative choice (`5m` to `1d`) or an ISO 8601 date. Defaults to `1h (Past 1 Hour)`. |
| **End Time**<br />_(Optional)_   | The end of the query window, as `Now`, a listed relative choice (`5m` to `12h`), or an ISO 8601 date. Defaults to `Now`.       |
| **Step**<br />_(Optional)_       | Resolution step for Range queries, for example `30s`, `1m`, or `5m`. Leave empty to let Tempo choose. Ignored for Instant queries. |
| **Max Series**<br />_(Optional)_ | Maximum number of series to return, from 1 to 1000. Defaults to 100.                                                            |

## Outputs

| Name                  | Description                                                                                                                 |
| :-------------------- | :-------------------------------------------------------------------------------------------------------------------------- |
| **Results**           | Array of series, each with labels and either an array of \{timestamp, value\} data points (Range) or a single value (Instant). |
| **Series Count**      | Total number of series Tempo returned.                                                                                      |
| **Total Data Points** | Number of data points across the returned series.                                                                           |
| **Truncated**         | Whether Tempo returned more series than **Max Series**.                                                                     |
| **Query Used**        | The TraceQL metrics query that was sent to Tempo.                                                                           |
| **Query Type Used**   | `instant` or `range`.                                                                                                       |
| **Time Range Start**  | The start of the query window, in ISO 8601 format.                                                                          |
| **Time Range End**    | The end of the query window, in ISO 8601 format.                                                                            |
| **Result**            | Value that shows if the action was successful or not. Either `Success` or `Failed`.                                         |
| **Result Summary**    | Brief description of what the action did or if it failed.                                                                   |
| **Error**             | Brief description that is populated if the action failed.                                                                   |

<br />
