From 8c50726b4659b99514503228462a021eff5c4ef7 Mon Sep 17 00:00:00 2001 From: Riccardo Busetti Date: Fri, 13 Sep 2024 13:18:27 +0200 Subject: [PATCH] ref(spooler): Clean up unused metrics --- relay-server/src/services/buffer/mod.rs | 28 ------------------- .../services/buffer/stack_provider/sqlite.rs | 2 +- relay-server/src/statsd.rs | 9 ++---- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/relay-server/src/services/buffer/mod.rs b/relay-server/src/services/buffer/mod.rs index 92c31cd5eb..a6d749bd83 100644 --- a/relay-server/src/services/buffer/mod.rs +++ b/relay-server/src/services/buffer/mod.rs @@ -143,45 +143,17 @@ impl EnvelopeBufferService { &mut self, buffer: &mut PolymorphicEnvelopeBuffer, ) -> Result<(), SendError> { - relay_statsd::metric!( - counter(RelayCounters::BufferReadyToPop) += 1, - status = "checking" - ); - self.system_ready(buffer).await; - relay_statsd::metric!( - counter(RelayCounters::BufferReadyToPop) += 1, - status = "system_ready" - ); - if self.sleep > Duration::ZERO { tokio::time::sleep(self.sleep).await; } - relay_statsd::metric!( - counter(RelayCounters::BufferReadyToPop) += 1, - status = "slept" - ); - if let Some(project_cache_ready) = self.project_cache_ready.as_mut() { - relay_statsd::metric!( - counter(RelayCounters::BufferReadyToPop) += 1, - status = "waiting_for_project_cache" - ); project_cache_ready.await?; - relay_statsd::metric!( - counter(RelayCounters::BufferReadyToPop) += 1, - status = "waited_for_project_cache" - ); self.project_cache_ready = None; } - relay_statsd::metric!( - counter(RelayCounters::BufferReadyToPop) += 1, - status = "checked" - ); - Ok(()) } diff --git a/relay-server/src/services/buffer/stack_provider/sqlite.rs b/relay-server/src/services/buffer/stack_provider/sqlite.rs index 15e4be6c4e..6a17436399 100644 --- a/relay-server/src/services/buffer/stack_provider/sqlite.rs +++ b/relay-server/src/services/buffer/stack_provider/sqlite.rs @@ -121,7 +121,7 @@ impl StackProvider for SqliteStackProvider { async fn flush(&mut self, envelope_stacks: impl IntoIterator) { relay_log::trace!("Flushing sqlite envelope buffer"); - relay_statsd::metric!(timer(RelayTimers::BufferDrain), { + relay_statsd::metric!(timer(RelayTimers::BufferFlush), { let mut envelopes = Vec::with_capacity(self.drain_batch_size); for envelope_stack in envelope_stacks { for envelope in envelope_stack.flush() { diff --git a/relay-server/src/statsd.rs b/relay-server/src/statsd.rs index 103fc03e79..339e789827 100644 --- a/relay-server/src/statsd.rs +++ b/relay-server/src/statsd.rs @@ -530,8 +530,8 @@ pub enum RelayTimers { BufferPeek, /// Timing in milliseconds for the time it takes for the buffer to pop. BufferPop, - /// Timing in milliseconds for the time it takes for the buffer to drain its envelopes. - BufferDrain, + /// Timing in milliseconds for the time it takes for the buffer to flush its envelopes. + BufferFlush, } impl TimerMetric for RelayTimers { @@ -579,7 +579,7 @@ impl TimerMetric for RelayTimers { RelayTimers::BufferPush => "buffer.push.duration", RelayTimers::BufferPeek => "buffer.peek.duration", RelayTimers::BufferPop => "buffer.pop.duration", - RelayTimers::BufferDrain => "buffer.drain.duration", + RelayTimers::BufferFlush => "buffer.flush.duration", } } } @@ -635,8 +635,6 @@ pub enum RelayCounters { BufferEnvelopeStacksPopped, /// Number of times an envelope from the buffer is trying to be popped. BufferTryPop, - /// Number of times the readiness check of the buffer is polled. - BufferReadyToPop, /// Number of envelopes spool to disk. BufferSpooledEnvelopes, /// Number of envelopes unspooled from disk. @@ -860,7 +858,6 @@ impl CounterMetric for RelayCounters { RelayCounters::BufferStateTransition => "buffer.state.transition", RelayCounters::BufferEnvelopeStacksPopped => "buffer.envelope_stacks_popped", RelayCounters::BufferTryPop => "buffer.try_pop", - RelayCounters::BufferReadyToPop => "buffer.ready_to_pop", RelayCounters::BufferSpooledEnvelopes => "buffer.spooled_envelopes", RelayCounters::BufferUnspooledEnvelopes => "buffer.unspooled_envelopes", RelayCounters::Outcomes => "events.outcomes",