Skip to content

Commit 137b17c

Browse files
committed
feat(otlp): Allow to provide http client wrapped in Arc for user
1 parent 8e95e16 commit 137b17c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • opentelemetry-otlp/src/exporter/http

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ impl HasHttpConfig for HttpExporterBuilder {
771771
/// ```
772772
pub trait WithHttpConfig {
773773
/// Assign client implementation
774-
fn with_http_client<T: HttpClient + 'static>(self, client: T) -> Self;
774+
fn with_http_client(self, client: impl Into<std::sync::Arc<dyn HttpClient>>) -> Self;
775775

776776
/// Set additional headers to send to the collector.
777777
fn with_headers(self, headers: HashMap<String, String>) -> Self;
@@ -785,8 +785,8 @@ pub trait WithHttpConfig {
785785
}
786786

787787
impl<B: HasHttpConfig> WithHttpConfig for B {
788-
fn with_http_client<T: HttpClient + 'static>(mut self, client: T) -> Self {
789-
self.http_client_config().client = Some(Arc::new(client));
788+
fn with_http_client(mut self, client: impl Into<std::sync::Arc<dyn HttpClient>>) -> Self {
789+
self.http_client_config().client = Some(client.into());
790790
self
791791
}
792792

0 commit comments

Comments
 (0)