Skip to content

Commit 386bc6b

Browse files
committed
Remove Option passing client to the Stats Exporter.
1 parent e702ace commit 386bc6b

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
@@ -15,7 +15,6 @@ use crate::trace_exporter::TracerMetadata;
1515
use datadog_trace_protobuf::pb;
1616
use datadog_trace_stats::span_concentrator::SpanConcentrator;
1717
use datadog_trace_utils::send_with_retry::{send_with_retry, RetryStrategy};
18-
use ddcommon::hyper_migration::new_default_client;
1918
use ddcommon::{worker::Worker, Endpoint, HttpClient};
2019
use hyper;
2120
use tokio::select;
@@ -51,7 +50,7 @@ impl StatsExporter {
5150
meta: TracerMetadata,
5251
endpoint: Endpoint,
5352
cancellation_token: CancellationToken,
54-
client: Option<HttpClient>,
53+
client: HttpClient,
5554
) -> Self {
5655
Self {
5756
flush_interval,
@@ -60,7 +59,7 @@ impl StatsExporter {
6059
meta,
6160
sequence_id: AtomicU64::new(0),
6261
cancellation_token,
63-
client: client.unwrap_or(new_default_client()),
62+
client,
6463
}
6564
}
6665

@@ -195,6 +194,7 @@ mod tests {
195194
use super::*;
196195
use datadog_trace_utils::span::{trace_utils, SpanSlice};
197196
use datadog_trace_utils::test_utils::poll_for_mock_hit;
197+
use ddcommon::hyper_migration::new_default_client;
198198
use httpmock::prelude::*;
199199
use httpmock::MockServer;
200200
use time::Duration;
@@ -271,7 +271,7 @@ mod tests {
271271
get_test_metadata(),
272272
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
273273
CancellationToken::new(),
274-
None,
274+
new_default_client(),
275275
);
276276

277277
let send_status = stats_exporter.send(true).await;
@@ -299,7 +299,7 @@ mod tests {
299299
get_test_metadata(),
300300
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
301301
CancellationToken::new(),
302-
None,
302+
new_default_client(),
303303
);
304304

305305
let send_status = stats_exporter.send(true).await;
@@ -332,7 +332,7 @@ mod tests {
332332
get_test_metadata(),
333333
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
334334
CancellationToken::new(),
335-
None,
335+
new_default_client(),
336336
);
337337

338338
tokio::time::pause();
@@ -373,7 +373,7 @@ mod tests {
373373
get_test_metadata(),
374374
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
375375
cancellation_token.clone(),
376-
None,
376+
new_default_client(),
377377
);
378378

379379
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)