Interview Prep/Monitoring & Observability/PromQL and recording rules

`label_replace` does not change anything

IntermediateTroubleshootingPromQL and recording rules
Answer

Likely causes → The regex does not match the full value (it is anchored), or source and destination arguments are swapped.

Diagnose → Signature: label_replace(v, dst_label, replacement, src_label, regex).

Fix →

label_replace(up, "host", "$1", "instance", "([^:]+):.*")

Prevent → Test regexes on real values before saving recording rules.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL and recording rules