diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b86f9..72da3fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ and this project adheres to --- +## [0.20.0] - 2024-12-02 + +### Added + +- Support for opentelemetry 0.27, now the default version. + +--- + ## [0.19.0] - 2024-11-25 ### Added @@ -487,8 +495,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.19.0...HEAD +[Unreleased]: https://github.com/primait/bridge.rs/compare/0.20.0...HEAD +[0.20.0]: https://github.com/primait/bridge.rs/compare/0.19.0...0.20.0 [0.19.0]: https://github.com/primait/bridge.rs/compare/0.18.0...0.19.0 [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 diff --git a/Cargo.toml b/Cargo.toml index a760bb6..0cb5a03 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.19.0" +version = "0.20.0" # See https://github.com/rust-lang/rust/issues/107557 rust-version = "1.72" @@ -24,7 +24,7 @@ auth0 = [ ] gzip = ["reqwest/gzip"] redis-tls = ["redis/tls", "redis/tokio-native-tls-comp"] -tracing_opentelemetry = ["tracing_opentelemetry_0_26"] +tracing_opentelemetry = ["tracing_opentelemetry_0_27"] tracing_opentelemetry_0_21 = [ "_any_otel_version", @@ -68,6 +68,13 @@ tracing_opentelemetry_0_26 = [ "opentelemetry_0_26_pkg", "opentelemetry_sdk_0_26_pkg", ] +tracing_opentelemetry_0_27 = [ + "_any_otel_version", + "tracing", + "tracing-opentelemetry_0_28_pkg", + "opentelemetry_0_27_pkg", + "opentelemetry_sdk_0_27_pkg", +] _any_otel_version = [] @@ -103,12 +110,14 @@ opentelemetry_0_23_pkg = { package = "opentelemetry", version = "0.23", optional 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_0_27_pkg = { package = "opentelemetry", version = "0.27", 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 } +opentelemetry_sdk_0_27_pkg = { package = "opentelemetry_sdk", version = "0.27", 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 } @@ -116,6 +125,7 @@ tracing-opentelemetry_0_24_pkg = { package = "tracing-opentelemetry", version = 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 } +tracing-opentelemetry_0_28_pkg = { package = "tracing-opentelemetry", version = "0.28", optional = true } [dev-dependencies] flate2 = "1.0" diff --git a/Makefile.toml b/Makefile.toml index a42fb69..fce27ea 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -27,6 +27,7 @@ dependencies = [ "test-otel-0_24", "test-otel-0_25", "test-otel-0_26", + "test-otel-0_27", ] [tasks.test-base] @@ -93,6 +94,15 @@ args = [ "tracing_opentelemetry_0_26", ] +[tasks.test-otel-0_27] +command = "cargo" +args = [ + "test", + "--no-default-features", + "--features", + "tracing_opentelemetry_0_27", +] + [tasks.clippy] dependencies = [ "clippy-base", @@ -103,6 +113,7 @@ dependencies = [ "clippy-otel-0_24", "clippy-otel-0_25", "clippy-otel-0_26", + "clippy-otel-0_27", ] [tasks.clippy-base] @@ -200,6 +211,19 @@ args = [ "warnings", ] +[tasks.clippy-otel-0_27] +command = "cargo" +args = [ + "clippy", + "--no-default-features", + "--features", + "tracing_opentelemetry_0_27", + "--all-targets", + "--", + "-D", + "warnings", +] + [tasks.deny-check] dependencies = [ "deny-check-otel-0_21", @@ -208,6 +232,7 @@ dependencies = [ "deny-check-otel-0_24", "deny-check-otel-0_25", "deny-check-otel-0_26", + "deny-check-otel-0_27", ] [tasks.deny-check-otel-0_21] @@ -276,6 +301,17 @@ args = [ command = "cargo" description = "Run cargo-deny with tracing_opentelemetry_0_26 feature" +[tasks.deny-check-otel-0_27] +args = [ + "deny", + "--no-default-features", + "--features", + "tracing_opentelemetry_0_27", + "check", +] +command = "cargo" +description = "Run cargo-deny with tracing_opentelemetry_0_27 feature" + [tasks.docs] description = "Build docs as they are rendered on docs.rs" command = "cargo" diff --git a/src/request/otel.rs b/src/request/otel.rs index 7df4762..300bf86 100644 --- a/src/request/otel.rs +++ b/src/request/otel.rs @@ -64,6 +64,17 @@ mod otel_0_26 { } } +#[cfg(feature = "tracing_opentelemetry_0_27")] +mod otel_0_26 { + pub use opentelemetry_0_27_pkg::propagation::{Injector, TextMapPropagator}; + pub use opentelemetry_sdk_0_27_pkg::propagation::TraceContextPropagator; + pub use tracing_opentelemetry_0_28_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")] pub use otel_0_21::inject_context; @@ -81,3 +92,6 @@ pub use otel_0_25::inject_context; #[cfg(feature = "tracing_opentelemetry_0_26")] pub use otel_0_26::inject_context; + +#[cfg(feature = "tracing_opentelemetry_0_27")] +pub use otel_0_26::inject_context;