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

[metricbuilder] proposing adding NewMetricData #8255

Merged

Conversation

codeboten
Copy link
Contributor

Description:
Many metric scrapers are setting the instrumentation name after initializing pdata. This change proposes adding a generated function that could be used more generically instead. It pulls the instrumentation name from the metadata for consistency.

Note this PR is updating the code in a few scrapers to show what the change looks like. I'm happy to split that out of this PR if folks are interested in moving forward with this proposal.

Testing: unit tests

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

I think this is a great idea and looks good.

Just one comment on a complementary change.

receiver/nginxreceiver/scraper.go Show resolved Hide resolved
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

LGTM, though we should have a changelog entry for the changes to the instrumentation library names.

Alex Boten added 2 commits March 8, 2022 11:06
Many metric scrapers are setting the instrumentation name after initializing pdata. This change proposes adding a generated function that could be used more generically instead. It pulls the instrumentation name from the metadata for consistency.
@codeboten codeboten force-pushed the codeboten/instrumentation-name branch from 3122208 to 62ccaa4 Compare March 8, 2022 19:06
@codeboten
Copy link
Contributor Author

@djaglowski i added a note to the changelog. Any thoughts on whether the right thing to do is to name receivers: otel/redisreceiver or to update the name in metadata to redis to end up with the same name we have now otel/redis?

Additionally, the scrapers for various host metrics end up with otel/cpu whereas i think the better name would be otel/hostmetrics/cpu. I'm open to suggestions here.

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

@codeboten, I don't feel strongly about it either way, but the more verbose otelcol/redisreceiver,otelcol/hostmetrics/cpu seem slightly clearer to me.

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
@dmitryax
Copy link
Member

dmitryax commented Mar 9, 2022

I agree with @djaglowski. otelcol/hostmetrics/cpu looks better to me

@codeboten
Copy link
Contributor Author

@dmitryax @djaglowski for consistency the hostmetrics scrapers are now identified with: otelcol/hostmetricsreceiver/cpu

I'll follow this PR with another for different components to use NewMetricData. I can tackle the work to remove it shortly after

@codeboten codeboten mentioned this pull request Mar 9, 2022
8 tasks
Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

LGTM

@codeboten codeboten merged commit 978785a into open-telemetry:main Mar 9, 2022
@codeboten codeboten deleted the codeboten/instrumentation-name branch March 9, 2022 21:54
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.

5 participants