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

Refine scraperhelper.NewScraper to take component.Type directly #11082

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

mrasu
Copy link
Contributor

@mrasu mrasu commented Sep 8, 2024

Description

Create new function to enable to pass component.Type to scraperhelper.NewScraper

Because many contrib scrapers name the scraper with the same name as the component itself, create a function to take component.Type.
For example, https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/0e2bea5ac2763421e1a3943093f67184e109265f/receiver/activedirectorydsreceiver/factory_windows.go#L35 passes metadata.Type.String() as a name of scraper. With this change, you can pass metadata.Type instead

Link to tracking issue

Fixes #9473

Copy link

linux-foundation-easycla bot commented Sep 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@mrasu mrasu marked this pull request as ready for review September 8, 2024 14:12
@mrasu mrasu requested review from a team and bogdandrutu September 8, 2024 14:12
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.20%. Comparing base (2c22ed7) to head (f01bd12).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
receiver/scraperhelper/scraper.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11082      +/-   ##
==========================================
- Coverage   92.21%   92.20%   -0.01%     
==========================================
  Files         414      414              
  Lines       19728    19730       +2     
==========================================
  Hits        18193    18193              
- Misses       1165     1167       +2     
  Partials      370      370              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Thanks!

@mx-psi mx-psi merged commit e599957 into open-telemetry:main Sep 9, 2024
70 of 71 checks passed
@mx-psi
Copy link
Member

mx-psi commented Sep 9, 2024

@mrasu Can you open a PR on https://github.com/open-telemetry/opentelemetry-collector-contrib to make all components use the new API?

@github-actions github-actions bot added this to the next release milestone Sep 9, 2024
@mrasu
Copy link
Contributor Author

mrasu commented Sep 10, 2024

@mx-psi ok, I will

dmathieu pushed a commit to dmathieu/opentelemetry-collector that referenced this pull request Sep 10, 2024
…-telemetry#11082)

#### Description

Create new function to enable to pass `component.Type` to
`scraperhelper.NewScraper`

Because many contrib scrapers name the scraper with the same name as the
component itself, create a function to take `component.Type`.
For example,
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/0e2bea5ac2763421e1a3943093f67184e109265f/receiver/activedirectorydsreceiver/factory_windows.go#L35
passes `metadata.Type.String()` as a name of scraper. With this change,
you can pass `metadata.Type` instead

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes open-telemetry#9473
@mrasu
Copy link
Contributor Author

mrasu commented Sep 10, 2024

Thanks to @djaglowski, optenetelemetry-collector-contrib use the new function now 😺
open-telemetry/opentelemetry-collector-contrib@924040b (#35073)

@mrasu mrasu deleted the refine-new-scraper branch September 10, 2024 14:24
jburns24 added a commit to liatrio/liatrio-otel-collector that referenced this pull request Sep 10, 2024
adrielp pushed a commit to liatrio/liatrio-otel-collector that referenced this pull request Sep 11, 2024
* Updated OpenTelemetry Collector modules for beta modules to 0.109.0 (core and contrib) and updated stable modules to 1.15.0
* Fixed linting violations caused by the deprication of scraperhelper.NewScraper open-telemetry/opentelemetry-collector#11082

Additionally added modules as `providers` in the ocb build configuration file. This resolved transative dependency issues when
building the collector and issues reading config files.
---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Joshua Burns <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scraperhelper.NewScraper is awkward to use
2 participants