Skip to content

Commit f0669d2

Browse files
Adapt CI for tracing-actix-web
1 parent b3a2697 commit f0669d2

File tree

12 files changed

+60
-42
lines changed

12 files changed

+60
-42
lines changed

.github/workflows/lint.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ jobs:
4444
reporter: github-pr-check
4545
github_token: ${{ secrets.GITHUB_TOKEN }}
4646
clippy_flags: >-
47-
--workspace --all-features --tests --examples --bins --
47+
--workspace --all-features --exclude tracing-actix-web --tests --examples --bins --
48+
-A unknown_lints -D clippy::todo -D clippy::dbg_macro
49+
50+
- name: Check OTEL with Clippy
51+
uses: giraffate/[email protected]
52+
with:
53+
reporter: github-pr-check
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
clippy_flags: >-
56+
--package tracing-actix-web --tests --examples --
4857
-A unknown_lints -D clippy::todo -D clippy::dbg_macro
4958
5059
public-api-diff:
@@ -70,8 +79,8 @@ jobs:
7079

7180
- name: generate API diff
7281
run: |
73-
for f in $(find -mindepth 2 -maxdepth 2 -name Cargo.toml); do
74-
82+
for f in $(find -mindepth 2 -maxdepth 2 -not \( -path "./tracing-actix-web/Cargo.toml" -prune \) -name Cargo.toml); do
7583
cargo public-api --manifest-path "$f" --all-features diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }} >> /tmp/diff.txt
7684
done
85+
cargo public-api --manifest-path "tracing-actix-web/Cargo.toml" diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }} >> /tmp/diff.txt
7786
cat /tmp/diff.txt

justfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ test-coverage-lcov: test-coverage
6666
[group("test")]
6767
[group("docs")]
6868
test-docs:
69-
cargo {{ toolchain }} test --doc --workspace --all-features --no-fail-fast -- --nocapture
69+
cargo {{ toolchain }} test --doc --workspace --all-features --no-fail-fast --exclude tracing-actix-web -- --nocapture
7070

7171
# Document crates in workspace.
7272
[group("docs")]
7373
doc *args: && doc-set-workspace-crates
74-
RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --workspace --all-features {{ args }}
74+
RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --workspace --all-features --exclude tracing-actix-web {{ args }}
7575

7676
[group("docs")]
7777
[private]

tracing-actix-web/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ repository.workspace = true
66
homepage.workspace = true
77
license.workspace = true
88
edition.workspace = true
9-
rust-version.workspace = true
109
documentation = "https://docs.rs/tracing-actix-web/"
1110
readme = "README.md"
1211
description = "Structured logging middleware for actix-web."

tracing-actix-web/examples/custom-root-span/src/main.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
use actix_web::body::MessageBody;
2-
use actix_web::dev::{ServiceRequest, ServiceResponse};
3-
use actix_web::{web, App, Error, HttpServer};
4-
use opentelemetry::trace::TracerProvider;
5-
use opentelemetry::{global, KeyValue};
1+
use std::{io, sync::LazyLock};
2+
3+
use actix_web::{
4+
body::MessageBody,
5+
dev::{ServiceRequest, ServiceResponse},
6+
web, App, Error, HttpServer,
7+
};
8+
use opentelemetry::{global, trace::TracerProvider, KeyValue};
69
use opentelemetry_otlp::WithExportConfig;
710
use opentelemetry_sdk::{
811
propagation::TraceContextPropagator, runtime::TokioCurrentThread, trace::Config, Resource,
912
};
1013
use opentelemetry_semantic_conventions::resource;
11-
use std::io;
12-
use std::sync::LazyLock;
1314
use tracing::Span;
1415
use tracing_actix_web::{DefaultRootSpanBuilder, RootSpan, RootSpanBuilder, TracingLogger};
1516
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};

tracing-actix-web/examples/opentelemetry/src/main.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
use std::{io, sync::LazyLock};
2+
13
use actix_web::{web, App, HttpServer};
2-
use opentelemetry::trace::TracerProvider;
3-
use opentelemetry::{global, KeyValue};
4+
use opentelemetry::{global, trace::TracerProvider, KeyValue};
45
use opentelemetry_otlp::WithExportConfig;
56
use opentelemetry_sdk::{
67
propagation::TraceContextPropagator, runtime::TokioCurrentThread, trace::Config, Resource,
78
};
89
use opentelemetry_semantic_conventions::resource;
9-
use std::io;
10-
use std::sync::LazyLock;
1110
use tracing_actix_web::TracingLogger;
1211
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
1312
use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry};

tracing-actix-web/examples/request-id-response-header/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use std::io;
2+
13
use actix_web::{
24
dev::Service,
35
http::header::{HeaderName, HeaderValue},
46
web, App, HttpMessage, HttpServer,
57
};
6-
use std::io;
78
use tracing_actix_web::{RequestId, TracingLogger};
89

