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

chore: update opentelemetry dependencies to 0.27.0 #184

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

MathiasPius
Copy link
Contributor

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:

@douggynix
Copy link

douggynix commented Nov 13, 2024

In order to solve the compilation issue from benches/metrics.rs with NoopMeterProvider,
you can declare NoopMeterProvider for the purpose of that metrics. it doesn't hurt replicating the logic in here.
I did it like this, it compiles successfully and the test was being to run successfully. Hope that helps for the compilation errors.

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) {
.........

@MathiasPius
Copy link
Contributor Author

That was also the solution I was considering.

With a maintainer's blessing and some guidance on how to resolve the spec_unstable_metrics_views change, I can make the changes later today :)

@MathiasPius
Copy link
Contributor Author

I've resolved the caveats in the OP:

  • Added implementation of NoopMeterProvider in benches/metrics.rs
  • Enabled spec_unstable_metrics_views feature for opentelemetry-sdk (in dev-dependencies only)

Copy link
Collaborator

@djc djc left a 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?

examples/opentelemetry-otlp.rs Outdated Show resolved Hide resolved
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.
@MathiasPius
Copy link
Contributor Author

  • Removed the "views" functionality from the example
  • Fixed the cargo hack powerset feature failures, missed some .init() to .build() renames.
  • Bumped version to 0.28.0

@djc
Copy link
Collaborator

djc commented Nov 13, 2024

Looks like you'll need to bump the MSRV:

https://github.com/tokio-rs/tracing-opentelemetry/blob/v0.1.x/Cargo.toml#L16
https://github.com/tokio-rs/tracing-opentelemetry/blob/v0.1.x/.github/workflows/CI.yml#L91

(Please make that a separate commit as well.)

@djc djc merged commit f6fc075 into tokio-rs:v0.1.x Nov 13, 2024
14 checks passed
@djc
Copy link
Collaborator

djc commented Nov 13, 2024

  • Published tracing-opentelemetry v0.28.0 at registry crates-io
  • [new tag] v0.28.0 -> v0.28.0
  • Release notes

@douggynix
Copy link

Thanks

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