Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(spooler): Add metric to track serialization performance #4135

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion relay-server/src/services/buffer/envelope_stack/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions relay-server/src/statsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Timing in milliseconds for the time it takes for the envelopes to be serialized.
/// Timing in milliseconds for the time it takes a batch of envelopes to be serialized.

BufferEnvelopesSerialization,
}

impl TimerMetric for RelayTimers {
Expand Down Expand Up @@ -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",
}
}
}
Expand Down
Loading