V2 metrics enhancement#1681
Draft
benalleng wants to merge 3 commits into
Draft
Conversation
Collaborator
Coverage Report for CI Build 28179458288Coverage increased (+0.2%) to 85.676%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
The outer track_metrics middleware only sees the wire path (/.well-known/ohttp-gateway or /), so V2 mailbox traffic was invisible to per-endpoint counters. handle_decapsulated_request now records each logical V2 operation (POST/GET/PUT) using the same endpoint_label/method_label collapse used at the outer layer. HandlerError gains a side-effect-free status_code() helper so the inner record can read the status without running to_response's logging twice.
A successful V2 request is now counted twice: once at the outer middleware boundary (every byte on the socket) and once after OHTTP decapsulation (the logical V2 op it carried). The bounded RequestLayer enum (gateway | v2) keeps the two counts distinguishable so dashboards can pick one.
Adds three tests for handle_decapsulated_request's metric
recordings: POST happy path (layer=v2, endpoint=/{mailbox},
method=POST, status=200), GET timeout (status=202), and the
catch-all 404 arm (endpoint=other). Also guards that the actual
short-id value never reaches any metric label.
test_service delegates to test_service_with_metrics so tests can
inject a provider-backed MetricsService.
b1dc4e5 to
302175f
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.
This PR is vibed to address an out of band observation that the mailroom did not properly find v2
/{mailbox}endpoints even following our latest update to the metrics.I pushed a branch to the upstream repo so I could easily test the mailroom metrics on https://pj.benalleng.com. I can confirm that the
/{mailbox}endpoint is when using this branch.Coded with Glm 5.2
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.