Skip to content

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

Open
@leo-skadden-volt

Description

@leo-skadden-volt

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions