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

Ability to disable Prometheus scrape annotations #2554

Open
GiorgioBullo opened this issue Jan 22, 2024 · 2 comments
Open

Ability to disable Prometheus scrape annotations #2554

GiorgioBullo opened this issue Jan 22, 2024 · 2 comments
Assignees
Labels
area:collector Issues for deploying collector enhancement New feature or request good first issue Good for newcomers

Comments

@GiorgioBullo
Copy link

GiorgioBullo commented Jan 22, 2024

Component(s)

Collector

Is your feature request related to a problem? Please describe.

When creating an opentelemetry collector, I noticed that the operator always creates the deployments with the following annotations:

    prometheus.io/path: /metrics
    prometheus.io/port: '8888'
    prometheus.io/scrape: 'true' 

I had a look at the code, and it looked to me like they are hardcoded in internal/manifests/collector/annotations.go

In my environment, I am using a servicemonitor to scrape the collector, so I don't want to have those annotations, otherwise I will have 2 jobs scraping my pod.

I found a workaround to disable the annotations scraping. I am overriding the pod annotations using:

spec:
  podAnnotations:
    prometheus.io/scrape: "false"

This works, however it doesn't look clean because now annotations are inconsistent between deployment and pod:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    prometheus.io/path: /metrics
    prometheus.io/port: "8888"
    prometheus.io/scrape: "true"
 ...
spec:
  ...
  template:
    metadata:
      annotations:
        prometheus.io/path: /metrics
        prometheus.io/port: "8888"
        prometheus.io/scrape: "false"
  ...

Describe the solution you'd like

A flag in the collector spec should do the trick to eventually enable/disable these annotations.

Describe alternatives you've considered

A more sophisticated solution would be to give the possibility to choose between these annotations or a servicemonitor created by the opentelemetry operator.

Additional context

Please, ask if it is not clear

@GiorgioBullo GiorgioBullo added enhancement New feature or request needs triage labels Jan 22, 2024
@jaronoff97
Copy link
Contributor

@GiorgioBullo we do already have the option to create a servicemonitor for the collector, I think it would be reasonable to also set this optionally as part of that spec. Would you want to work on this? If not, I can ask around our group and see if anyone can take it.

@jaronoff97 jaronoff97 added area:collector Issues for deploying collector good first issue Good for newcomers and removed needs triage labels Jan 22, 2024
@Toaddyan
Copy link
Contributor

I can work on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants