Skip to content

Commit

Permalink
fix: use TraceContextPropagator instead of DatadogPropagator so trace…
Browse files Browse the repository at this point in the history
…_id show up in the logs properly
  • Loading branch information
fhsgoncalves committed Oct 8, 2023
1 parent dc108ab commit eef9a62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "datadog-tracing"
version = "0.1.0"
version = "0.1.1"
authors = [
"Fernando Goncalves <[email protected]>",
"Alefh Sousa <[email protected]>"
Expand All @@ -19,8 +19,8 @@ exclude = [".pre-commit-config.yaml"]
axum = ["dep:axum", "dep:tokio", "dep:axum-tracing-opentelemetry"]

[dependencies]
axum = { version = "^0.6.10", optional = true}
axum-tracing-opentelemetry = { version = "^0.14.1", optional = true}
axum = { version = "^0.6.10", optional = true }
axum-tracing-opentelemetry = { version = "^0.14.1", optional = true }
chrono = "^0.4.24"
opentelemetry = { version = "^0.20.0", features = ["rt-tokio"] }
opentelemetry-http = { version = "^0.9.0" }
Expand Down
5 changes: 3 additions & 2 deletions src/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ use opentelemetry::sdk::trace::{RandomIdGenerator, Sampler, Tracer};
use opentelemetry::sdk::trace;
use opentelemetry::global;
use std::time::Duration;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::trace::{TraceError, TraceResult};
use opentelemetry_datadog::{ApiVersion, DatadogPropagator};
use opentelemetry_datadog::ApiVersion;
use tracing::Subscriber;
use tracing_opentelemetry::{OpenTelemetryLayer, PreSampledTracer};
use tracing_subscriber::registry::LookupSpan;
Expand Down Expand Up @@ -44,7 +45,7 @@ pub fn build_tracer() -> TraceResult<Tracer> {
)
.install_batch(opentelemetry::runtime::Tokio);

global::set_text_map_propagator(DatadogPropagator::default());
global::set_text_map_propagator(TraceContextPropagator::default());

tracer
}
Expand Down

0 comments on commit eef9a62

Please sign in to comment.