Key request telemetry by route path, not just method#20
Merged
Conversation
The Normalizer keyed `request` records on method + (route ?? uri), but real
Nightwatch request payloads carry neither — they have `route_path` (the
bounded route pattern, e.g. /posts/{post}). So every request collapsed to
just its verb ("GET", "POST"), and the slow-requests MCP tool could only
report "the slowest GET" with no path.
Add `route_path` to the request key resolution (after route, before uri), so
requests group as "GET /posts/{post}". Unmatched routes (empty route_path)
still fall back to the bare method. Adds normalization test cases.
Note: normalized_key is computed at ingest, so existing raw_events are
backfilled from payload->route_path and re-rolled-up after deploy.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The slow-requests MCP tool could only report the slowest verb ("GET", p95 480 ms) with no path. Cause:
Normalizerkeyedrequestrecords onmethod + (route ?? uri), but real Nightwatch request payloads have neither field — they carryroute_path(the bounded route pattern). So every request collapsed to its method.Confirmed live: request payloads have
route_pathvalues like/posts/{post},/built-for-cloud/{package},/admin/posts/{record}/edit— route patterns (bounded cardinality), ideal for aggregation. Every other record type already keys correctly (query→sql, outgoing-request→method+host, command→name, etc.);requestwas the only broken one.Fix
Add
route_pathto the request key resolution (route ?? route_path ?? uri), so requests group asGET /posts/{post}. Unmatched routes (emptyroute_path) still fall back to the bare method. Adds normalization test cases.Follow-up (operational)
normalized_keyis computed at ingest, so existingrequestraw_events are backfilled frompayload->route_pathand the aggregates re-rolled-up after deploy.Verification
hone-server suite: 77 passed. PHPStan: 0 errors. Pint: clean.
🤖 Generated with Claude Code