Skip to content

Conversation

@cijothomas
Copy link
Member

@cijothomas cijothomas commented May 21, 2025

Fixes #2985

Continuing from #2984 and #2982

This removes the new_view way of creating a View. Instead users are expected to pass anything implementing View trait. For convenience, View is implemented for Fn(&Instrument) -> Option<Stream>, so this can be used to add a view.

This allowed a lot of other cleanups. If there is a need, more additive changes can be done to make it easier to apply view for the common scenario.

Example of future additions (not part of this PR!):

meter_provider_builder().with_view_on_instrument(name: "Foo", steam: Stream::builder().name("foo-new"));
meter_provider_builder().with_view_on_instrument(name: "Foo*", steam: Stream::builder().unit("unit-new"));
meter_provider_builder().with_view_on_instrument(name: "*", steam: Stream::builder().aggregation(Aggregation::Drop));

@cijothomas cijothomas requested a review from a team as a code owner May 21, 2025 16:50
@codecov
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 81.4%. Comparing base (3cdc62e) to head (a33760c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-sdk/src/metrics/instrument.rs 25.0% 6 Missing ⚠️
opentelemetry-sdk/src/metrics/mod.rs 96.2% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2988   +/-   ##
=====================================
  Coverage   81.3%   81.4%           
=====================================
  Files        126     126           
  Lines      24634   24570   -64     
=====================================
- Hits       20043   20000   -43     
+ Misses      4591    4570   -21     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cijothomas cijothomas changed the title Feat: View cleanups feat: View cleanups May 21, 2025
@cijothomas cijothomas merged commit e123996 into open-telemetry:main May 21, 2025
27 checks passed
@cijothomas cijothomas deleted the cijothomas/view-fix-final branch May 21, 2025 23:57
@yoshi-taka yoshi-taka mentioned this pull request Jun 21, 2025
4 tasks
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.

View allows instrument selection via Description, which is not allowed

2 participants