Activity log for bug #1994973

Date Who What changed Old value New value Message
2022-10-27 13:26:21 Joakim Nyman bug added bug
2022-10-27 13:27:01 Joakim Nyman 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 ``` 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