Skip to content

Commit

Permalink
support zipkin b3 propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Apr 16, 2024
1 parent 4fb4aeb commit d4244a9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
42 changes: 42 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ opentelemetry-http = "0.11.0"
opentelemetry-otlp = { version = "0.15.0", features = ["reqwest-client"] }
opentelemetry-semantic-conventions = "0.14.0"
opentelemetry_sdk = { version = "0.22.1", features = ["rt-tokio"] }
opentelemetry-zipkin = "0.20.0"
prometheus = "0.13.3"
reqwest = "0.11.27"
serde = { version = "1.0.197", features = ["derive"] }
Expand Down
8 changes: 5 additions & 3 deletions crates/sdk/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::time::Duration;

use axum::body::{Body, BoxBody};
use http::{Request, Response};
use opentelemetry::propagation::composite::TextMapCompositePropagator;
use opentelemetry_otlp::WithExportConfig;
use tracing::Span;
use tracing_opentelemetry::OpenTelemetrySpanExt;
Expand All @@ -13,9 +14,10 @@ pub fn init_tracing(
service_name: Option<&str>,
otlp_endpoint: Option<&str>,
) -> Result<(), Box<dyn Error + Send + Sync>> {
opentelemetry::global::set_text_map_propagator(
opentelemetry_sdk::propagation::TraceContextPropagator::new(),
);
opentelemetry::global::set_text_map_propagator(TextMapCompositePropagator::new(vec![
Box::new(opentelemetry_sdk::propagation::TraceContextPropagator::new()),
Box::new(opentelemetry_zipkin::Propagator::new()),
]));

let tracer = opentelemetry_otlp::new_pipeline()
.tracing()
Expand Down

0 comments on commit d4244a9

Please sign in to comment.