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
use anyhow::Result;use opentelemetry::{global,KeyValue};use opentelemetry_otlp::WithExportConfig;use opentelemetry_sdk::{
trace::{Config,TracerProvider},Resource,};use std::time::Duration;use tracing_subscriber::{fmt, layer::SubscriberExt,EnvFilter,Registry};/// Start the telemetry layer/// # Errors/// Will return an error if the telemetry layer fails to startpubfninit(verbosity_level: tracing::Level) -> Result<()>{let exporter = opentelemetry_otlp::SpanExporter::builder().with_tonic().with_timeout(Duration::from_secs(3)).build()?;let tracer_provider = TracerProvider::builder().with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio).with_config(Config::default().with_resource(Resource::new(vec![KeyValue::new("service.name", env!("CARGO_PKG_NAME")),KeyValue::new("service.version", env!("CARGO_PKG_VERSION")),]))).build();
global::set_tracer_provider(tracer_provider);let tracer = global::tracer(env!("CARGO_PKG_NAME"));let otel_tracer_layer = tracing_opentelemetry::layer().with_tracer(tracer);let fmt_layer = fmt::layer().with_file(true).with_line_number(true).with_thread_ids(false).with_thread_names(false).with_target(false).json();// RUST_LOG=let filter = EnvFilter::builder().with_default_directive(verbosity_level.into()).from_env_lossy().add_directive("hyper=error".parse()?).add_directive("tokio=error".parse()?).add_directive("reqwest=error".parse()?);let subscriber = Registry::default().with(fmt_layer).with(otel_tracer_layer).with(filter);Ok(tracing::subscriber::set_global_default(subscriber)?)}
I expected to see this happen: "compile"
Instead, this happened:
32 | let otel_tracer_layer = tracing_opentelemetry::layer().with_tracer(tracer);
| ----------- ^^^^^^ the trait `opentelemetry::trace::tracer::Tracer` is not implemented for `BoxedTracer`
| |
| required by a bound introduced by this call
The text was updated successfully, but these errors were encountered:
You can see in the second cargo tree you have posted you have different version of opentelemetry from what tracing-opentelemetry uses.
You need to wait for tracing-opentelemetry to update its dependency and then you need to upgrade both. Until then you cannot upgrade just opentelemetry.
Version
Platform
Linux test 6.11.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024 03:30:41 +0000 x86_64 GNU/Linux
Description
I upgraded to opentelemetry 0.27 but can't make a tracer layer, output of
cargo tree | grep opentelemetry
:I tried this code:
I expected to see this happen: "compile"
Instead, this happened:
The text was updated successfully, but these errors were encountered: