In Prometheus alerting rules, you can dynamically reference label values inannotationsandlabelsusing template variables. Each alert has access to its labels via the variable $labels, which allows direct insertion of label data into alert messages or descriptions.
To include the value of the instance label dynamically in the description, replace the placeholder INSTANCE_NAME_HERE with:
description: "Instance {{$labels.instance}} down"
or equivalently:
description: "Instance $labels.instance down"
Both forms are valid — the first follows Go templating syntax and is the recommended format.
This ensures that when the alert fires, the instance label (e.g., a hostname or IP) is automatically included in the message, producing outputs like:
Instance 192.168.1.15:9100 down
Options B, C, and D are invalid because $value, $expr, and $metric are not recognized context variables in alert templates.
[References:Verified from Prometheus documentation –Alerting Rules Configuration,Using Template Variables in Annotations and Labels, andPrometheus Templating Guide (Go Templates and $labels usage)sections., , ]