Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iambriccardo committed Sep 12, 2024
1 parent 8a78ae6 commit c03daa0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions relay-server/src/services/buffer/envelope_stack/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ impl SqliteEnvelopeStack {
};
self.batches_buffer_size -= envelopes.len();

relay_statsd::metric!(
counter(RelayCounters::BufferSpooledEnvelopes) += envelopes.len() as u64
);

// 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());

relay_statsd::metric!(counter(RelayCounters::BufferSpooledEnvelopes) += envelopes.len());

// 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
// to have a database corruption during runtime, and we were to put the values back into
Expand Down Expand Up @@ -141,7 +143,9 @@ impl SqliteEnvelopeStack {
return Ok(());
}

relay_statsd::metric!(counter(RelayCounters::BufferUnspooledEnvelopes) += envelopes.len());
relay_statsd::metric!(
counter(RelayCounters::BufferUnspooledEnvelopes) += envelopes.len() as u64
);

// We push in the back of the buffer, since we still want to give priority to
// incoming envelopes that have a more recent timestamp.
Expand Down

0 comments on commit c03daa0

Please sign in to comment.