Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add Prometheus scraping annotations only if serviceMonitor not created #939

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

SebPlv
Copy link
Contributor

@SebPlv SebPlv commented Oct 17, 2023

What does this PR do?

There are two ways to enable Prometheus scraping :

  • If using Prometheus Operator, you have to create ServiceMonitors or PodMonitors crds.
  • If using Prometheus without Operator, you have to define scraping configuration in pods (or service) annotation.

This PR intend to add Prometheus scraping Annotations only if 'metrics.prometheus' exists but 'metrics.prometheus.serviceMonitor' does not..

Motivation

Adding scraping annotations and ServiceMonitor (or podMonitor) for the same pod can result to get metrics being collected twice by Prometheus.

More

  • Yes, I updated the tests accordingly
  • Yes, I ran make test and all the tests passed

@mloiseleur mloiseleur changed the title Add Prometheus scraping annotations only if serviceMonitor not created fix: add Prometheus scraping annotations only if serviceMonitor not created Oct 17, 2023
@mloiseleur
Copy link
Contributor

Thanks for this PR @SebPlv !

@traefiker traefiker merged commit 6b2268f into traefik:master Oct 17, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants