diff --git a/CHANGELOG.md b/CHANGELOG.md index e6b0088..d67f3ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ and this project adheres to --- +## [0.18.0] - 2024-10-22 + +### Added + +- Support for opentelemetry 0.26, now the default version. + +--- + ## [0.17.0] - 2024-09-27 ### Added @@ -467,8 +475,8 @@ Request::rest(&bridge).send() The old API is still available but deprecated. It will be removed soon. - -[Unreleased]: https://github.com/primait/bridge.rs/compare/0.17.0...HEAD +[Unreleased]: https://github.com/primait/bridge.rs/compare/0.18.0...HEAD +[0.18.0]: https://github.com/primait/bridge.rs/compare/0.17.0...0.18.0 [0.17.0]: https://github.com/primait/bridge.rs/compare/0.16.6...0.17.0 [0.16.6]: https://github.com/primait/bridge.rs/compare/0.16.5...0.16.6 [0.16.5]: https://github.com/primait/bridge.rs/compare/0.16.4...0.16.5 diff --git a/Cargo.toml b/Cargo.toml index b36bff6..8a78db5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT" name = "prima_bridge" readme = "README.md" repository = "https://github.com/primait/bridge.rs" -version = "0.17.0" +version = "0.18.0" # See https://github.com/rust-lang/rust/issues/107557 rust-version = "1.72" @@ -16,7 +16,7 @@ default = ["tracing_opentelemetry"] auth0 = ["rand", "redis", "jsonwebtoken", "chrono", "chacha20poly1305", "dashmap", "tracing"] gzip = ["reqwest/gzip"] redis-tls = ["redis/tls", "redis/tokio-native-tls-comp"] -tracing_opentelemetry = [ "tracing_opentelemetry_0_25" ] +tracing_opentelemetry = [ "tracing_opentelemetry_0_26" ] tracing_opentelemetry_0_20 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_21_pkg", "opentelemetry_0_20_pkg"] tracing_opentelemetry_0_21 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_22_pkg", "opentelemetry_0_21_pkg", "opentelemetry_sdk_0_21_pkg"] @@ -24,6 +24,7 @@ tracing_opentelemetry_0_22 = ["_any_otel_version", "tracing", "tracing-opentelem tracing_opentelemetry_0_23 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_24_pkg", "opentelemetry_0_23_pkg", "opentelemetry_sdk_0_23_pkg"] tracing_opentelemetry_0_24 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_25_pkg", "opentelemetry_0_24_pkg", "opentelemetry_sdk_0_24_pkg"] tracing_opentelemetry_0_25 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_26_pkg", "opentelemetry_0_25_pkg", "opentelemetry_sdk_0_25_pkg"] +tracing_opentelemetry_0_26 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_27_pkg", "opentelemetry_0_26_pkg", "opentelemetry_sdk_0_26_pkg"] _any_otel_version = [] @@ -55,17 +56,20 @@ opentelemetry_0_22_pkg = { package = "opentelemetry", version = "0.22", optional opentelemetry_0_23_pkg = { package = "opentelemetry", version = "0.23", optional = true } opentelemetry_0_24_pkg = { package = "opentelemetry", version = "0.24", optional = true } opentelemetry_0_25_pkg = { package = "opentelemetry", version = "0.25", optional = true } +opentelemetry_0_26_pkg = { package = "opentelemetry", version = "0.26", optional = true } opentelemetry_sdk_0_21_pkg = { package = "opentelemetry_sdk", version = "0.21", optional = true } opentelemetry_sdk_0_22_pkg = { package = "opentelemetry_sdk", version = "0.22", optional = true } opentelemetry_sdk_0_23_pkg = { package = "opentelemetry_sdk", version = "0.23", optional = true } opentelemetry_sdk_0_24_pkg = { package = "opentelemetry_sdk", version = "0.24", optional = true } opentelemetry_sdk_0_25_pkg = { package = "opentelemetry_sdk", version = "0.25", optional = true } +opentelemetry_sdk_0_26_pkg = { package = "opentelemetry_sdk", version = "0.26", optional = true } tracing-opentelemetry_0_21_pkg = { package = "tracing-opentelemetry", version = "0.21", optional = true } tracing-opentelemetry_0_22_pkg = { package = "tracing-opentelemetry", version = "0.22", optional = true } tracing-opentelemetry_0_23_pkg = { package = "tracing-opentelemetry", version = "0.23", optional = true } tracing-opentelemetry_0_24_pkg = { package = "tracing-opentelemetry", version = "0.24", optional = true } tracing-opentelemetry_0_25_pkg = { package = "tracing-opentelemetry", version = "0.25", optional = true } tracing-opentelemetry_0_26_pkg = { package = "tracing-opentelemetry", version = "0.26", optional = true } +tracing-opentelemetry_0_27_pkg = { package = "tracing-opentelemetry", version = "0.27", optional = true } [dev-dependencies] flate2 = "1.0" diff --git a/src/request/otel.rs b/src/request/otel.rs index 2b0a1fc..ea24fb3 100644 --- a/src/request/otel.rs +++ b/src/request/otel.rs @@ -66,6 +66,17 @@ mod otel_0_25 { } } +#[cfg(feature = "tracing_opentelemetry_0_26")] +mod otel_0_26 { + pub use opentelemetry_0_26_pkg::propagation::{Injector, TextMapPropagator}; + pub use opentelemetry_sdk_0_26_pkg::propagation::TraceContextPropagator; + pub use tracing_opentelemetry_0_27_pkg::OpenTelemetrySpanExt; + + pub fn inject_context(injector: &mut dyn Injector) { + TraceContextPropagator::new().inject_context(&tracing::Span::current().context(), injector); + } +} + #[cfg(feature = "tracing_opentelemetry_0_20")] pub use otel_0_20::inject_context; @@ -83,3 +94,6 @@ pub use otel_0_24::inject_context; #[cfg(feature = "tracing_opentelemetry_0_25")] pub use otel_0_25::inject_context; + +#[cfg(feature = "tracing_opentelemetry_0_26")] +pub use otel_0_26::inject_context;