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
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
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.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