Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 15 additions & 3 deletions bottlecap/src/traces/stats_flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use tokio::sync::OnceCell;
use crate::config;
use crate::lifecycle::invocation::processor::S_TO_MS;
use crate::traces::stats_aggregator::StatsAggregator;
use crate::traces::trace_flusher::ServerlessTraceFlusher;
use dogstatsd::api_key::ApiKeyFactory;
use libdd_common::Endpoint;
use libdd_trace_protobuf::pb;
Expand Down Expand Up @@ -101,9 +102,20 @@ impl StatsFlusher for ServerlessStatsFlusher {

let start = std::time::Instant::now();

let resp =
stats_utils::send_stats_payload(serialized_stats_payload, endpoint, api_key.as_str())
.await;
let Ok(http_client) =
ServerlessTraceFlusher::get_http_client(self.config.proxy_https.as_ref())
else {
error!("STATS_FLUSHER | Failed to create HTTP client");
return;
};

let resp = stats_utils::send_stats_payload_with_client(
serialized_stats_payload,
endpoint,
api_key.as_str(),
Some(&http_client),
)
.await;
let elapsed = start.elapsed();
debug!(
"Stats request to {} took {} ms",
Expand Down
2 changes: 1 addition & 1 deletion bottlecap/src/traces/trace_flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl TraceFlusher for ServerlessTraceFlusher {
}

impl ServerlessTraceFlusher {
fn get_http_client(
pub fn get_http_client(
proxy_https: Option<&String>,
) -> Result<
GenericHttpClient<hyper_http_proxy::ProxyConnector<libdd_common::connector::Connector>>,
Expand Down
Loading