canonical / prometheus-k8s-operator

https://charmhub.io/prometheus-k8s
Apache License 2.0
21 stars 35 forks source link

do not add default metrics if lookaside jobs not empty #490

Closed neoaggelos closed 1 year ago

neoaggelos commented 1 year ago

Issue

MetricsEndpointProvider supports a callable function to generate the jobs dynamically. If no static jobs are set, the default scrape job is always added to the scrape jobs.

self._jobs = self._jobs if self._jobs else [DEFAULT_JOB]

Solution

Only return the default job if no static jobs and no lookaside jobs are defined

Context

https://github.com/canonical/charm-microk8s/pull/88

I have assumed that the [DEFAULT_JOB] is just a default fallback, so I do not expect that it should be added in this case. Setting the jobs to an empty list is still adding the default job.

Testing Instructions

Release Notes

Do not add a default scrape job if there are lookaside jobs

sed-i commented 1 year ago

Itests passed, but gha failed to report back. Merging.