We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dca4c1d commit ac8d049Copy full SHA for ac8d049
crates/datadog-trace-agent/src/stats_flusher.rs
@@ -61,13 +61,16 @@ impl StatsFlusher for ServerlessStatsFlusher {
61
}
62
});
63
64
- // flush stats from the bufferon a fixed interval
+ // flush stats from the buffer on a fixed interval
65
loop {
66
tokio::time::sleep(time::Duration::from_secs(config.stats_flush_interval_secs)).await;
67
68
let mut buffer = buffer_consumer.lock().await;
69
+ // copy the batch for this flush
70
let channel_stats = buffer.to_vec();
71
+ // reset the buffer so the next tick only sees new stats
72
buffer.clear();
73
+ // release the mutex before flushing stats
74
drop(buffer);
75
76
let should_flush = should_flush_stats_buffer(
0 commit comments