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

Metrics - Instrument Name Validation fixes #2166

Merged

Conversation

cijothomas
Copy link
Member

Related to #1699
This does not change the name of the APIs or remove any. That'll be coming next.
This PR ensures that NoOpInstruments are returned incase of any instrument configuration errors, instead of promised Panic (which was not implemented anyway).
Removed test only setting of Erroring for validation.
Also does some refactoring to get some code reuse (plenty of remaining opportunities here, just did a minimal one in this PR)
Added unit tests for validations, and also e2e (inmemoryexporter based) to ensure instruments are no-op. (This actually fixed the existing bug that current SDK allowed invalid instrument names to still operate).

In next set of PRs, will proceed with removing try_init, renaming init to build, and better handling of edge cases, along with further refactoring to move common code to helpers.!
Changelog will be added before release covering full changes as part of #1699

@cijothomas cijothomas requested a review from a team as a code owner October 2, 2024 17:29
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 86.89655% with 38 lines in your changes missing coverage. Please review.

Project coverage is 79.0%. Comparing base (ed27611) to head (e7c19ba).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-sdk/src/metrics/meter.rs 85.3% 33 Missing ⚠️
opentelemetry-sdk/src/metrics/mod.rs 95.0% 3 Missing ⚠️
opentelemetry-sdk/src/metrics/pipeline.rs 50.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2166     +/-   ##
=======================================
- Coverage   79.2%   79.0%   -0.2%     
=======================================
  Files        121     121             
  Lines      20980   20859    -121     
=======================================
- Hits       16625   16490    -135     
- Misses      4355    4369     +14     

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

@cijothomas
Copy link
Member Author

The biggest learning from this PR is that - I made plenty of silly copy-paste errors, but all of them were nicely caught by the InMemoryExporter based E2E tests. Though we still have opportunities to further improve test coverage, this is already yielding results and hopefully, continue to do so, as we are about to start the next set of major refactor, in the collect/export pipelein!

Copy link
Contributor

@utpilla utpilla left a comment

Choose a reason for hiding this comment

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

Looks good overall! Left some comments about removing unnecessary code and increasing test coverage.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM.

@cijothomas cijothomas merged commit 86dd486 into open-telemetry:main Oct 2, 2024
25 checks passed
cijothomas added a commit to cijothomas/opentelemetry-rust that referenced this pull request Oct 4, 2024
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.

3 participants