Grafana: Query Metrics
AvailabilitySee the Incident Workflow Actions Overview table for the plans this workflow is available on.
Description
Execute a PromQL query against a Grafana Prometheus datasource, either as an instant evaluation or as a range query across a time window. This action enables automated metrics analysis during incident response, allowing teams to programmatically retrieve diagnostic data without manually searching Grafana dashboards.
Instructions
- If you have not done so, follow the instructions to Create an Incident Workflow.
- When the instructions prompt you to add actions, select this action.
- Enter the following Inputs and click Save.
- Continue following instructions to Publish the Workflow.
- When the action runs, you will see the Outputs listed below.
Inputs
Field ReferencesFields with the {+} icon accept 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 article for more information.
| Name | Description |
|---|---|
| Connection Input | The Grafana Connection to use for the query. |
| Datasource | The Prometheus datasource UID to query for metrics. |
| Query | The PromQL query expression. For example, rate(http_requests_total[5m]) or sum by (pod) (container_memory_usage_bytes). |
| Query Type (Optional) | Instant evaluates the query at the End Time; Range returns a time series across the window. |
| Start Time (Optional) | The start time of the query window, used for Range queries. |
| End Time (Optional) | The end time of the query window, also the evaluation time for Instant queries. |
| Step (Optional) | Resolution step for Range queries, for example, 15s, 1m, or 5m. Ignored for Instant queries. |
Outputs
| Name | Description |
|---|---|
| Results | Array of time series, each with labels and an array of {timestamp, value} data points. |
| Series Count | Total number of time series returned. |
| Total Data Points | Total number of data points across all series. |
| Query Used | The PromQL query string that was sent to Grafana. |
| Query Type Used | instant or range. |
| Time Range Start | The start time used for the query. |
| Time Range End | The end time used for the query. |
| Search Duration | API response time in milliseconds. |
| 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. |
Instant vs. Range queriesInstant evaluates the query at the End Time and returns a single value per series. Range returns a time series across the window defined by Start Time and End Time, resolved at the interval set by Step.
