Skip to content

Commit

Permalink
feat: support otel 0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
fusillicode committed Oct 22, 2024
1 parent 28a0379 commit e6355fd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -16,14 +16,15 @@ 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"]
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"]
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 = []

Expand Down Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions src/request/otel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

0 comments on commit e6355fd

Please sign in to comment.