Custom Labels
Synthetic monitoring allows you to define custom labels in your check definitions.
Query Custom Labels
Custom labels are published as an info metric sm_check_info
.
All custom labels are prefixed with label_
to make sure they don’t conflict with system defined labels.
e.g: sm_check_info{label_env="prod"}
query will show you check details with env
custom label.
Query Check Metrics with Custom Labels
We can use group_left
to get custom labels with check metrics data.
For example, probe_duration_seconds * on(job, instance, probe) group_left(label_env) sm_check_info
query will include label_env
label in results.
You can then extend your query further, for example by filtering metrics using these labels
probe_duration_seconds * on(job, instance, probe) group_left(label_env) sm_check_info{label_env="prod"}
Related Grafana Cloud resources
Intro to Prometheus and Grafana Cloud
Prometheus is taking over the monitoring world! In this webinar, we will start with a quick introduction to the open source project that’s the de facto standard for monitoring modern, cloud native systems.
How to set up and visualize synthetic monitoring at scale with Grafana Cloud
Learn how to use Kubernetes, Grafana Loki, and Grafana Cloud’s synthetic monitoring feature to set up your infrastructure's checks in this GrafanaCONline session.
Using Grafana Cloud to drive manufacturing plant efficiency
This GrafanaCONline session tells how Grafana helps a 75-year-old manufacturing company with product quality and equipment maintenance.