feat(core): emit low cardinality request handler span names - #23614
Draft
isaacs wants to merge 3 commits into
Draft
feat(core): emit low cardinality request handler span names#23614isaacs wants to merge 3 commits into
isaacs wants to merge 3 commits into
Conversation
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3bf00a6. Configure here.
Contributor
size-limit report 📦
|
isaacs
force-pushed
the
isaacs/low-cardinality-request-handler-span-names
branch
from
August 26, 2026 03:19
3bf00a6 to
3293c93
Compare
Name `handler` spans after the route they serve when span streaming is enabled, or `Request handler` if no route set. Static mode left as is. Drop Hapi method, as the template dictates. NestJS resolves no route when the span starts. The NestJS callback name stays on `nestjs.callback`. Elysia sets `context.route` when the request enters the compiled handler, which is before the `Handle` phase reports. Read it in the trace listener so streamed handler spans carry the route instead of the `Request handler` fallback. The fallback now applies only when the context has no route. Set `code.function.name` only on the child spans this renames, and only when the handler has a name. Static mode keeps the handler name in the span name, so the attribute adds nothing there, and an anonymous handler has no name to record. Register the Fastify test route from a plugin. Fastify installs the SDK's `onRoute` hook when it flushes its plugin list, which is after root-level routes are in place. A root-level route therefore produces no route handler span, and the test never reached that code path. Also: correct `REQUEST_HANDLER_SPAN_NAME_FALLBACK`: the conventions spell the fallback `Request handler`, and its `@see` link pointed at the resource section. closes #23533 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
isaacs
force-pushed
the
isaacs/low-cardinality-request-handler-span-names
branch
from
August 26, 2026 03:20
3293c93 to
7673348
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7673348. Configure here.
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.

Name
handlerspans after the route they serve when span streaming is enabled, orRequest handlerif no route set. Static mode left as is.Drop Hapi method, as the template dictates. NestJS resolves no route when the span starts. The NestJS callback name stays on
nestjs.callback.Elysia sets
context.routewhen the request enters the compiled handler, which is before theHandlephase reports. Read it in the trace listener so streamed handler spans carry the route instead of theRequest handlerfallback. The fallback now applies only when the context has no route.Set
code.function.nameonly on the child spans this renames, and only when the handler has a name. Static mode keeps the handler name in the span name, so the attribute adds nothing there, and an anonymous handler has no name to record.Register the Fastify test route from a plugin. Fastify installs the SDK's
onRoutehook when it flushes its plugin list, which is after root-level routes are in place. A root-level route therefore produces no route handler span, and the test never reached that code path.Also: correct
REQUEST_HANDLER_SPAN_NAME_FALLBACK: the conventions spell the fallbackRequest handler, and its@seelink pointed at the resource section.closes #23533