Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump otel group 0.24 #168

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

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.16.6"
version = "0.16.7"
# See https://github.com/rust-lang/rust/issues/107557
rust-version = "1.72"

Expand All @@ -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 = []

Expand Down Expand Up @@ -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"
Expand Down
54 changes: 48 additions & 6 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ 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]
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"]
Expand All @@ -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 = [
Expand Down Expand Up @@ -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]
Expand Down
26 changes: 14 additions & 12 deletions src/request/otel.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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};
Expand All @@ -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};
Expand All @@ -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;