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

[prometheusexporter] Expose job and instance labels #9115

Merged
merged 3 commits into from
Apr 13, 2022

Conversation

gouthamve
Copy link
Member

NOTE: This is WIP PR and I wanted to understand if my approach is right before I write the tests for this.

Description:

Fixes #8355

Testing: I've run the collector with the following config and the exposed metrics had job and instance attached to them:

receivers:
  prometheus:
    config:
      scrape_configs:
      - job_name: 'beep-boop'
        scrape_interval: 5s
        static_configs:
        - targets: ['localhost:9090']

processors:
  batch:

exporters:
  logging:
    logLevel: info

  prometheus:
    endpoint: localhost:9091

service:
  pipelines:
    metrics:
      receivers: [prometheus]
      processors: [batch]
      exporters: [prometheus]

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
@project-bot project-bot bot added this to In progress in Collector Apr 7, 2022
@gouthamve
Copy link
Member Author

@dashpole Could you look at my approach of plumbing the resource attributes all the way down, and let me know if it looks okay? If it does, I will work on adding tests.

@dashpole
Copy link
Contributor

dashpole commented Apr 7, 2022

It looks good to me!

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
@gouthamve gouthamve marked this pull request as ready for review April 11, 2022 18:46
@gouthamve gouthamve requested review from a team and Aneurysm9 as code owners April 11, 2022 18:46
@gouthamve
Copy link
Member Author

I've added the tests and the tests caught a bug 😀 @dashpole I think this is ready for review!

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
Collector automation moved this from In progress to Reviewer approved Apr 12, 2022
@jpkrohling jpkrohling merged commit 34486f4 into open-telemetry:main Apr 13, 2022
@gouthamve gouthamve deleted the expose-job-instance-labels branch April 13, 2022 14:00
@Mario-Hofstaetter
Copy link

@gouthamve Could you please update https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/prometheusexporter/README.md to explain the behavior regarding new job and instance labels?
Is job_name from scrape_configs used as job ?

I have added those labels myself in a way so have to be careful not to break anything.

@gouthamve
Copy link
Member Author

Is job_name from scrape_configs used as job ?

Yes. I'll update the docs now.

gouthamve added a commit to gouthamve/opentelemetry-collector-contrib that referenced this pull request May 17, 2022
See: open-telemetry#9115 (comment)

But should I document how we generate the `job` and `instance` labels as well?
Like `service.name`, etc.

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Collector
  
Reviewer approved
Development

Successfully merging this pull request may close these issues.

[prometheusexporter] Add job and instance labels to match federated prometheus
5 participants