Skip to content

Commit

Permalink
instr(buffer): Another metric (#4287)
Browse files Browse the repository at this point in the history
The "spool" metric contains both the SQL write and packing envelopes
into a memory blob. Split up the metric to get more insight.
  • Loading branch information
jjbayer authored Nov 25, 2024
1 parent 434c1c5 commit 9e3ef9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions relay-server/src/services/buffer/envelope_store/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,12 @@ impl SqliteEnvelopeStore {
.bind(count as u16)
.bind(encoded);

query
.execute(&self.db)
.await
.map_err(SqliteEnvelopeStoreError::WriteError)?;
relay_statsd::metric!(timer(RelayTimers::BufferSqlWrite), {
query
.execute(&self.db)
.await
.map_err(SqliteEnvelopeStoreError::WriteError)?;
});
Ok(())
}

Expand Down
7 changes: 6 additions & 1 deletion relay-server/src/statsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,12 @@ pub enum RelayTimers {
/// This metric is tagged with:
/// - `input`: The type of input that the service is handling.
BufferBusy,
/// Timing in milliseconds for the time it takes for the buffer to spool data to disk.
/// Timing in milliseconds for the time it takes for the buffer to pack & spool a batch.
///
/// Contains the time it takes to pack multiple envelopes into a single memory blob.
BufferSpool,
/// Timing in milliseconds for the time it takes for the buffer to spool data to SQLite.
BufferSqlWrite,
/// Timing in milliseconds for the time it takes for the buffer to unspool data from disk.
BufferUnspool,
/// Timing in milliseconds for the time it takes for the buffer to push.
Expand Down Expand Up @@ -628,6 +632,7 @@ impl TimerMetric for RelayTimers {
RelayTimers::BufferIdle => "buffer.idle",
RelayTimers::BufferBusy => "buffer.busy",
RelayTimers::BufferSpool => "buffer.spool.duration",
RelayTimers::BufferSqlWrite => "buffer.write.duration",
RelayTimers::BufferUnspool => "buffer.unspool.duration",
RelayTimers::BufferPush => "buffer.push.duration",
RelayTimers::BufferPeek => "buffer.peek.duration",
Expand Down

0 comments on commit 9e3ef9d

Please sign in to comment.