-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLATFORM-1473] Support opentelemetry 0.21 (#154)
- Loading branch information
Showing
10 changed files
with
95 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
use opentelemetry::{ | ||
propagation::{Injector, TextMapPropagator}, | ||
sdk::propagation::TraceContextPropagator, | ||
}; | ||
use tracing_opentelemetry::OpenTelemetrySpanExt; | ||
|
||
pub fn inject_context(injector: &mut dyn Injector) { | ||
TraceContextPropagator::new().inject_context(&tracing::Span::current().context(), injector); | ||
#[cfg(not(feature = "tracing_opentelemetry_0_21"))] | ||
#[cfg(feature = "tracing_opentelemetry_0_20")] | ||
mod otel_0_20 { | ||
pub use opentelemetry_0_20_pkg::{ | ||
propagation::{Injector, TextMapPropagator}, | ||
sdk::propagation::TraceContextPropagator, | ||
}; | ||
pub use tracing_opentelemetry_0_21_pkg::OpenTelemetrySpanExt; | ||
|
||
pub fn inject_context(injector: &mut dyn Injector) { | ||
TraceContextPropagator::new().inject_context(&tracing::Span::current().context(), injector); | ||
} | ||
} | ||
|
||
#[cfg(feature = "tracing_opentelemetry_0_21")] | ||
mod otel_0_21 { | ||
pub use opentelemetry_0_21_pkg::propagation::{Injector, TextMapPropagator}; | ||
pub use opentelemetry_sdk_0_21_pkg::propagation::TraceContextPropagator; | ||
pub use tracing_opentelemetry_0_22_pkg::OpenTelemetrySpanExt; | ||
|
||
pub fn inject_context(injector: &mut dyn Injector) { | ||
TraceContextPropagator::new().inject_context(&tracing::Span::current().context(), injector); | ||
} | ||
} | ||
|
||
#[cfg(not(feature = "tracing_opentelemetry_0_21"))] | ||
#[cfg(feature = "tracing_opentelemetry_0_20")] | ||
pub use otel_0_20::inject_context; | ||
|
||
#[cfg(feature = "tracing_opentelemetry_0_21")] | ||
pub use otel_0_21::inject_context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters