You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the reqwest-client feature is enabled it produces an ExporterBuildError::NoHttpClient when a SpanExporter (potentially other exporters as well, I've only tested the span version) is built.
I've found that the reqwest-client feature conflicts with the default reqwest-blocking-client in opentelemetry-otlp/src/exporter/http/mod.rs as none of the cfg blocks end up being included. The block you would expect to be included because of the reqwest-client feature is excluded due to the not(feature = "reqwest-blocking-client") and vice versa for the reqwest-blocking-client block.
Reproduction
Cargo.toml:
[package]
name = "repro-no-http-client"version = "0.1.0"edition = "2024"
[dependencies]
opentelemetry = "0.29.1"opentelemetry-otlp = { version = "0.29.0", features = ["reqwest-client"] }
main.rs:
use opentelemetry_otlp::SpanExporter;fnmain(){let exporter = SpanExporter::builder().with_http().build().unwrap();println!("Exporter: {:#?}", exporter);}
OpenTelemetry API Version (i.e version of opentelemetry crate)
0.29.1
OpenTelemetry SDK Version (i.e version of opentelemetry_sdk crate)
0.29.0
What Exporter(s) are you seeing the problem on?
OTLP
Relevant log output
thread 'main' panicked at src/main.rs:4:64:
called `Result::unwrap()` on an `Err` value: NoHttpClientnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The text was updated successfully, but these errors were encountered:
@leo-skadden-volt I created kind of fix, but it just points you to the actual issue. Since you didn't disable the default features, you are actually enabling two HTTP clients reqwest-blocking-client (this is the default one) and reqwest-client.
So, you need to disable the default features and then you can choose the reqwest-client feature.
Thanks @gruebel, this does work around the problem but I wouldn't expect to find this as a default workflow for a crate. Having to disable all default features and manually re-enable non-conflicting features just to enable a different HTTP client is a bit clunky.
I think @paullegranddc's suggestion in the PR aligns well with how I expected enabling the reqwest-client feature to work.
What happened?
When the
reqwest-client
feature is enabled it produces anExporterBuildError::NoHttpClient
when aSpanExporter
(potentially other exporters as well, I've only tested the span version) is built.I've found that the
reqwest-client
feature conflicts with the defaultreqwest-blocking-client
inopentelemetry-otlp/src/exporter/http/mod.rs
as none of thecfg
blocks end up being included. The block you would expect to be included because of thereqwest-client
feature is excluded due to thenot(feature = "reqwest-blocking-client")
and vice versa for thereqwest-blocking-client
block.Reproduction
Cargo.toml:
main.rs:
OpenTelemetry API Version (i.e version of
opentelemetry
crate)0.29.1
OpenTelemetry SDK Version (i.e version of
opentelemetry_sdk
crate)0.29.0
What Exporter(s) are you seeing the problem on?
OTLP
Relevant log output
The text was updated successfully, but these errors were encountered: