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
4 changes: 2 additions & 2 deletions crates/datadog-serverless-compat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub async fn main() {
}
});

let (mut metrics_flusher, _aggregator_handle) = if dd_use_dogstatsd {
let (metrics_flusher, _aggregator_handle) = if dd_use_dogstatsd {
debug!("Starting dogstatsd");
let (_, metrics_flusher, aggregator_handle) = start_dogstatsd(
dd_dogstatsd_port,
Expand All @@ -167,7 +167,7 @@ pub async fn main() {
loop {
flush_interval.tick().await;

if let Some(metrics_flusher) = metrics_flusher.as_mut() {
if let Some(metrics_flusher) = metrics_flusher.as_ref() {
debug!("Flushing dogstatsd metrics");
metrics_flusher.flush().await;
}
Expand Down
12 changes: 6 additions & 6 deletions crates/dogstatsd/src/flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Flusher {
}
}

async fn get_dd_api(&mut self) -> &Option<DdApi> {
async fn get_dd_api(&self) -> &Option<DdApi> {
self.dd_api
.get_or_init(|| async {
let api_key = self.api_key_factory.get_api_key().await;
Expand All @@ -76,7 +76,7 @@ impl Flusher {

/// Flush metrics from the aggregator
pub async fn flush(
&mut self,
&self,
) -> Option<(
Vec<crate::datadog::Series>,
Vec<datadog_protos::metrics::SketchPayload>,
Expand All @@ -96,7 +96,7 @@ impl Flusher {

/// Flush given batch of metrics
pub async fn flush_metrics(
&mut self,
&self,
series: Vec<crate::datadog::Series>,
distributions: Vec<datadog_protos::metrics::SketchPayload>,
) -> Option<(
Expand Down Expand Up @@ -272,7 +272,7 @@ mod tests {
None,
);

let mut flusher = Flusher::new(FlusherConfig {
let flusher = Flusher::new(FlusherConfig {
api_key_factory: Arc::new(api_key_factory),
aggregator_handle: handle,
metrics_intake_url_prefix: MetricsIntakeUrlPrefix::new(
Expand Down Expand Up @@ -319,7 +319,7 @@ mod tests {

let api_key_factory = ApiKeyFactory::new("test-api-key");

let mut flusher = Flusher::new(FlusherConfig {
let flusher = Flusher::new(FlusherConfig {
api_key_factory: Arc::new(api_key_factory),
aggregator_handle: handle,
metrics_intake_url_prefix: MetricsIntakeUrlPrefix::new(
Expand Down Expand Up @@ -369,7 +369,7 @@ mod tests {

let api_key_factory = ApiKeyFactory::new("test-api-key");

let mut flusher = Flusher::new(FlusherConfig {
let flusher = Flusher::new(FlusherConfig {
api_key_factory: Arc::new(api_key_factory),
aggregator_handle: handle,
metrics_intake_url_prefix: MetricsIntakeUrlPrefix::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/dogstatsd/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn dogstatsd_server_ships_series() {

let api_key_factory = ApiKeyFactory::new("mock-api-key");

let mut metrics_flusher = Flusher::new(FlusherConfig {
let metrics_flusher = Flusher::new(FlusherConfig {
api_key_factory: Arc::new(api_key_factory),
aggregator_handle: handle.clone(),
metrics_intake_url_prefix: MetricsIntakeUrlPrefix::new(
Expand Down
Loading