diff --git a/Cargo.toml b/Cargo.toml index 5b45097..0d043ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "datadog-tracing" -version = "0.2.1" +version = "0.3.0" authors = [ "Fernando Goncalves ", - "Alefh Sousa " + "Alefh Sousa ", ] edition = "2021" license = "MIT" @@ -19,20 +19,22 @@ exclude = [".pre-commit-config.yaml"] axum = ["dep:axum", "dep:tokio", "dep:axum-tracing-opentelemetry"] [dependencies] -axum = { version = "^0.7.4", optional = true } -axum-tracing-opentelemetry = { version = "0.16.0", optional = true } -chrono = "^0.4.33" -opentelemetry = { version = "^0.21.0"} -opentelemetry_sdk = { version = "^0.21.2", features = ["rt-tokio"] } -opentelemetry-http = { version = "^0.10.0" } -opentelemetry-datadog = { version = "0.9.0", features = ["reqwest-client"] } -reqwest = { version = "0.11", default-features = false } -serde = { version = "^1.0.196", features = ["derive"] } -serde_json = "^1.0.113" -tokio = { version = "^1.36.0", features = ["signal", "macros"], optional = true} +axum = { version = "^0.7.7", optional = true } +axum-tracing-opentelemetry = { version = "^0.23.0", optional = true } +chrono = "^0.4.38" +opentelemetry = { version = "^0.26.0" } +opentelemetry_sdk = { version = "^0.26.0", features = ["rt-tokio"] } +opentelemetry-http = { version = "^0.26.0" } +opentelemetry-datadog = { version = "^0.14.0", features = ["reqwest-client"] } +reqwest = { version = "^0.12.9", default-features = false } +serde = { version = "^1.0.215", features = ["derive"] } +serde_json = "^1.0.132" +tokio = { version = "^1.41.1", features = [ + "signal", + "macros", +], optional = true } tracing = "^0.1.40" -tracing-appender = "0.2.3" -tracing-opentelemetry = "^0.22.0" +tracing-appender = "^0.2.3" +tracing-opentelemetry = "^0.27.0" tracing-serde = "^0.1.3" tracing-subscriber = { version = "^0.3.18", features = ["env-filter", "json"] } - diff --git a/examples/axum/Cargo.toml b/examples/axum/Cargo.toml index f37499a..b75da0d 100644 --- a/examples/axum/Cargo.toml +++ b/examples/axum/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -axum = "^0.7.4" +axum = "^0.7.5" datadog-tracing = { path = "../..", features = ["axum"] } -tokio = { version = "^1.36.0", features = ["macros", "rt-multi-thread"] } -tower-http = { version = "0.5.1", features = ["timeout"] } +tokio = { version = "^1.38.0", features = ["macros", "rt-multi-thread"] } +tower-http = { version = "0.5.2", features = ["timeout"] } tracing = "^0.1.40" diff --git a/src/tracer.rs b/src/tracer.rs index f48ffc6..5aac102 100644 --- a/src/tracer.rs +++ b/src/tracer.rs @@ -5,17 +5,17 @@ //! //! It also contains a convenience function to build a layer with the tracer. use std::env; -use opentelemetry_sdk::trace::{RandomIdGenerator, Sampler, Tracer}; -use opentelemetry_sdk::trace; -use opentelemetry::global; use std::time::Duration; +use opentelemetry::global; + pub use opentelemetry::trace::{TraceError, TraceId, TraceResult}; use opentelemetry_datadog::{ApiVersion, DatadogPropagator}; +use opentelemetry_sdk::trace::{Config, RandomIdGenerator, Sampler, Tracer}; use tracing::Subscriber; use tracing_opentelemetry::{OpenTelemetryLayer, PreSampledTracer}; use tracing_subscriber::registry::LookupSpan; -pub fn build_tracer() -> TraceResult { +pub fn build_tracer() -> Result { let service_name = env::var("DD_SERVICE") .map_err(|_| <&str as Into>::into("missing DD_SERVICE"))?; @@ -37,13 +37,11 @@ pub fn build_tracer() -> TraceResult { .with_api_version(ApiVersion::Version05) .with_agent_endpoint(format!("http://{dd_host}:{dd_port}")) .with_trace_config( - trace::config() - .with_sampler(Sampler::AlwaysOn) - .with_id_generator(RandomIdGenerator::default()), + Config::default().with_sampler(Sampler::AlwaysOn).with_id_generator(RandomIdGenerator::default()), ) .install_batch(opentelemetry_sdk::runtime::Tokio); - global::set_text_map_propagator(DatadogPropagator::default()); + global::set_text_map_propagator(DatadogPropagator::new()); tracer }