I want to have one job that scraps both instances of my web app. I have a load balancer in place and if I use one target then Prometheus scraps one time from one instance and the next time from the other instance.
I need to tell him to scrap using two targets but the instances listen to the same URL with the only way to distinguish them is a parameter.
https://example.com/metrics?instance=abc1instance
https://example.com/metrics?instance=abc2instance
I tried using the params
array but this doesn’t create a second instance within the job, it just request using both parameters.
- job_name: 'example'
scrape_interval: 30s
params:
instance: ['abc1instance','abc2instance']
static_configs:
- targets: ['example.com']
metrics_path: /metrics
scheme: https
How can I get both metrics within the same job? Should I create another job for that? What is the best way to handle this case?