reqwest-middleware icon indicating copy to clipboard operation
reqwest-middleware copied to clipboard

`reqwest-tracing` has `opentelemetry` logic even when no opentelemetry is not used

Open tosti007 opened this issue 2 months ago • 0 comments

First of all, thank you for making this crate!

Bug description

When using reqwest-tracing without any of the opentelemetry features enabled, the crate still contains quite a bit of code related to and crates needed for opentelemetry. Example of crates are matchit, which does routing.

To Reproduce

The easiest example I can find:

  1. Create a new crate
  2. Add reqwest-tracing as dependency without any enabled features.
  3. Check Cargo.lock and notice it contains matchit (for routing logic).

Expected behavior

I would expect the crate to be slimmer and contain only the required dependencies needed to get tracing working.

Environment

reqwest-tracing: 0.5.4 rustc: 1.83.0

Additional context

After inspecting the code I understand that "simply not adding it" isn't as easy as it sounds and that this might not be solved in the near future. Hence might I mention, as food for thought, that splitting the opentelemetry logic of reqwest-tracing into a separate reqwest-opentelemetry crate might be a method to make this simpler?

On the other hand I can also imagine that I am not fully understanding the codebase (as I've just looked through it after noticing the matchit dep), so I might be fully wrong here. Please let me know so and feel free to close this if that's the case!

tosti007 avatar Dec 05 '24 12:12 tosti007