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/hostmetrics] register scrapers with scraper names #35837

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

braydonk
Copy link
Contributor

@braydonk braydonk commented Oct 16, 2024

Description

This PR changes each scraper's factory to create a scraper with the scraper's name. This is to ensure that logs from the scrapercontroller will contain the name of the scraper.

Link to tracking issue

Fixes #35814

Testing

New unit tests

Built the collector with cpu scraper modified to immediately return an error and got the following message:

2024-10-16T14:58:46.396Z        error   scraperhelper/scrapercontroller.go:205  Error scraping metrics  {"kind": "receiver", "name": "hostmetrics", "data_type": "metrics", "error": "hi i failed", "scraper": "cpu"}

Documentation

Not needed.

This PR changes each scraper's factory to create a scraper with the
scraper's name. This is to ensure that logs from the `scrapercontroller`
will contain the name of the scraper.
@pjanotti pjanotti added the ready to merge Code review completed; ready to merge by maintainers label Oct 18, 2024
@dmitryax dmitryax merged commit cf3f7df into open-telemetry:main Oct 24, 2024
168 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 24, 2024
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…emetry#35837)

#### Description
This PR changes each scraper's factory to create a scraper with the
scraper's name. This is to ensure that logs from the `scrapercontroller`
will contain the name of the scraper.

#### Link to tracking issue
Fixes open-telemetry#35814 

#### Testing
New unit tests

Built the collector with `cpu` scraper modified to immediately return an
error and got the following message:
```
2024-10-16T14:58:46.396Z        error   scraperhelper/scrapercontroller.go:205  Error scraping metrics  {"kind": "receiver", "name": "hostmetrics", "data_type": "metrics", "error": "hi i failed", "scraper": "cpu"}
```
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/hostmetrics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/hostmetrics] should report scraper that failed in case of error
5 participants