Skip to content

Commit 01e6526

Browse files
committed
chore: select correct runtime
1 parent 0502bd0 commit 01e6526

File tree

1 file changed

+10
-2
lines changed
  • opentelemetry-otlp/src/exporter/http

1 file changed

+10
-2
lines changed

opentelemetry-otlp/src/exporter/http/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ impl OtlpHttpClient {
388388
#[cfg(feature = "experimental-http-retry")]
389389
{
390390
use crate::retry::retry_with_backoff;
391-
use opentelemetry_sdk::runtime::Tokio;
392391

393392
// Build request body once before retry loop
394393
let (body, content_type, content_encoding) = build_body_fn(self, data)
@@ -400,8 +399,17 @@ impl OtlpHttpClient {
400399
endpoint: self.collector_endpoint.to_string(),
401400
});
402401

402+
// Select runtime based on HTTP client feature - if we're using
403+
// one without Tokio, we don't need or want the Tokio async blocking
404+
// behaviour.
405+
#[cfg(feature = "reqwest-blocking-client")]
406+
let runtime = opentelemetry_sdk::runtime::NoAsync;
407+
408+
#[cfg(not(feature = "reqwest-blocking-client"))]
409+
let runtime = opentelemetry_sdk::runtime::Tokio;
410+
403411
retry_with_backoff(
404-
Tokio,
412+
runtime,
405413
self.retry_policy.clone(),
406414
classify_http_export_error,
407415
operation_name,

0 commit comments

Comments
 (0)