diff --git a/examples/custom-root-span/Cargo.toml b/examples/custom-root-span/Cargo.toml index 3b79b63..12573e2 100644 --- a/examples/custom-root-span/Cargo.toml +++ b/examples/custom-root-span/Cargo.toml @@ -12,8 +12,8 @@ opentelemetry = "0.27" opentelemetry-otlp = "0.27" opentelemetry_sdk = { version = "0.27", features = ["rt-tokio-current-thread"] } opentelemetry-semantic-conventions = "0.27" -tracing-opentelemetry = { version = "0.28" } +tracing-opentelemetry = "0.28" tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] } -tracing-bunyan-formatter = "0.3" tracing-actix-web = { path = "../..", features = ["opentelemetry_0_27"] } +tracing-bunyan-formatter = "0.3" +tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] } diff --git a/examples/custom-root-span/src/main.rs b/examples/custom-root-span/src/main.rs index 17179ac..73af523 100644 --- a/examples/custom-root-span/src/main.rs +++ b/examples/custom-root-span/src/main.rs @@ -85,18 +85,16 @@ fn init_telemetry() { // Start a new otlp trace pipeline. // Spans are exported in batch - recommended setup for a production application. global::set_text_map_propagator(TraceContextPropagator::new()); - let tracer = opentelemetry_otlp::new_pipeline() - .tracing() - .with_exporter( - opentelemetry_otlp::new_exporter() - .tonic() - .with_endpoint("http://localhost:4317"), - ) - .with_trace_config(Config::default().with_resource(RESOURCE.clone())) - .install_batch(TokioCurrentThread) - .expect("Failed to install OpenTelemetry tracer.") - .tracer_builder(APP_NAME) + let otlp_exporter = opentelemetry_otlp::SpanExporter::builder() + .with_tonic() + .with_endpoint("http://localhost:4317") + .build() + .expect("Failed to build the span exporter"); + let provier = opentelemetry_sdk::trace::TracerProvider::builder() + .with_batch_exporter(otlp_exporter, TokioCurrentThread) + .with_config(Config::default().with_resource(RESOURCE.clone())) .build(); + let tracer = provier.tracer(APP_NAME); // Filter based on level - trace, debug, info, warn, error // Tunable via `RUST_LOG` env variable diff --git a/examples/opentelemetry/Cargo.toml b/examples/opentelemetry/Cargo.toml index ecc5800..50dbdb3 100644 --- a/examples/opentelemetry/Cargo.toml +++ b/examples/opentelemetry/Cargo.toml @@ -9,11 +9,11 @@ license = "MIT/Apache-2.0" [dependencies] actix-web = "4" opentelemetry = "0.27" -opentelemetry_sdk = { version = "0.27", features = ["rt-tokio-current-thread"] } opentelemetry-otlp = "0.27" +opentelemetry_sdk = { version = "0.27", features = ["rt-tokio-current-thread"] } opentelemetry-semantic-conventions = "0.27" +tracing = "0.1" +tracing-actix-web = { path = "../..", features = ["opentelemetry_0_27"] } +tracing-bunyan-formatter = "0.3" tracing-opentelemetry = "0.28" tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] } -tracing-bunyan-formatter = "0.3" -tracing-actix-web = { path = "../..", features = ["opentelemetry_0_27"] } -tracing = "0.1.40" diff --git a/examples/opentelemetry/src/main.rs b/examples/opentelemetry/src/main.rs index fab4dce..a82bdd2 100644 --- a/examples/opentelemetry/src/main.rs +++ b/examples/opentelemetry/src/main.rs @@ -25,18 +25,16 @@ fn init_telemetry() { // Start a new otlp trace pipeline. // Spans are exported in batch - recommended setup for a production application. global::set_text_map_propagator(TraceContextPropagator::new()); - let tracer = opentelemetry_otlp::new_pipeline() - .tracing() - .with_exporter( - opentelemetry_otlp::new_exporter() - .tonic() - .with_endpoint("http://localhost:4317"), - ) - .with_trace_config(Config::default().with_resource(RESOURCE.clone())) - .install_batch(TokioCurrentThread) - .expect("Failed to install OpenTelemetry tracer.") - .tracer_builder(APP_NAME) + let otlp_exporter = opentelemetry_otlp::SpanExporter::builder() + .with_tonic() + .with_endpoint("http://localhost:4317") + .build() + .expect("Failed to build the span exporter"); + let provier = opentelemetry_sdk::trace::TracerProvider::builder() + .with_batch_exporter(otlp_exporter, TokioCurrentThread) + .with_config(Config::default().with_resource(RESOURCE.clone())) .build(); + let tracer = provier.tracer(APP_NAME); // Filter based on level - trace, debug, info, warn, error // Tunable via `RUST_LOG` env variable