Skip to content

Exclude routeless requests from slow endpoint ranking#21

Merged
edgrosvenor merged 1 commit into
mainfrom
fix-exclude-routeless-slow-requests
Jun 16, 2026
Merged

Exclude routeless requests from slow endpoint ranking#21
edgrosvenor merged 1 commit into
mainfrom
fix-exclude-routeless-slow-requests

Conversation

@edgrosvenor

Copy link
Copy Markdown
Contributor

Problem

In the live demo, the slowest HTTP endpoint by p95 was answered as just GET with no route.

Root cause (confirmed against the live aggregates table): the 598fa56 normalizer fix is deployed and working — real routes key correctly (GET /posts/{post}, POST /livewire/update). But requests that don't match a route have an empty route_path, so the normalizer collapses them to the bare method GET. On artisan.build that bucket is 100% HTTP 404s — bot/vuln scans (wp-admin/*, actuator/env, joomla.xml, sitemap.xml, …). ~172 of them today lump into one GET bucket whose p95 (~2,896 ms) outranks every real route, so it surfaces as "the slowest endpoint."

It was never stale data or the key fix failing — routeless 404 traffic was being ranked as an endpoint.

Fix

Query-layer change (no data migration needed — stale/ongoing GET buckets simply stop being ranked):

  • AggregateWindow::topOffenders() — opt-in $excludeRouteless that filters to keys containing a space (METHOD /path), dropping bare-method buckets.
  • HandlesSlowMetricTool — overridable excludesRoutelessKeys() (default false, so slow queries/jobs/outgoing are unaffected).
  • SlowRequestsTool — overrides it to true.

After deploy, slow_requests returns the slowest real route. The 404 traffic stays stored for error telemetry; it just no longer masquerades as an endpoint.

Tests

Added two tests (routeless excluded for requests; routeless still ranked for non-request metrics). Full McpMetricToolsTest green (32 passed), Pint clean.

🤖 Generated with Claude Code

Unmatched requests (e.g. 404 scanner traffic) have an empty route_path,
so the normalizer collapses them to a bare HTTP method key like "GET".
On busy sites that single bucket aggregates large volumes of unrelated
URLs, and its inflated p95 dominates the slow_requests ranking, so the
slowest "endpoint" reads as just the verb with no route.

Add an opt-in routeless filter to AggregateWindow::topOffenders that
requires a space in the key (METHOD /path), drop the bare-method buckets,
and have SlowRequestsTool enable it. Other slow tools (queries, jobs,
outgoing) are unaffected. Routeless traffic remains stored for error
telemetry; it just no longer masquerades as an endpoint.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@edgrosvenor edgrosvenor merged commit 4d6b02d into main Jun 16, 2026
3 checks passed
@edgrosvenor edgrosvenor deleted the fix-exclude-routeless-slow-requests branch June 16, 2026 20:25
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