Skip to content

Commit

Permalink
ref(metrics): Rename body read metric (#4214)
Browse files Browse the repository at this point in the history
The previous metric had a small cardinality explosion, it's easier to
start fresh also aligns the naming more with the other metrics we're
already tracking.
  • Loading branch information
Dav1dde authored Nov 4, 2024
1 parent 5b26713 commit 4bdad17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions relay-server/src/middlewares/body_timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl TimedBody {

fn emit_metric(&self, duration: Duration, status: &str) {
metric!(
timer(RelayTimers::BodyReading) = duration,
timer(RelayTimers::BodyReadDuration) = duration,
route = self.route.as_ref().map_or("unknown", |p| p.as_str()),
size = size_category(self.size),
status = status
Expand Down Expand Up @@ -183,7 +183,7 @@ mod tests {
});
assert_eq!(
captures,
["body.reading.duration:0|ms|#route:unknown,size:<1KB,status:completed"]
["requests.body_read.duration:0|ms|#route:unknown,size:<1KB,status:completed"]
);
}

Expand All @@ -202,7 +202,7 @@ mod tests {
});
assert_eq!(
captures,
["body.reading.duration:0|ms|#route:unknown,size:<1KB,status:completed"]
["requests.body_read.duration:0|ms|#route:unknown,size:<1KB,status:completed"]
);
}

Expand All @@ -220,7 +220,7 @@ mod tests {
});
assert_eq!(
captures,
["body.reading.duration:0|ms|#route:unknown,size:<1KB,status:dropped"]
["requests.body_read.duration:0|ms|#route:unknown,size:<1KB,status:dropped"]
)
}

Expand All @@ -247,7 +247,7 @@ mod tests {
});
assert_eq!(
captures,
["body.reading.duration:0|ms|#route:unknown,size:<1KB,status:failed"]
["requests.body_read.duration:0|ms|#route:unknown,size:<1KB,status:failed"]
)
}

Expand All @@ -267,7 +267,7 @@ mod tests {
});
assert_eq!(
captures,
["body.reading.duration:0|ms|#route:unknown,size:<10KB,status:completed"]
["requests.body_read.duration:0|ms|#route:unknown,size:<10KB,status:completed"]
)
}

Expand Down
4 changes: 2 additions & 2 deletions relay-server/src/statsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ pub enum RelayTimers {
/// Timing in milliseconds for the time it takes for the envelopes to be serialized.
BufferEnvelopesSerialization,
/// Timing in milliseconds to the time it takes to read an HTTP body.
BodyReading,
BodyReadDuration,
}

impl TimerMetric for RelayTimers {
Expand Down Expand Up @@ -604,7 +604,7 @@ impl TimerMetric for RelayTimers {
RelayTimers::BufferPop => "buffer.pop.duration",
RelayTimers::BufferDrain => "buffer.drain.duration",
RelayTimers::BufferEnvelopesSerialization => "buffer.envelopes_serialization",
RelayTimers::BodyReading => "body.reading.duration",
RelayTimers::BodyReadDuration => "requests.body_read.duration",
}
}
}
Expand Down

0 comments on commit 4bdad17

Please sign in to comment.