Reduce http_request_queue_time_seconds cardinality + refactor#97
Merged
Reduce http_request_queue_time_seconds cardinality + refactor#97
Conversation
373cdae to
d87aaa4
Compare
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.
d87aaa4 to
e2efddb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.