diff --git a/.cargo/config b/.cargo/config index 73d8429..5dbf2c8 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,2 +1,2 @@ [build] - rustflags = ["--cfg", "tokio_unstable"] +# rustflags = ["--cfg", "tokio_unstable"] diff --git a/Cargo.toml b/Cargo.toml index ee37535..14e7834 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] +console = ["console-subscriber"] default = ["object-storage"] object-storage = ["reqwest", "rust-s3"] io-uring = [ @@ -31,7 +32,7 @@ awc = { version = "3.0.0-beta.20", default-features = false, features = [ ] } base64 = "0.13.0" config = "0.11.0" -console-subscriber = "0.1" +console-subscriber = { version = "0.1", optional = true } dashmap = "5.0.0" futures-util = "0.3.17" mime = "0.3.1" diff --git a/src/init_tracing.rs b/src/init_tracing.rs index f238d34..587cc59 100644 --- a/src/init_tracing.rs +++ b/src/init_tracing.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "console")] use console_subscriber::ConsoleLayer; use opentelemetry::{ sdk::{propagation::TraceContextPropagator, Resource}, @@ -28,6 +29,7 @@ pub(super) fn init_tracing( .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE) .with_filter(targets.clone()); + #[cfg(feature = "console")] let console_layer = ConsoleLayer::builder() .with_default_env() .event_buffer_capacity(1024 * 1024) @@ -36,9 +38,11 @@ pub(super) fn init_tracing( let subscriber = Registry::default() .with(format_layer) - .with(console_layer) .with(ErrorLayer::default()); + #[cfg(feature = "console")] + let subscriber = subscriber.with(console_layer); + if let Some(url) = opentelemetry_url { let tracer = opentelemetry_otlp::new_pipeline()