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

Document differences to tower_http trace #158

Open
lcmgh opened this issue Sep 5, 2024 · 1 comment
Open

Document differences to tower_http trace #158

lcmgh opened this issue Sep 5, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@lcmgh
Copy link

lcmgh commented Sep 5, 2024

There is also https://docs.rs/tower-http/0.5.2/tower_http/trace/index.html

I wonder how this crate is different?

Edit: What I understand is that tower_http::trace exists to get request/response traces and this crate exists to get the span connection to parent otel trace ids from incoming requests and not to log request/Response data?

See tower-rs/tower-http#508

@lcmgh
Copy link
Author

lcmgh commented Sep 5, 2024

If this layer is also supposed to generate tracing messages I wonder how one could get same tracing msg behavior as with this code based on tower_http::trace:

let trace_layer = TraceLayer::new(SharedClassifier::new(GrpcErrorsAsFailures::new()))
  .make_span_with(|request: &http::Request<_>| {
      tracing::info_span!(
          "request",
          otel.name = format!("{} {}", request.method(), request.uri().path()),
          method = %request.method(),
          uri = %request.uri(),
          version = ?request.version(),
      )
  })
  .on_request(DefaultOnRequest::default().level(Level::INFO))
  .on_response(DefaultOnResponse::default().level(Level::INFO))
  .on_eos(DefaultOnEos::default().level(Level::INFO))
  .on_failure(DefaultOnFailure::default().level(Level::ERROR));

@davidB davidB added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants