Skip to content

Reduce http_request_queue_time_seconds cardinality + refactor#97

Merged
errm merged 10 commits intomasterfrom
errm/request-queue-duration
Apr 20, 2026
Merged

Reduce http_request_queue_time_seconds cardinality + refactor#97
errm merged 10 commits intomasterfrom
errm/request-queue-duration

Conversation

@errm
Copy link
Copy Markdown
Owner

@errm errm commented Apr 20, 2026

Reduce the cardinality of http_request_queue_time_seconds

Currently we are recording this histogram for each action/controller/method.

This isn't really required since queue time is a function of how many requests (and how long they take to process) at the server level. The currently requested action/controller/method has no impact on this (since at the time we measure queue time we haven't even started processing the request yet).

Also a little refactoring to improve readability, I also added some specs around the middleware.

@errm errm force-pushed the errm/request-queue-duration branch 2 times, most recently from 373cdae to d87aaa4 Compare April 20, 2026 14:52
errm added 10 commits April 20, 2026 15:58
This was confusing to read, these values are seconds (floating point)
and not miliseconds.
This metric is a mesure of how long a request sits in a queue
after it is accepted by a frontend reverse proxy, cache server or
load balancer.

Dimensions like request method or response code have no bearing
on this - since it is only measuring something that happens
before our application starts to process the request.
The valid_header_present? method just makes this class harder to use in
the callsite. I am happy here for us to return the correct value if we
can, and if not return nil
I think this reads better as first non empty header value ...
This can only happen if the clock on the reverse proxy writing the
header is skewed against the application server.
@errm errm force-pushed the errm/request-queue-duration branch from d87aaa4 to e2efddb Compare April 20, 2026 14:59
@errm errm merged commit b1be891 into master Apr 20, 2026
12 checks passed
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.

1 participant