From 2854bf327adafb936177526c2d4c50c5b9b661ee Mon Sep 17 00:00:00 2001 From: Chris McClellan Date: Fri, 17 Apr 2026 06:41:26 -0400 Subject: [PATCH 1/3] fix: restore OTLP HTTP telemetry broken by opentelemetry-otlp 0.31 feature conflict ## Problem After upgrading opentelemetry-otlp from 0.27 to 0.31 (PR #251), any user with SCOPE_OTEL_PROTOCOL=http would see: opentelemetry configuration failed. Events will not be sent. no http client specified Traces and metrics stopped arriving in the collector entirely. The binary continued running normally, so the failure was silent to users. ## Root cause opentelemetry-otlp 0.31 changed how the default HTTP client is selected (https://github.com/open-telemetry/opentelemetry-rust/blob/opentelemetry-otlp-0.31.1/opentelemetry-otlp/src/exporter/http/mod.rs#L151-L195). A client is only auto-installed when *exactly one* of hyper-client, reqwest-client, or reqwest-blocking-client is enabled. The async-reqwest auto-default has this cfg gate: all( not(feature = "hyper-client"), not(feature = "reqwest-blocking-client"), feature = "reqwest-client" ) Our Cargo.toml explicitly enabled reqwest-client, but did not set default-features = false. The crate's own default feature set includes reqwest-blocking-client (opentelemetry-otlp Cargo.toml line 69: https://github.com/open-telemetry/opentelemetry-rust/blob/opentelemetry-otlp-0.31.1/opentelemetry-otlp/Cargo.toml). With both reqwest-client AND reqwest-blocking-client active, the cfg never matched, http_config.client remained None, and .build() returned ExporterBuildError::NoHttpClient at: https://github.com/open-telemetry/opentelemetry-rust/blob/opentelemetry-otlp-0.31.1/opentelemetry-otlp/src/exporter/http/mod.rs#L195 This was not a problem on 0.27 because HttpConfig::default() always provided a blocking client unconditionally, regardless of feature flags. ## Fix Set default-features = false on opentelemetry-otlp so reqwest-blocking-client is no longer pulled in from crate defaults. Switch the explicit HTTP client feature from reqwest-client (async) to reqwest-blocking-client (blocking). The blocking client is the correct choice here: the OTLP BatchProcessor runs in a plain std::thread, not a tokio task. Using the async reqwest-client caused a secondary panic ("there is no reactor running") when the batch processor thread tried to flush on shutdown. Also re-add trace and internal-logs to the explicit feature list, since these were previously supplied by the now-disabled defaults. ## Verification - Confirmed error reproduces on main: `cargo run -- doctor list` with SCOPE_OTEL_PROTOCOL=http printed the NoHttpClient message. - After fix: no error, and traces appear in Jaeger (OTLP HTTP via local gdev Jaeger service on port 14318). - Two regression tests added to src/shared/logging.rs that call SpanExporter::builder().with_http()...build() and MetricExporter::builder().with_http()...build() and assert Ok. Both tests fail on the pre-fix code and pass after. Co-Authored-By: Claude Sonnet 4.6 --- Cargo.toml | 2 +- src/shared/logging.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index df17634..6df02be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ normpath = "1.5.0" octocrab = "*" opentelemetry = { version = "*", features = ["metrics"] } opentelemetry_sdk = { version = "*", features = ["metrics", "rt-tokio", "experimental_metrics_periodicreader_with_async_runtime"] } -opentelemetry-otlp = { version = "*", features = ["metrics", "reqwest", "http-proto", "reqwest-client", "reqwest-rustls", "grpc-tonic"] } +opentelemetry-otlp = { version = "*", default-features = false, features = ["trace", "metrics", "internal-logs", "http-proto", "reqwest-blocking-client", "reqwest-rustls", "grpc-tonic"] } path-clean = "1.0.1" pathdiff = "0.2.3" petgraph = "0.8.3" diff --git a/src/shared/logging.rs b/src/shared/logging.rs index 362ac09..d5b680d 100644 --- a/src/shared/logging.rs +++ b/src/shared/logging.rs @@ -416,3 +416,29 @@ impl LoggingOpts { } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn http_span_exporter_builds_with_default_client() { + let url = Url::parse("http://127.0.0.1:4318/v1/traces").unwrap(); + let result = SpanExporter::builder() + .with_http() + .with_endpoint(url) + .with_timeout(Duration::from_secs(3)) + .build(); + assert!(result.is_ok(), "HTTP span exporter must build; got {:?}", result.err()); + } + + #[test] + fn http_metric_exporter_builds_with_default_client() { + let result = MetricExporter::builder() + .with_http() + .with_endpoint("http://127.0.0.1:4318") + .with_timeout(Duration::from_secs(3)) + .build(); + assert!(result.is_ok(), "HTTP metric exporter must build; got {:?}", result.err()); + } +} From 87582f6c0760f52cc4e91b1653d0e009135fb798 Mon Sep 17 00:00:00 2001 From: Chris McClellan Date: Fri, 17 Apr 2026 07:09:56 -0400 Subject: [PATCH 2/3] style: apply cargo fmt to logging tests --- src/shared/logging.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/shared/logging.rs b/src/shared/logging.rs index d5b680d..5bb9f2c 100644 --- a/src/shared/logging.rs +++ b/src/shared/logging.rs @@ -429,7 +429,11 @@ mod tests { .with_endpoint(url) .with_timeout(Duration::from_secs(3)) .build(); - assert!(result.is_ok(), "HTTP span exporter must build; got {:?}", result.err()); + assert!( + result.is_ok(), + "HTTP span exporter must build; got {:?}", + result.err() + ); } #[test] @@ -439,6 +443,10 @@ mod tests { .with_endpoint("http://127.0.0.1:4318") .with_timeout(Duration::from_secs(3)) .build(); - assert!(result.is_ok(), "HTTP metric exporter must build; got {:?}", result.err()); + assert!( + result.is_ok(), + "HTTP metric exporter must build; got {:?}", + result.err() + ); } } From 74922879a356a6f50590a4e5576b8b24d5bd06e0 Mon Sep 17 00:00:00 2001 From: Chris McClellan Date: Fri, 17 Apr 2026 07:50:11 -0400 Subject: [PATCH 3/3] style: use sort_by_key per clippy::unnecessary_sort_by --- src/shared/capture.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/capture.rs b/src/shared/capture.rs index c0f1b89..0f572fb 100644 --- a/src/shared/capture.rs +++ b/src/shared/capture.rs @@ -244,7 +244,7 @@ impl OutputCapture { output.extend(stdout); output.extend(stderr); - output.sort_by(|(l_time, _), (r_time, _)| l_time.cmp(r_time)); + output.sort_by_key(|(l_time, _)| *l_time); let text: String = output .iter() @@ -260,7 +260,7 @@ impl OutputCapture { output.extend(self.stdout.iter()); output.extend(self.stderr.iter()); - output.sort_by(|(l_time, _), (r_time, _)| l_time.cmp(r_time)); + output.sort_by_key(|(l_time, _)| *l_time); output .iter()