I'm already relabeling other things, but the datname
is not working.
relabel_configs:
- source_labels: [datname]
regex: "Prefix-.+"
replacement: "Static"
target_label: datname
The datname
label is also not present in service discovery. Can this be relabeled?
Yes, it's possible, but it needs to be done in the metric_relabel_configs
part, see https://grafana.com/docs/grafana-cloud/account-management/billing-and-usage/control-prometheus-metrics-usage/usage-reduction/ for more details. Summary copied here:
Relabel_config in a Prometheus configuration file
You can apply a relabel_config to filter and manipulate labels at the following stages of metric collection:
Target selection in the
relabel_configs
section of ascrape_configs
job. This allows you to use arelabel_config
object to select targets to scrape and relabel metadata created by any service discovery mechanism.Metric selection in the
metric_relabel_configs
section of ascrape_configs
job. This allows you to use arelabel_config
object to select labels and series that should be ingested into Prometheus storage.Remote Write in the
write_relabel_configs
section of aremote_write
configuration. This allows you to use arelabel_config
to control which labels and series Prometheus ships to remote storage.
So finally this is working:
metric_relabel_configs:
- source_labels: [datname]
regex: "Prefix-.+"
replacement: "Static"
target_label: datname