Rewriting Rule For __metrics_path__ No Longer Required for Promregator 0.5.0 and Later - promregator/promregator GitHub Wiki
Symptom
Up to Promregator version 0.5.0 (excluding), a rewriting rule is necessary for running Promregator in Single Target Scraping mode. The Prometheus' configuration may contain the following block
relabel_configs:
- source_labels: [__meta_promregator_target_path]
action: replace
target_label: __metrics_path__
regex: (.+)
Background / Root Cause
The relabeling configuration in the configuration file of Prometheus is required, as Promregator only exposed the metadata label __meta_promregator_target_path
for specifying the path where Single Target Scraping shall take place.
Starting with 0.5.0, Promregator also sets the metadata label __metrics_path__
for inbound requests of the endpoint at /discovery
. This makes the relabeling configuration superfluous.
Solution
When upgrading or starting to use Promregator version 0.5.0 or later, it is recommended to remove the relabel configuration from the Prometheus' configuration file to prevent collisions.
References
- This approach has also been initiated by https://github.com/prometheus/docs/pull/1190.