You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tracing = { version = "0.1.40", features = ["log","attributes"] }
tracing-subscriber = { version = "0.3.18", features = ["std", "env-filter","json"] }
opentelemetry = { version = "0.22.0" }
opentelemetry_sdk = { version = "0.22.0", features = ["rt-tokio"] }
opentelemetry-aws = "0.10.0"opentelemetry-otlp = { version = "0.15.0", features = ["grpc-tonic", "tls"] }
tracing-opentelemetry = "0.22.0"
Platform
$ uname -a
Linux ip-172-31-86-254.ec2.internal 6.1.77-99.164.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 13 19:20:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Description
I tried this code with opentelemetry v0.21.0:
opentelemetry = { version = "0.21.0" }
opentelemetry_sdk = { version = "0.21.0", features = ["rt-tokio"] }
opentelemetry-aws = "0.9.0"opentelemetry-otlp = { version = "0.14.0", features = ["grpc-tonic", "tls"] }
tracing-opentelemetry = "0.22.0"
use opentelemetry_sdk::trace::TracerProvider;use tracing_subscriber::prelude::*;use tracing_subscriber::{fmt, fmt::format,EnvFilter};pubfninit_observability() -> Result<(),Error>{let exporter = opentelemetry_otlp::new_exporter().tonic().build_span_exporter()?;// Create a new OpenTelemetry trace pipeline that prints to stdoutlet provider = TracerProvider::builder().with_simple_exporter(exporter).build();let tracer = provider.tracer("readme_example");let fmt_layer = fmt::layer().event_format(format().json());let filter_layer = EnvFilter::from_default_env();let telemetry_layer = tracing_opentelemetry::layer().with_tracer(tracer);let subscriber = tracing_subscriber::registry().with(filter_layer).with(fmt_layer).with(telemetry_layer);
tracing::subscriber::set_global_default(subscriber)?;Ok(())}
When using opentelemetry v0.21.0, rustc raises no error.
However, if using opentelemetry v0.22.0 rustc raises the following error.
tracing = { version = "0.1.40", features = ["log","attributes"] }
tracing-subscriber = { version = "0.3.18", features = ["std", "env-filter","json"] }
opentelemetry = { version = "0.22.0" }
opentelemetry_sdk = { version = "0.22.0", features = ["rt-tokio"] }
opentelemetry-aws = "0.10.0"opentelemetry-otlp = { version = "0.15.0", features = ["grpc-tonic", "tls"] }
tracing-opentelemetry = "0.22.0"
error[E0277]: the trait bound `opentelemetry_sdk::trace::Tracer: opentelemetry::trace::tracer::Tracer` is not satisfied
--> src/observability.rs:28:70
|
28 | let telemetry_layer = tracing_opentelemetry::layer().with_tracer(tracer);
| ----------- ^^^^^^ the trait `opentelemetry::trace::tracer::Tracer` is not implemented for `opentelemetry_sdk::trace::Tracer`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `opentelemetry::trace::tracer::Tracer`:
opentelemetry::global::trace::BoxedTracer
opentelemetry::trace::noop::NoopTracer
opentelemetry_sdk::trace::tracer::Tracer
note: required by a bound in `OpenTelemetryLayer::<S, T>::with_tracer`
--> /home/ec2-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-opentelemetry-0.22.0/src/layer.rs:541:17
|
539 | pub fn with_tracer<Tracer>(self, tracer: Tracer) -> OpenTelemetryLayer<S, Tracer>
| ----------- required by a bound in this associated function
540 | where
541 | Tracer: otel::Tracer + PreSampledTracer + 'static,
| ^^^^^^^^^^^^ required by this bound in `OpenTelemetryLayer::<S, T>::with_tracer`
The text was updated successfully, but these errors were encountered:
Bug Report
Version
Platform
Description
I tried this code with opentelemetry v0.21.0:
When using opentelemetry v0.21.0, rustc raises no error.
However, if using opentelemetry v0.22.0 rustc raises the following error.
The text was updated successfully, but these errors were encountered: