Relabeling: Best Practices
Understand Edge Cases and Special Labels
When using relabeling in Prometheus, it's important to understand several edge cases and special internal labels that affect scraping and target behavior.
Common Edge Cases
Missing
__address__: If the__address__label is missing, Prometheus will drop the target and no metrics will be scraped.Missing Port in
__address__: If__address__lacks a port, Prometheus automatically appends one based on the__scheme__value. Forhttpor an empty scheme, the port defaults to80; forhttps, it defaults to443.__address__Contains a Slash: If the value of__address__contains/(e.g.,localhost:9090/), the target will be dropped because it’s not a valid host:port pair.Automatic Removal of Internal Labels: After user-defined relabeling rules are applied, Prometheus automatically removes all labels that start with double underscores (
__). This includes labels such as__address__,__metrics_path__, and__scheme__, which are used internally and should not appear in the final metric set.
Special Labels Reference
| Label | Description | Default Value | Purpose |
|---|---|---|---|
__name__ | The metric name from scraped data. Not part of discovered labels. | N/A | Identifies the metric being scraped. |
__address__ | The TCP address of the scrape target ( |
Observability with Prometheus and Grafana
A Complete Hands-On Guide to Operational Clarity in Cloud-Native SystemsEnroll now to unlock all content and receive all future updates for free.
