Skip to content

[Bug]: NoHttpClient error when reqwest-client feature is enabled #2994

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

Open
leo-skadden-volt opened this issue May 22, 2025 · 2 comments · May be fixed by #3003
Open

[Bug]: NoHttpClient error when reqwest-client feature is enabled #2994

leo-skadden-volt opened this issue May 22, 2025 · 2 comments · May be fixed by #3003
Assignees
Labels
bug Something isn't working M-exporter-otlp triage:todo Needs to be traiged.

Comments

@leo-skadden-volt
Copy link

What happened?

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;

fn main() {
    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: NoHttpClient
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@leo-skadden-volt leo-skadden-volt added bug Something isn't working triage:todo Needs to be traiged. labels May 22, 2025
@gruebel gruebel linked a pull request May 23, 2025 that will close this issue
4 tasks
@gruebel
Copy link
Member

gruebel commented May 23, 2025

@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.

@gruebel gruebel self-assigned this May 23, 2025
@leo-skadden-volt
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working M-exporter-otlp triage:todo Needs to be traiged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants