-
Notifications
You must be signed in to change notification settings - Fork 86
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
chore: update opentelemetry dependencies to 0.27.0 #184
Conversation
In order to solve the compilation issue from benches/metrics.rs with NoopMeterProvider, use opentelemetry::metrics::{InstrumentProvider, Meter, MeterProvider};
struct NoopMeterProvider{
_private: ()
}
impl NoopMeterProvider {
fn new()->Self{
Self{
_private: ()
}
}
}
impl MeterProvider for NoopMeterProvider{
fn meter_with_scope(&self, scope: InstrumentationScope) -> Meter {
Meter::new(Arc::new(NoopMeter::new()))
}
}
struct NoopMeter {
_private: (),
}
impl NoopMeter {
/// Create a new no-op meter core.
fn new() -> Self {
NoopMeter { _private: () }
}
}
impl InstrumentProvider for NoopMeter {}
fn metrics_events(c: &mut Criterion) {
......... |
That was also the solution I was considering. With a maintainer's blessing and some guidance on how to resolve the |
841ea32
to
6752932
Compare
I've resolved the caveats in the OP:
|
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.
Thanks for doing the legwork on this!
Would you mind adding a separate commit with a version bump?
NoopMeterProvider is no longer publicised by upstream opentelemetry crate, so benches/metrics.rs now includes its own implementation. Views are now gated behind 'spec_unstable_metrics_views' for the opentelemetry crate, so they have been removed from the examples.
|
Looks like you'll need to bump the MSRV: https://github.com/tokio-rs/tracing-opentelemetry/blob/v0.1.x/Cargo.toml#L16 (Please make that a separate commit as well.) |
|
Thanks |
Motivation
New version 0.27.0 of the opentelemetry crates was recently released.
Solution
I've updated the dependencies and fixed any outstanding compilation issues caused by breaking changes in the upstream.
Two caveats:
NoopMeterProvider
has been hidden: [Metrics API] Mark NoopMeterProvider as pub(crate) open-telemetry/opentelemetry-rust#2191spec_unstable_metrics_views
, and I wasn't sure whether to still include it in the example: https://github.com/MathiasPius/tracing-opentelemetry/blob/d18214596c97b1243ee955a63bed3875a4f8f5f9/examples/opentelemetry-otlp.rs#L47-L82