...
1# A metric with label filtering
2go_gc_duration_seconds{instance="localhost:9090", job="alertmanager"}
3
4# Aggregation operators
5sum by (app, proc) (
6 instance_memory_limit_bytes - instance_memory_usage_bytes
7) / 1024 / 1024
8
9# Metric with multiple lables and whitespaces
10go_gc_duration_seconds{ instance="localhost:9090", job="alertmanager" }
11
12# Expression and comment
13go_gc_duration_seconds{instance="localhost:9090"} # single comment
14
15# Delta function
16delta(cpu_temp_celsius{host="zeus"}[2h])
17
18# Sum with arguments
19sum by (app, proc) (instance_memory_usage_bytes)
20
21# Multi-line with offset
22label_replace(
23 avg by(instance)
24 (irate(node_cpu_seconds_total{mode = "idle"}[5m] offset 3s)
25 ) * 100,
26 "device",
27 "cpu",
28 "instance",
29 ".*"
30)
31
32# Values for labels enclosed within single quotes
33metric_test_app{app='turtle',proc='web'}
34
35# Use label matching operator `!~`
36metric_test_app{status!~'(4|5)..'}
View as plain text