-
Notifications
You must be signed in to change notification settings - Fork 496
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 API] Rename init
to build
#2232
[Metrics API] Rename init
to build
#2232
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2232 +/- ##
=====================================
Coverage 79.1% 79.1%
=====================================
Files 121 121
Lines 21171 21171
=====================================
+ Hits 16760 16762 +2
+ Misses 4411 4409 -2 ☔ View full report in Codecov by Sentry. |
@@ -12,6 +12,17 @@ | |||
- Updated the return types of `InstrumentProvider` trait methods to return the instrument instead of a `Result`. [#2227](https://github.com/open-telemetry/opentelemetry-rust/pull/2227) | |||
- **Breaking change for exporter authors:** Marked `KeyValue` related structs and enums as `non_exhaustive`. [#2228](https://github.com/open-telemetry/opentelemetry-rust/pull/2228) | |||
- **Breaking change for log exporter authors:** Marked `AnyValue` enum as `non_exhaustive`. [#2230](https://github.com/open-telemetry/opentelemetry-rust/pull/2230) | |||
- **Breaking change for Metrics users:** The `init` method used to create instruments has been renamed to `build`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changelog about try_init still refers to "init". lets change that also.
Alternatively, we can make a single changelog entry consolidating the user-facing changes. Something like
Removed try_init
method from instrument builders. To build instruments, user the build()
method.
This method always return an instrument - in case of no sdk being enabled or instrument validation failed (invalid name etc.), or the instrument is disabled using views, the instrument internally uses a no-op.
eg:
before:
let counter = meter.u64_counter("my_counter").init();
let counter = meter.u64_counter("my_counter").try_init();
after:
let counter = meter.u64_counter("my_counter").build();
Merging. The changelog suggestions can be handled in a consolidated way before next release. |
Towards #1699
Changes
init
method tobuild
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes