Grafana: Query Metrics

📘

Availability

See 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

  1. If you have not done so, follow the instructions to Create an Incident Workflow.
  2. When the instructions prompt you to 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, 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.

NameDescription
Connection InputThe Grafana Connection to use for the query.
DatasourceThe Prometheus datasource UID to query for metrics.
QueryThe 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

NameDescription
ResultsArray of time series, each with labels and an array of {timestamp, value} data points.
Series CountTotal number of time series returned.
Total Data PointsTotal number of data points across all series.
Query UsedThe PromQL query string that was sent to Grafana.
Query Type Usedinstant or range.
Time Range StartThe start time used for the query.
Time Range EndThe end time used for the query.
Search DurationAPI response time in milliseconds.
ResultValue that shows if the action was successful or not. Either Success or Failed.
Result SummaryBrief description of what the action did or if it failed.
ErrorBrief description that is populated if the action failed.
📘

Instant vs. Range queries

Instant 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.