Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions opentelemetry-otlp/src/exporter/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,39 +127,32 @@
))]
{
// TODO - support configuring custom connector and executor
http_client = Some(Arc::new(HyperClient::with_default_connector(timeout, None))
as Arc<dyn HttpClient>);
let client = HyperClient::with_default_connector(timeout, None);
http_client = Some(Arc::new(client));

Check warning on line 131 in opentelemetry-otlp/src/exporter/http/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/mod.rs#L130-L131

Added lines #L130 - L131 were not covered by tests
}
#[cfg(all(
not(feature = "hyper-client"),
not(feature = "reqwest-blocking-client"),
feature = "reqwest-client"
))]
{
http_client = Some(Arc::new(
reqwest::Client::builder()
.timeout(timeout)
.build()
.unwrap_or_default(),
) as Arc<dyn HttpClient>);
let client = reqwest::Client::builder()
.timeout(timeout)
.build()
.unwrap_or_default();
http_client = Some(Arc::new(client));

Check warning on line 143 in opentelemetry-otlp/src/exporter/http/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/mod.rs#L139-L143

Added lines #L139 - L143 were not covered by tests
}
#[cfg(all(
not(feature = "hyper-client"),
not(feature = "reqwest-client"),
feature = "reqwest-blocking-client"
))]
{
let timeout_clone = timeout;
http_client = Some(Arc::new(
std::thread::spawn(move || {
reqwest::blocking::Client::builder()
.timeout(timeout_clone)
.build()
.unwrap_or_else(|_| reqwest::blocking::Client::new())
})
.join()
.unwrap(), // TODO: Return ExporterBuildError::ThreadSpawnFailed
) as Arc<dyn HttpClient>);
let client = reqwest::blocking::Client::builder()
.timeout(timeout)
.build()
.unwrap_or_default();
http_client = Some(Arc::new(client));

Check warning on line 155 in opentelemetry-otlp/src/exporter/http/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/mod.rs#L151-L155

Added lines #L151 - L155 were not covered by tests
}
}

Expand Down
Loading