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

[receiver/prometheus] set user agent #21914

Merged
merged 3 commits into from
May 26, 2023
Merged

Conversation

seankhliao
Copy link
Contributor

Description:
Sets the user-agent when the prometheus receiver performs scrapes

Link to tracking Issue: #21910

Testing: run collector locally and log request:

GET /metrics HTTP/1.1
Host: 127.0.0.1:8080
Accept: application/openmetrics-text;version=1.0.0,application/openmetrics-text;version=0.0.1;q=0.75,text/plain;version=0.0.4;q=0.5,*/*;q=0.1
Accept-Encoding: gzip
User-Agent: otelcol-custom/1.0.0
X-Prometheus-Scrape-Timeout-Seconds: 5

Documentation: changelog

@seankhliao seankhliao requested a review from a team May 14, 2023 23:11
@github-actions github-actions bot added the receiver/prometheus Prometheus receiver label May 14, 2023
@@ -281,7 +282,12 @@ func (r *pReceiver) initPrometheusComponents(ctx context.Context, host component
if err != nil {
return err
}
r.scrapeManager = scrape.NewManager(&scrape.Options{PassMetadataInContext: true}, logger, store)
r.scrapeManager = scrape.NewManager(&scrape.Options{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any means we can test this within the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to avoid duplicating most of testComponent to test this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make sure that this doesn't regress again in future.

@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label May 19, 2023
@codeboten codeboten merged commit b9d5c3b into open-telemetry:main May 26, 2023
@github-actions github-actions bot added this to the next release milestone May 26, 2023
@seankhliao seankhliao deleted the prom-ua branch May 26, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/prometheus Prometheus receiver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants