diff --git a/relay-server/src/services/buffer/envelope_stack/sqlite.rs b/relay-server/src/services/buffer/envelope_stack/sqlite.rs index 703569ddab..97accdf3cb 100644 --- a/relay-server/src/services/buffer/envelope_stack/sqlite.rs +++ b/relay-server/src/services/buffer/envelope_stack/sqlite.rs @@ -97,7 +97,9 @@ impl SqliteEnvelopeStack { // We convert envelopes into a format which simplifies insertion in the store. If an // envelope can't be serialized, we will not insert it. - let envelopes = envelopes.iter().filter_map(|e| e.as_ref().try_into().ok()); + let envelopes = relay_statsd::metric!(timer(RelayTimers::BufferEnvelopesSerialization), { + envelopes.iter().filter_map(|e| e.as_ref().try_into().ok()) + }); // When early return here, we are acknowledging that the elements that we popped from // the buffer are lost in case of failure. We are doing this on purposes, since if we were diff --git a/relay-server/src/statsd.rs b/relay-server/src/statsd.rs index fbae91d779..3526e30b0a 100644 --- a/relay-server/src/statsd.rs +++ b/relay-server/src/statsd.rs @@ -538,6 +538,8 @@ pub enum RelayTimers { 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 envelopes to be serialized. + BufferEnvelopesSerialization, } impl TimerMetric for RelayTimers { @@ -586,6 +588,7 @@ impl TimerMetric for RelayTimers { RelayTimers::BufferPeek => "buffer.peek.duration", RelayTimers::BufferPop => "buffer.pop.duration", RelayTimers::BufferDrain => "buffer.drain.duration", + RelayTimers::BufferEnvelopesSerialization => "buffer.envelopes_serialization", } } }