910
async fn hello() -> &'static str {

tracing-actix-web/src/middleware.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
use crate::{DefaultRootSpanBuilder, RequestId, RootSpan, RootSpanBuilder};
2-
use actix_web::body::{BodySize, MessageBody};
3-
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
4-
use actix_web::web::Bytes;
5-
use actix_web::{Error, HttpMessage};
6-
use std::future::{ready, Future, Ready};
7-
use std::pin::Pin;
8-
use std::task::{Context, Poll};
1+
use std::{
2+
future::{ready, Future, Ready},
3+
pin::Pin,
4+
task::{Context, Poll},
5+
};
6+
7+
use actix_web::{
8+
body::{BodySize, MessageBody},
9+
dev::{Service, ServiceRequest, ServiceResponse, Transform},
10+
web::Bytes,
11+
Error, HttpMessage,
12+
};
913
use tracing::Span;
1014

15+
use crate::{DefaultRootSpanBuilder, RequestId, RootSpan, RootSpanBuilder};
16+
1117
/// `TracingLogger` is a middleware to capture structured diagnostic when processing an HTTP request.
1218
/// Check the crate-level documentation for an in-depth introduction.
1319
///

tracing-actix-web/src/otel.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use actix_web::dev::ServiceRequest;
2-
2+
use opentelemetry::propagation::Extractor;
33
#[cfg(feature = "opentelemetry_0_13")]
44
use opentelemetry_0_13_pkg as opentelemetry;
55
#[cfg(feature = "opentelemetry_0_14")]
@@ -26,7 +26,6 @@ use opentelemetry_0_23_pkg as opentelemetry;
2626
use opentelemetry_0_24_pkg as opentelemetry;
2727
#[cfg(feature = "opentelemetry_0_25")]
2828
use opentelemetry_0_25_pkg as opentelemetry;
29-
3029
#[cfg(feature = "opentelemetry_0_13")]
3130
use tracing_opentelemetry_0_12_pkg as tracing_opentelemetry;
3231
#[cfg(feature = "opentelemetry_0_14")]
@@ -54,8 +53,6 @@ use tracing_opentelemetry_0_25_pkg as tracing_opentelemetry;
5453
#[cfg(feature = "opentelemetry_0_25")]
5554
use tracing_opentelemetry_0_26_pkg as tracing_opentelemetry;
5655

57-
use opentelemetry::propagation::Extractor;
58-
5956
pub(crate) struct RequestHeaderCarrier<'a> {
6057
headers: &'a actix_web::http::header::HeaderMap,
6158
}

tracing-actix-web/src/request_id.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use actix_web::{dev::Payload, HttpMessage};
2-
use actix_web::{FromRequest, HttpRequest, ResponseError};
31
use std::future::{ready, Ready};
2+
3+
use actix_web::{dev::Payload, FromRequest, HttpMessage, HttpRequest, ResponseError};
44
use uuid::Uuid;
55

66
/// A unique identifier generated for each incoming request.

tracing-actix-web/src/root_span.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use actix_web::{dev::Payload, HttpMessage};
2-
use actix_web::{FromRequest, HttpRequest, ResponseError};
31
use std::future::{ready, Ready};
2+
3+
use actix_web::{dev::Payload, FromRequest, HttpMessage, HttpRequest, ResponseError};
44
use tracing::Span;
55

66
#[derive(Clone)]

tracing-actix-web/src/root_span_builder.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
use crate::root_span;
2-
use actix_web::body::MessageBody;
3-
use actix_web::dev::{ServiceRequest, ServiceResponse};
4-
use actix_web::http::StatusCode;
5-
use actix_web::{Error, ResponseError};
1+
use actix_web::{
2+
body::MessageBody,
3+
dev::{ServiceRequest, ServiceResponse},
4+
http::StatusCode,
5+
Error, ResponseError,
6+
};
67
use tracing::Span;
78

9+
use crate::root_span;
10+
811
/// `RootSpanBuilder` allows you to customise the root span attached by
912
/// [`TracingLogger`] to incoming requests.
1013
///

tracing-actix-web/src/root_span_macro.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,16 @@ pub mod private {
142142
//! in the code generated by the `root_span` macro.
143143
//! Items in this module are not part of the public interface of `tracing-actix-web` - they are considered
144144
//! implementation details and will change without notice in patch, minor and major releases.
145-
use crate::RequestId;
146-
use actix_web::dev::ServiceRequest;
147-
use actix_web::http::{Method, Version};
148145
use std::borrow::Cow;
149146

147+
use actix_web::{
148+
dev::ServiceRequest,
149+
http::{Method, Version},
150+
};
150151
pub use tracing;
151152

153+
use crate::RequestId;
154+
152155
#[doc(hidden)]
153156
// We need to allow unused variables because the function
154157
// body is empty if the user of the library chose not to activate

0 commit comments

Comments
 (0)