Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spooler): Add back metrics #4127

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions relay-server/src/services/buffer/envelope_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +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!(timer(RelayTimers::BufferPush), {
let result = relay_statsd::metric!(timer(RelayTimers::BufferPush), {
let received_at = envelope.meta().start_time().into();
let project_key_pair = ProjectKeyPair::from_envelope(&envelope);

Expand All @@ -109,7 +109,9 @@ impl EnvelopeBuffer {
self.track_total_count();

Ok(())
})
});
relay_statsd::metric!(counter(RelayCounters::BufferEnvelopesWritten) += 1);
result
}

/// Returns a reference to the next-in-line envelope, if one exists.
Expand All @@ -136,7 +138,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!(timer(RelayTimers::BufferPop), {
let result = relay_statsd::metric!(timer(RelayTimers::BufferPop), {
let Some((&project_key_pair, _)) = self.priority_queue.peek() else {
return Ok(None);
};
Expand Down Expand Up @@ -174,7 +176,9 @@ impl EnvelopeBuffer {
self.track_total_count();

Ok(Some(envelope))
})
});
relay_statsd::metric!(counter(RelayCounters::BufferEnvelopesRead) += 1);
result
}

/// Re-prioritizes all [`ProjectKeyPair`]s that involve the given project key by setting it to
Expand Down
Loading