Skip to content

Commit 58e37dd

Browse files
committed
Remove Option passing client to the Stats Exporter.
1 parent 1805508 commit 58e37dd

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

data-pipeline/src/stats_exporter.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::{
1414
use crate::{span_concentrator::SpanConcentrator, trace_exporter::TracerMetadata};
1515
use datadog_trace_protobuf::pb;
1616
use datadog_trace_utils::send_with_retry::{send_with_retry, RetryStrategy};
17-
use ddcommon::hyper_migration::new_default_client;
1817
use ddcommon::{worker::Worker, Endpoint, HttpClient};
1918
use hyper;
2019
use tokio::select;
@@ -50,7 +49,7 @@ impl StatsExporter {
5049
meta: TracerMetadata,
5150
endpoint: Endpoint,
5251
cancellation_token: CancellationToken,
53-
client: Option<HttpClient>,
52+
client: HttpClient,
5453
) -> Self {
5554
Self {
5655
flush_interval,
@@ -59,7 +58,7 @@ impl StatsExporter {
5958
meta,
6059
sequence_id: AtomicU64::new(0),
6160
cancellation_token,
62-
client: client.unwrap_or(new_default_client()),
61+
client,
6362
}
6463
}
6564

@@ -194,6 +193,7 @@ mod tests {
194193
use super::*;
195194
use datadog_trace_utils::span::{trace_utils, SpanSlice};
196195
use datadog_trace_utils::test_utils::poll_for_mock_hit;
196+
use ddcommon::hyper_migration::new_default_client;
197197
use httpmock::prelude::*;
198198
use httpmock::MockServer;
199199
use time::Duration;
@@ -270,7 +270,7 @@ mod tests {
270270
get_test_metadata(),
271271
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
272272
CancellationToken::new(),
273-
None,
273+
new_default_client(),
274274
);
275275

276276
let send_status = stats_exporter.send(true).await;
@@ -298,7 +298,7 @@ mod tests {
298298
get_test_metadata(),
299299
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
300300
CancellationToken::new(),
301-
None,
301+
new_default_client(),
302302
);
303303

304304
let send_status = stats_exporter.send(true).await;
@@ -331,7 +331,7 @@ mod tests {
331331
get_test_metadata(),
332332
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
333333
CancellationToken::new(),
334-
None,
334+
new_default_client(),
335335
);
336336

337337
tokio::time::pause();
@@ -372,7 +372,7 @@ mod tests {
372372
get_test_metadata(),
373373
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
374374
cancellation_token.clone(),
375-
None,
375+
new_default_client(),
376376
);
377377

378378
tokio::spawn(async move {

data-pipeline/src/trace_exporter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ impl TraceExporter {
425425
&agent_info,
426426
&self.client_side_stats,
427427
&self.workers,
428-
Some(self.http_client.clone()),
428+
self.http_client.clone(),
429429
);
430430
}
431431
StatsComputationStatus::Enabled {

data-pipeline/src/trace_exporter/stats.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub(crate) fn start_stats_computation(
6464
workers: &Arc<Mutex<super::TraceExporterWorkers>>,
6565
span_kinds: Vec<String>,
6666
peer_tags: Vec<String>,
67-
client: Option<HttpClient>,
67+
client: HttpClient,
6868
) -> anyhow::Result<()> {
6969
if let StatsComputationStatus::DisabledByAgent { bucket_size } = **client_side_stats.load() {
7070
let stats_concentrator = Arc::new(Mutex::new(SpanConcentrator::new(
@@ -95,7 +95,7 @@ fn create_and_start_stats_worker(
9595
cancellation_token: &CancellationToken,
9696
workers: &Arc<Mutex<super::TraceExporterWorkers>>,
9797
client_side_stats: &ArcSwap<StatsComputationStatus>,
98-
client: Option<HttpClient>,
98+
client: HttpClient,
9999
) -> anyhow::Result<()> {
100100
let stats_exporter = stats_exporter::StatsExporter::new(
101101
bucket_size,
@@ -164,7 +164,7 @@ pub(crate) fn handle_stats_disabled_by_agent(
164164
agent_info: &Arc<AgentInfo>,
165165
client_side_stats: &ArcSwap<StatsComputationStatus>,
166166
workers: &Arc<Mutex<super::TraceExporterWorkers>>,
167-
client: Option<HttpClient>,
167+
client: HttpClient,
168168
) {
169169
if agent_info.info.client_drop_p0s.is_some_and(|v| v) {
170170
// Client-side stats is supported by the agent

0 commit comments

Comments
 (0)