fix: classify non-mcp /api/* requests as 'other', not 'docs'#695
Open
MattewGraham wants to merge 2 commits into
Open
fix: classify non-mcp /api/* requests as 'other', not 'docs'#695MattewGraham wants to merge 2 commits into
MattewGraham wants to merge 2 commits into
Conversation
|
@MattewGraham is attempting to deploy a commit to the Tempo Team on Vercel. A member of the Team first needs to authorize it. |
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.
Stop counting non-MCP
/api/*requests as documentation trafficclassifyDocsRequestpowers the server-side analytics that tell us which AIagents and crawlers hit the docs. Right now it quietly files a chunk of
plain application traffic under the
docssurface, which skews every reportbuilt on top of it.
Where it goes wrong
classifySurfacespecial-cases/api/mcp, then falls through toisDocsPage:/api/og,/api/feedback,/api/faucet,/api/index-supplyall have anextensionless last segment, so they’re labelled
surface: 'docs'. From there:facebookexternalhit(UA withoutmozilla/5.0) trips theunknown_uabranch and is recorded as anunknown_aidocs view;POST /api/faucetis recorded as adeveloper_tooldocsrequest.
The
DocsRequestSurfacedocblock already says unrelated APIs belong inother— the classifier just never enforced it.Change
One guard, right after the existing
/api/mcpcheck:MCP keeps its dedicated surface; everything else under
/api/becomesother, which is excluded from agent-surface tracking. Added a regressioncase (
/api/og→surface: 'other',shouldTrack: false) to thetable-driven classifier tests.
Checks
pnpm check:typespasses. New case added toe2e/docs-request-classifier.test.ts.