Skip to content

perf(http/prom): avoid oneshot channel for request duration start time#4448

Merged
unleashed merged 1 commit intomainfrom
amr/record-start-time-optimization
Mar 10, 2026
Merged

perf(http/prom): avoid oneshot channel for request duration start time#4448
unleashed merged 1 commit intomainfrom
amr/record-start-time-optimization

Conversation

@unleashed
Copy link
Member

RecordRequestDuration knows the start time at call() time, whereas RecordResponseDuration defers it until the request body flushes. The latter needs async delivery from the request body wrapper, but the former is known synchronously.

Replace the shared oneshot::Receiver in ResponseState with an enum supporting both immediate and deferred start times, removing one heap allocation per request.

@unleashed unleashed requested a review from cratelyn March 6, 2026 15:59
@unleashed unleashed requested a review from a team as a code owner March 6, 2026 15:59
@unleashed unleashed force-pushed the amr/record-start-time-optimization branch from af46927 to 9079c81 Compare March 10, 2026 13:17
RecordRequestDuration knows the start time at call() time, whereas
RecordResponseDuration defers it until the request body flushes. The
latter needs async delivery from the request body wrapper, but the
former is known synchronously.

Replace the shared oneshot::Receiver<Instant> in ResponseState with an
enum supporting both immediate and deferred start times, removing one
heap allocation per request.

Signed-off-by: Alejandro Martinez Ruiz <amr@buoyant.io>
@unleashed unleashed force-pushed the amr/record-start-time-optimization branch from 9079c81 to e53c203 Compare March 10, 2026 13:19
@unleashed unleashed merged commit afb7b79 into main Mar 10, 2026
19 of 22 checks passed
@unleashed unleashed deleted the amr/record-start-time-optimization branch March 10, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants