set job_name through scrape relation

Bug #1994973 reported by Joakim Nyman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Prometheus2 charm
New
Undecided
Unassigned

Bug Description

I know that it is possible to pass hostname, port and metrics_path through the relation. Is it possible to pass job_name as well? Because if I create multiple objects of the relation they will all be under the same scrape job, overwriting the previous metrics_path. I need it to create multiple scrape jobs with different metrics paths.

Example:

1st object:
event.relation.data[self.model.unit]['hostname'] = "192.168.1.5
event.relation.data[self.model.unit]['port'] = "5555"
event.relation.data[self.model.unit]['metrics_path'] = "/metrics"
event.relation.data[self.model.unit]['job_name'] = "MyMetrics"

2nd object:
event.relation.data[self.model.unit]['hostname'] = "192.168.1.5
event.relation.data[self.model.unit]['port'] = "6666"
event.relation.data[self.model.unit]['metrics_path'] = "/debug/metrics"
event.relation.data[self.model.unit]['job_name'] = "MyDebugMetrics"
```

prometheus.yaml
- job_name: 'MyMetrics'
  metrics_path: '/metrics'
  static_configs:
    - targets:
      - 192.168.1.5:5555
- job_name: 'MyDebugMetrics'
  metrics_path: '/debug/metrics'
  static_configs:
    - targets:
      - 192.168.1.5:6666

description: updated
Revision history for this message
Joakim Nyman (joakimnyman) wrote :

Anyone help on this?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.