Relabeling is a powerful tool to dynamically rewrite the label set of a target before it gets scraped.
Known subtypes:
Known usages:
All versions:
Multiple relabeling steps can be configured per scrape configuration.
They are applied to the label set of each target in order of their appearance in the configuration file.
Initially, aside from the configured per-target labels,
a target's job label is set to the job_name value of the respective scrape configuration.
The __address__ label is set to the <host>:<port> address of the target.
After relabeling, the instance label is set to the value of __address__
by default if it was not set during relabeling.
The __scheme__ and __metrics_path__ labels
are set to the scheme and metrics path of the target respectively.
The __param_<name> label is set to the value of the first passed URL parameter called <name>.
Additional labels prefixed with __meta_ may be available during the relabeling phase.
They are set by the service discovery mechanism that provided the target and vary between mechanisms.
Labels starting with __ will be removed from the label set after target relabeling is completed.
If a relabeling step needs to store a label value only temporarily
(as the input to a subsequent relabeling step), use the __tmp label name prefix.
This prefix is guaranteed to never be used by Prometheus itself.
The source labels select values from existing labels.
Their content is concatenated using the configured separator
and matched against the configured regular expression for the replace, keep, and drop actions.
Relabeling is a powerful tool to dynamically rewrite the label set of a target before it gets scraped.