I'm using the prometheus file based service discovery. However when pulling in my list of servers I realized that my service's metrics endpoint is /prometheus
no /metrics
I've seen that I can use relabelling to fix this.
- job_name: 'servers-dev'
file_sd_configs:
- files: ['/prometheus/topology.json']
relabel_configs:
- source_labels: [?????]
action: replace
target_label: __metrics_path__ #I want this to be /prometheus
regex: (.+)
How can I add in label using relabeling?
There's no need to use relabelling here, you can just add
to the scrape config.
To do this with relabelling you'd do:
as the defaults are such that you don't need to worry about the other config options.