mirror of
https://github.com/TrueLayer/reqwest-middleware.git
synced 2024-12-26 19:06:31 +00:00
Add support for OpenTelemetry 0.16 and tracing-opentelemetry 0.15 (#2)
* add opentelemetry 0.16 * ci: run against otel 0.16 * ci: run jobs against each otel version * docs: mention opentelemetry_0_16 in README
This commit is contained in:
parent
7fe55152ec
commit
753b2439fa
6 changed files with 39 additions and 7 deletions
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
|
@ -9,6 +9,13 @@ jobs:
|
||||||
test:
|
test:
|
||||||
name: Test Suite
|
name: Test Suite
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
otel_version:
|
||||||
|
- opentelemetry_0_13
|
||||||
|
- opentelemetry_0_14
|
||||||
|
- opentelemetry_0_15
|
||||||
|
- opentelemetry_0_16
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -21,7 +28,7 @@ jobs:
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: --workspace --all-targets --features opentelemetry_0_15
|
args: --workspace --all-targets --features ${{ matrix.otel_version }}
|
||||||
|
|
||||||
rustfmt:
|
rustfmt:
|
||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
|
@ -45,6 +52,13 @@ jobs:
|
||||||
clippy:
|
clippy:
|
||||||
name: Clippy
|
name: Clippy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
otel_version:
|
||||||
|
- opentelemetry_0_13
|
||||||
|
- opentelemetry_0_14
|
||||||
|
- opentelemetry_0_15
|
||||||
|
- opentelemetry_0_16
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -59,11 +73,18 @@ jobs:
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: clippy
|
command: clippy
|
||||||
args: --all-targets --features opentelemetry_0_15 --workspace -- -D warnings
|
args: --all-targets --features ${{ matrix.otel_version }} --workspace -- -D warnings
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
name: Docs
|
name: Docs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
otel_version:
|
||||||
|
- opentelemetry_0_13
|
||||||
|
- opentelemetry_0_14
|
||||||
|
- opentelemetry_0_15
|
||||||
|
- opentelemetry_0_16
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -79,7 +100,7 @@ jobs:
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: doc
|
command: doc
|
||||||
args: --no-deps --document-private-items --features opentelemetry_0_15 --workspace
|
args: --no-deps --document-private-items --features ${{ matrix.otel_version }} --workspace
|
||||||
|
|
||||||
publish-check:
|
publish-check:
|
||||||
name: Publish dry run
|
name: Publish dry run
|
||||||
|
|
|
@ -13,6 +13,7 @@ categories = ["web-programming::http-client"]
|
||||||
opentelemetry_0_13 = ["opentelemetry_0_13_pkg", "tracing-opentelemetry_0_12_pkg"]
|
opentelemetry_0_13 = ["opentelemetry_0_13_pkg", "tracing-opentelemetry_0_12_pkg"]
|
||||||
opentelemetry_0_14 = ["opentelemetry_0_14_pkg", "tracing-opentelemetry_0_13_pkg"]
|
opentelemetry_0_14 = ["opentelemetry_0_14_pkg", "tracing-opentelemetry_0_13_pkg"]
|
||||||
opentelemetry_0_15 = ["opentelemetry_0_15_pkg", "tracing-opentelemetry_0_14_pkg"]
|
opentelemetry_0_15 = ["opentelemetry_0_15_pkg", "tracing-opentelemetry_0_14_pkg"]
|
||||||
|
opentelemetry_0_16 = ["opentelemetry_0_16_pkg", "tracing-opentelemetry_0_15_pkg"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
reqwest-middleware = { version = "0.1", path = "../reqwest-middleware" }
|
reqwest-middleware = { version = "0.1", path = "../reqwest-middleware" }
|
||||||
|
@ -26,9 +27,11 @@ truelayer-extensions = "0.1"
|
||||||
opentelemetry_0_13_pkg = { package = "opentelemetry", version = "0.13", optional = true }
|
opentelemetry_0_13_pkg = { package = "opentelemetry", version = "0.13", optional = true }
|
||||||
opentelemetry_0_14_pkg = { package = "opentelemetry", version = "0.14", optional = true }
|
opentelemetry_0_14_pkg = { package = "opentelemetry", version = "0.14", optional = true }
|
||||||
opentelemetry_0_15_pkg = { package = "opentelemetry", version = "0.15", optional = true }
|
opentelemetry_0_15_pkg = { package = "opentelemetry", version = "0.15", optional = true }
|
||||||
|
opentelemetry_0_16_pkg = { package = "opentelemetry", version = "0.16", optional = true }
|
||||||
tracing-opentelemetry_0_12_pkg = { package = "tracing-opentelemetry",version = "0.12", optional = true }
|
tracing-opentelemetry_0_12_pkg = { package = "tracing-opentelemetry",version = "0.12", optional = true }
|
||||||
tracing-opentelemetry_0_13_pkg = { package = "tracing-opentelemetry", version = "0.13", optional = true }
|
tracing-opentelemetry_0_13_pkg = { package = "tracing-opentelemetry", version = "0.13", optional = true }
|
||||||
tracing-opentelemetry_0_14_pkg = { package = "tracing-opentelemetry",version = "0.14", optional = true }
|
tracing-opentelemetry_0_14_pkg = { package = "tracing-opentelemetry",version = "0.14", optional = true }
|
||||||
|
tracing-opentelemetry_0_15_pkg = { package = "tracing-opentelemetry",version = "0.15", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wiremock = "0.5"
|
wiremock = "0.5"
|
||||||
|
|
|
@ -49,10 +49,10 @@ an opentelemetry version feature:
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# ...
|
# ...
|
||||||
reqwest-tracing = { version = "0.1.0", features = ["opentelemetry_0_15"] }
|
reqwest-tracing = { version = "0.1.0", features = ["opentelemetry_0_16"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
Available opentelemetry features are `opentelemetry_0_15`, `opentelemetry_0_14` and
|
Available opentelemetry features are `opentelemetry_0_16`, `opentelemetry_0_15`, `opentelemetry_0_14` and
|
||||||
`opentelemetry_0_13`.
|
`opentelemetry_0_13`.
|
||||||
|
|
||||||
#### License
|
#### License
|
||||||
|
|
|
@ -2,7 +2,8 @@ mod middleware;
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "opentelemetry_0_13",
|
feature = "opentelemetry_0_13",
|
||||||
feature = "opentelemetry_0_14",
|
feature = "opentelemetry_0_14",
|
||||||
feature = "opentelemetry_0_15"
|
feature = "opentelemetry_0_15",
|
||||||
|
feature = "opentelemetry_0_16",
|
||||||
))]
|
))]
|
||||||
mod otel;
|
mod otel;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ impl Middleware for TracingMiddleware {
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "opentelemetry_0_13",
|
feature = "opentelemetry_0_13",
|
||||||
feature = "opentelemetry_0_14",
|
feature = "opentelemetry_0_14",
|
||||||
feature = "opentelemetry_0_15"
|
feature = "opentelemetry_0_15",
|
||||||
|
feature = "opentelemetry_0_16",
|
||||||
))]
|
))]
|
||||||
let req = crate::otel::inject_opentracing_context_into_request(&request_span, req);
|
let req = crate::otel::inject_opentracing_context_into_request(&request_span, req);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ use opentelemetry_0_14_pkg as opentelemetry;
|
||||||
#[cfg(feature = "opentelemetry_0_15")]
|
#[cfg(feature = "opentelemetry_0_15")]
|
||||||
use opentelemetry_0_15_pkg as opentelemetry;
|
use opentelemetry_0_15_pkg as opentelemetry;
|
||||||
|
|
||||||
|
#[cfg(feature = "opentelemetry_0_16")]
|
||||||
|
use opentelemetry_0_16_pkg as opentelemetry;
|
||||||
|
|
||||||
#[cfg(feature = "opentelemetry_0_13")]
|
#[cfg(feature = "opentelemetry_0_13")]
|
||||||
pub use tracing_opentelemetry_0_12_pkg as tracing_opentelemetry;
|
pub use tracing_opentelemetry_0_12_pkg as tracing_opentelemetry;
|
||||||
|
|
||||||
|
@ -21,6 +24,9 @@ pub use tracing_opentelemetry_0_13_pkg as tracing_opentelemetry;
|
||||||
#[cfg(feature = "opentelemetry_0_15")]
|
#[cfg(feature = "opentelemetry_0_15")]
|
||||||
pub use tracing_opentelemetry_0_14_pkg as tracing_opentelemetry;
|
pub use tracing_opentelemetry_0_14_pkg as tracing_opentelemetry;
|
||||||
|
|
||||||
|
#[cfg(feature = "opentelemetry_0_16")]
|
||||||
|
pub use tracing_opentelemetry_0_15_pkg as tracing_opentelemetry;
|
||||||
|
|
||||||
use opentelemetry::global;
|
use opentelemetry::global;
|
||||||
use opentelemetry::propagation::Injector;
|
use opentelemetry::propagation::Injector;
|
||||||
use tracing_opentelemetry::OpenTelemetrySpanExt;
|
use tracing_opentelemetry::OpenTelemetrySpanExt;
|
||||||
|
|
Loading…
Reference in a new issue