diff --git a/CHANGELOG.md b/CHANGELOG.md index 2489144..25ed6b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ and this project adheres to --- +## [0.16.6] - 2024-09-05 + +### Added + +- Support for opentelemetry 0.24, now the default version. + +--- + ## [0.16.6] - 2024-08-23 ### Removed @@ -24,7 +32,7 @@ This was unneccessary, already wasn't done in some code paths, and as a bonus le This behavior matches what happens when a token is automatically refreshed during the applications runtime, and should help address issues that might come up in the future. -- The cache key now contains a cache version, allowing it's schema to be updated in the future +- The cache key now contains a cache version, allowing its schema to be updated in the future From now on cache keys will use the following format: diff --git a/Cargo.toml b/Cargo.toml index 8d4c431..4299f69 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.16.6" +version = "0.16.7" # See https://github.com/rust-lang/rust/issues/107557 rust-version = "1.72" @@ -16,12 +16,13 @@ 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_23" ] +tracing_opentelemetry = [ "tracing_opentelemetry_0_24" ] 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"] tracing_opentelemetry_0_22 = ["_any_otel_version", "tracing", "tracing-opentelemetry_0_23_pkg", "opentelemetry_0_22_pkg", "opentelemetry_sdk_0_22_pkg"] 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"] _any_otel_version = [] @@ -51,13 +52,16 @@ opentelemetry_0_20_pkg = { package = "opentelemetry", version = "0.20", optional opentelemetry_0_21_pkg = { package = "opentelemetry", version = "0.21", optional = true } opentelemetry_0_22_pkg = { package = "opentelemetry", version = "0.22", optional = true } opentelemetry_0_23_pkg = { package = "opentelemetry", version = "0.23", optional = true } +opentelemetry_0_24_pkg = { package = "opentelemetry", version = "0.24", 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 } 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 } [dev-dependencies] flate2 = "1.0" diff --git a/Makefile.toml b/Makefile.toml index 8e3c51d..47112bd 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -24,7 +24,8 @@ dependencies = [ "test-otel-0_20", "test-otel-0_21", "test-otel-0_22", - "test-otel-0_23" + "test-otel-0_23", + "test-otel-0_24" ] [tasks.test-base] @@ -32,6 +33,11 @@ command = "cargo" args = ["test", "--features", "gzip", "${@}"] dependencies = ["build"] +[tasks.test-auth0] +command = "cargo" +args = ["test", "--features=auth0,gzip", "${@}"] +dependencies = ["build"] + [tasks.test-otel-0_20] command = "cargo" args = ["test", "--no-default-features", "--features", "tracing_opentelemetry_0_20"] @@ -48,14 +54,50 @@ args = ["test", "--no-default-features", "--features", "tracing_opentelemetry_0_ command = "cargo" args = ["test", "--no-default-features", "--features", "tracing_opentelemetry_0_23"] -[tasks.test-auth0] +[tasks.test-otel-0_24] command = "cargo" -args = ["test", "--features=auth0,gzip", "${@}"] -dependencies = ["build"] +args = ["test", "--no-default-features", "--features", "tracing_opentelemetry_0_24"] [tasks.clippy] +dependencies = [ + "clippy-base", + "clippy-auth0", + "clippy-otel-0_20", + "clippy-otel-0_21", + "clippy-otel-0_22", + "clippy-otel-0_23", + "clippy-otel-0_24" +] + +[tasks.clippy-base] +command = "cargo" +args = ["clippy", "--features", "gzip", "--all-targets", "--", "-D", "warnings"] +dependencies = ["build"] + +[tasks.clippy-auth0] +command = "cargo" +args = ["clippy", "--features=auth0,gzip", "--all-targets", "--", "-D", "warnings"] +dependencies = ["build"] + +[tasks.clippy-otel-0_20] +command = "cargo" +args = ["clippy", "--no-default-features", "--features", "tracing_opentelemetry_0_20", "--all-targets", "--", "-D", "warnings"] + +[tasks.clippy-otel-0_21] +command = "cargo" +args = ["clippy", "--no-default-features", "--features", "tracing_opentelemetry_0_21", "--all-targets", "--", "-D", "warnings"] + +[tasks.clippy-otel-0_22] +command = "cargo" +args = ["clippy", "--no-default-features", "--features", "tracing_opentelemetry_0_22", "--all-targets", "--", "-D", "warnings"] + +[tasks.clippy-otel-0_23] +command = "cargo" +args = ["clippy", "--no-default-features", "--features", "tracing_opentelemetry_0_23", "--all-targets", "--", "-D", "warnings"] + +[tasks.clippy-otel-0_24] command = "cargo" -args = ["clippy", "--all-features", "--all-targets", "--", "-D", "warnings"] +args = ["clippy", "--no-default-features", "--features", "tracing_opentelemetry_0_24", "--all-targets", "--", "-D", "warnings"] [tasks.deny-check] dependencies = [ @@ -88,7 +130,7 @@ description = "Run cargo-deny with tracing_opentelemetry_0_23 feature" [tasks.docs] description = "Build docs as they are rendered on docs.rs" command = "cargo" -args = ["doc", "--document-private-items", "--all-features", "--no-deps"] +args = ["doc", "--document-private-items", "--features=auth0,gzip", "--no-deps"] env = { "RUSTDOCFLAGS" = "-Dwarnings" } [tasks.release] diff --git a/src/request/otel.rs b/src/request/otel.rs index d6ff2cb..4447e80 100644 --- a/src/request/otel.rs +++ b/src/request/otel.rs @@ -1,6 +1,3 @@ -#[cfg(not(feature = "tracing_opentelemetry_0_23"))] -#[cfg(not(feature = "tracing_opentelemetry_0_22"))] -#[cfg(not(feature = "tracing_opentelemetry_0_21"))] #[cfg(feature = "tracing_opentelemetry_0_20")] mod otel_0_20 { pub use opentelemetry_0_20_pkg::{ @@ -14,8 +11,6 @@ mod otel_0_20 { } } -#[cfg(not(feature = "tracing_opentelemetry_0_23"))] -#[cfg(not(feature = "tracing_opentelemetry_0_22"))] #[cfg(feature = "tracing_opentelemetry_0_21")] mod otel_0_21 { pub use opentelemetry_0_21_pkg::propagation::{Injector, TextMapPropagator}; @@ -27,7 +22,6 @@ mod otel_0_21 { } } -#[cfg(not(feature = "tracing_opentelemetry_0_23"))] #[cfg(feature = "tracing_opentelemetry_0_22")] mod otel_0_22 { pub use opentelemetry_0_22_pkg::propagation::{Injector, TextMapPropagator}; @@ -50,20 +44,28 @@ mod otel_0_23 { } } -#[cfg(not(feature = "tracing_opentelemetry_0_23"))] -#[cfg(not(feature = "tracing_opentelemetry_0_22"))] -#[cfg(not(feature = "tracing_opentelemetry_0_21"))] +#[cfg(feature = "tracing_opentelemetry_0_24")] +mod otel_0_24 { + pub use opentelemetry_0_24_pkg::propagation::{Injector, TextMapPropagator}; + pub use opentelemetry_sdk_0_24_pkg::propagation::TraceContextPropagator; + pub use tracing_opentelemetry_0_25_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; -#[cfg(not(feature = "tracing_opentelemetry_0_23"))] -#[cfg(not(feature = "tracing_opentelemetry_0_22"))] #[cfg(feature = "tracing_opentelemetry_0_21")] pub use otel_0_21::inject_context; -#[cfg(not(feature = "tracing_opentelemetry_0_23"))] #[cfg(feature = "tracing_opentelemetry_0_22")] pub use otel_0_22::inject_context; #[cfg(feature = "tracing_opentelemetry_0_23")] pub use otel_0_23::inject_context; + +#[cfg(feature = "tracing_opentelemetry_0_24")] +pub use otel_0_24::inject_context;