Skip to content

Commit

Permalink
feat(spooler): Add back metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
iambriccardo committed Oct 9, 2024
1 parent 4b58953 commit dea543b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions relay-server/src/services/buffer/envelope_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl EnvelopeBuffer {

/// Pushes an envelope to the [`EnvelopeRepository`] and updates the priority queue accordingly.
pub async fn push(&mut self, envelope: Box<Envelope>) -> Result<(), EnvelopeBufferError> {
relay_statsd::metric!(counter(RelayCounters::BufferEnvelopesWritten) += 1);
relay_statsd::metric!(timer(RelayTimers::BufferPush), {
let received_at = envelope.meta().start_time().into();
let project_key_pair = ProjectKeyPair::from_envelope(&envelope);
Expand Down Expand Up @@ -136,6 +137,7 @@ impl EnvelopeBuffer {
/// The priority of the [`ProjectKeyPair`] is updated with the next envelope's received_at
/// time.
pub async fn pop(&mut self) -> Result<Option<Box<Envelope>>, EnvelopeBufferError> {
relay_statsd::metric!(counter(RelayCounters::BufferEnvelopesRead) += 1);
relay_statsd::metric!(timer(RelayTimers::BufferPop), {
let Some((&project_key_pair, _)) = self.priority_queue.peek() else {
return Ok(None);
Expand Down

0 comments on commit dea543b

Please sign in to comment.