-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
scraperhelper.NewScraper
is awkward to use
#9473
Comments
I think Scraper interface needs a bit more "love" than that. Will give a try to send some PRs/ideas soon |
I agree that it's a bit awkward to use and encountered similar, this is my "triage" attempt. Feel free to rip it apart or add to it if useful Of note is that we may want to start limiting string length of |
So, we've change the underlying datatype from String to Struct in
|
Where do we use the empty value? |
I'd like to try this at #11082 |
Thanks @mrasu, I'll assign it to you |
#### 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 #9473
Re-opening as it wont be completed until the deprecated methods have been removed |
…-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
#### Description As a step of #9473, make the first argument of `scraperhelper.NewScraper` to take `component.Type`. This PR deprecates `NewScraperWithComponentType` as the method is temporary and was created to change an argument of `NewScraper`
…elemetry#11294) #### Description Remove deprecated `scraperhelper.NewScraperWithComponentType` This is the last change for open-telemetry#9473 <!-- Issue number if applicable --> #### Link to tracking issue Fixes open-telemetry#9473
…elemetry#11294) #### Description Remove deprecated `scraperhelper.NewScraperWithComponentType` This is the last change for open-telemetry#9473 <!-- Issue number if applicable --> #### Link to tracking issue Fixes open-telemetry#9473
While working on #9208 I realized that the current way
scraperhelper.NewScraper
works is a bit awkward. The function takes aname string
and then builds an ID with it:opentelemetry-collector/receiver/scraperhelper/scraper.go
Line 64 in f5a7315
It is very common among contrib scrapers to name the scraper with the same name as the component itself, and so we end up building a
component.Type
, converting it to string to pass toNewScraper
and then building it again. I propose we change the first argument to take acomponent.Type
instead.The text was updated successfully, but these errors were encountered: