Skip to content

Commit

Permalink
feat: bump to otel 0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
fusillicode committed Dec 2, 2024
1 parent 7258ac1 commit 784b8f7
Show file tree
Hide file tree
Showing 4 changed files with 72 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.20.0] - 2024-12-02

### Added

- Support for opentelemetry 0.27, now the default version.

---

## [0.19.0] - 2024-11-25

### Added
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 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.19.0"
version = "0.20.0"
# See https://github.com/rust-lang/rust/issues/107557
rust-version = "1.72"

Expand All @@ -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",
Expand Down Expand Up @@ -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 = []

Expand Down Expand Up @@ -103,19 +110,22 @@ 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 }
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 }
tracing-opentelemetry_0_28_pkg = { package = "tracing-opentelemetry", version = "0.28", optional = true }

[dev-dependencies]
flate2 = "1.0"
Expand Down
36 changes: 36 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies = [
"test-otel-0_24",
"test-otel-0_25",
"test-otel-0_26",
"test-otel-0_27",
]

[tasks.test-base]
Expand Down Expand Up @@ -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",
Expand All @@ -103,6 +113,7 @@ dependencies = [
"clippy-otel-0_24",
"clippy-otel-0_25",
"clippy-otel-0_26",
"clippy-otel-0_27",
]

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

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

0 comments on commit 784b8f7

Please sign in to comment.