@@ -15,7 +15,7 @@ use crate::trace_exporter::TracerMetadata;
1515use datadog_trace_protobuf:: pb;
1616use datadog_trace_stats:: span_concentrator:: SpanConcentrator ;
1717use datadog_trace_utils:: send_with_retry:: { send_with_retry, RetryStrategy } ;
18- use ddcommon:: { worker:: Worker , Endpoint } ;
18+ use ddcommon:: { worker:: Worker , Endpoint , HttpClient } ;
1919use hyper;
2020use tokio:: select;
2121use tokio_util:: sync:: CancellationToken ;
@@ -32,6 +32,7 @@ pub struct StatsExporter {
3232 meta : TracerMetadata ,
3333 sequence_id : AtomicU64 ,
3434 cancellation_token : CancellationToken ,
35+ client : HttpClient ,
3536}
3637
3738impl StatsExporter {
@@ -49,6 +50,7 @@ impl StatsExporter {
4950 meta : TracerMetadata ,
5051 endpoint : Endpoint ,
5152 cancellation_token : CancellationToken ,
53+ client : HttpClient ,
5254 ) -> Self {
5355 Self {
5456 flush_interval,
@@ -57,6 +59,7 @@ impl StatsExporter {
5759 meta,
5860 sequence_id : AtomicU64 :: new ( 0 ) ,
5961 cancellation_token,
62+ client,
6063 }
6164 }
6265
@@ -90,11 +93,11 @@ impl StatsExporter {
9093 ) ;
9194
9295 let result = send_with_retry (
96+ & self . client ,
9397 & self . endpoint ,
9498 body,
9599 & headers,
96100 & RetryStrategy :: default ( ) ,
97- None ,
98101 )
99102 . await ;
100103
@@ -191,6 +194,7 @@ mod tests {
191194 use super :: * ;
192195 use datadog_trace_utils:: span:: { trace_utils, SpanSlice } ;
193196 use datadog_trace_utils:: test_utils:: poll_for_mock_hit;
197+ use ddcommon:: hyper_migration:: new_default_client;
194198 use httpmock:: prelude:: * ;
195199 use httpmock:: MockServer ;
196200 use time:: Duration ;
@@ -267,6 +271,7 @@ mod tests {
267271 get_test_metadata ( ) ,
268272 Endpoint :: from_url ( stats_url_from_agent_url ( & server. url ( "/" ) ) . unwrap ( ) ) ,
269273 CancellationToken :: new ( ) ,
274+ new_default_client ( ) ,
270275 ) ;
271276
272277 let send_status = stats_exporter. send ( true ) . await ;
@@ -294,6 +299,7 @@ mod tests {
294299 get_test_metadata ( ) ,
295300 Endpoint :: from_url ( stats_url_from_agent_url ( & server. url ( "/" ) ) . unwrap ( ) ) ,
296301 CancellationToken :: new ( ) ,
302+ new_default_client ( ) ,
297303 ) ;
298304
299305 let send_status = stats_exporter. send ( true ) . await ;
@@ -326,6 +332,7 @@ mod tests {
326332 get_test_metadata ( ) ,
327333 Endpoint :: from_url ( stats_url_from_agent_url ( & server. url ( "/" ) ) . unwrap ( ) ) ,
328334 CancellationToken :: new ( ) ,
335+ new_default_client ( ) ,
329336 ) ;
330337
331338 tokio:: time:: pause ( ) ;
@@ -366,6 +373,7 @@ mod tests {
366373 get_test_metadata ( ) ,
367374 Endpoint :: from_url ( stats_url_from_agent_url ( & server. url ( "/" ) ) . unwrap ( ) ) ,
368375 cancellation_token. clone ( ) ,
376+ new_default_client ( ) ,
369377 ) ;
370378
371379 tokio:: spawn ( async move {
0 commit comments