Skip to content

Commit 830adbe

Browse files
committed
Improve usage buffer drop visibility
1 parent a0e453e commit 830adbe

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/usage_buffer.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ mod buffer {
158158
let count = self
159159
.dropped_count
160160
.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
161-
// Log periodically to avoid log spam (every 100 drops)
162-
if count.is_multiple_of(100) {
161+
if count == 0 || count.is_multiple_of(10) {
163162
tracing::warn!(
164163
dropped_count = count + 1,
165164
max_pending = self.config.max_pending_entries,
@@ -210,6 +209,15 @@ mod buffer {
210209
if !batch.is_empty() {
211210
buffer.flush_batch(&sink, &mut batch).await;
212211
}
212+
let total_dropped = buffer
213+
.dropped_count
214+
.load(std::sync::atomic::Ordering::Relaxed);
215+
if total_dropped > 0 {
216+
tracing::warn!(
217+
total_dropped,
218+
"Usage buffer dropped entries during lifetime"
219+
);
220+
}
213221
tracing::info!("Usage log buffer worker shutting down");
214222
break;
215223
}

0 commit comments

Comments
 (0)