Menu
Choose a product
Scroll for more
Grafana Cloud
Sift analysis - Metric query
This analysis runs a custom Prometheus query configured by the user and uses the result to populate a configurable template.
Inputs
Required:
- None
Optional:
- Custom filters
How it works
Step 1: Process query
Interpolates the user’s query using the investigation labels.
For example: node_load1{namespace=”$namespace”, cluster=”$cluster”} becomes node_load1{namespace=”machine-learning”, cluster=”dev-us-central-0”}
Step 2: Execute query
Executes the query against the discovered Prometheus datasource.
Step 3: Process results
Interpolates the template message using the result of the query.
For example, this template:
I found something interesting!
Expr: {{ .expr }}
{{ range .series -}}
Series: {{ .Labels }}
* Last Timestamp: {{ .LastTimestamp.UTC.Format "2006-01-02T15:04:05Z07:00" }}
* Last Value: {{ .LastValue }}
{{ end -}}Becomes this result:
I found something interesting!
Expr: node_load1{namespace=”machine-learning”, cluster=”dev-us-central-0”}
Series: {foo="bar"}
* Last Timestamp: 1970-01-01T00:00:00Z
* Last Value: 0
Series: {foo="baz"}
* Last Timestamp: 2023-04-06T15:39:27Z
* Last Value: 1What resources does this analysis use?
- Prometheus datasource
How does this analysis determine when a result is interesting?
- If at least one series is returned by the query, the check is considered interesting.
What configurations options are available for this analysis?
Query
The custom PromQL query expression to run.
Message template
A Go template string used to format the output of the check.
The template string has access to the following variables:
expr: the input expression stringinteresting: a boolean indicating whether this check found any interesting resultsseries: an array of time series. Each element has three fields:Labels, a Prometheus Metric implemented as a map from label name to label value used to identify the series.LastTimestamp, the latest timestamp found in the input query.LastValue, the latest value found in the input query.
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Getting started with managing your metrics, logs, and traces using Grafana
In this webinar, we’ll demo how to get started using the LGTM Stack: Loki for logs, Grafana for visualization, Tempo for traces, and Mimir for metrics.
Video

Intro to Kubernetes monitoring in Grafana Cloud
In this webinar you’ll learn how Grafana offers developers and SREs a simple and quick-to-value solution for monitoring their Kubernetes infrastructure.
Video

Building advanced Grafana dashboards
In this webinar, we’ll demo how to build and format Grafana dashboards.