feat(nestjs): Emit low cardinality @OnEvent function span name - #24588
Merged
Merged
Conversation
Contributor
size-limit report 📦
|
Lms24
marked this pull request as ready for review
September 22, 2026 12:13
Lms24
requested review from
nicohrubec and
s1gr1d
and removed request for
a team
September 22, 2026 12:13
Lms24
force-pushed
the
fix/nestjs-function-span-names
branch
from
September 22, 2026 16:06
267138b to
12100c6
Compare
function conventions for @OnEvent span names@OnEvent function span name
andreiborza
approved these changes
Sep 23, 2026
JPeer264
approved these changes
Sep 23, 2026
| name: `event ${event}`, | ||
| // With span streaming, a `function` span is named after what it wraps. An `@OnEvent` handler is | ||
| // identified by the event it listens to, so that doubles as its `code.function.name`. | ||
| name: isStreamed ? event : description, |
Member
There was a problem hiding this comment.
l: Should we maybe keep one test for transactions? (not a blocker for this PR)
Member
Author
There was a problem hiding this comment.
yup, we probably should. let me follow up with a test
chargome
approved these changes
Sep 23, 2026
The `@OnEvent` handler span was named `event <name>` and set no `code.function.name`, so the `event ` prefix was derivable from nothing and Relay could infer no description at all for it. Both the name and the description conventions for the `function` op are built from `code.function.name`. Name the span after the event the handler listens to and set that as `code.function.name`. The event is the closest thing to an identity the SDK has for an `@OnEvent` handler, and it is what made the old name useful. The prefixed name moves to `sentry.description`, matching what the bullmq helper next to it already does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Lms24
force-pushed
the
fix/nestjs-function-span-names
branch
from
September 23, 2026 07:01
12100c6 to
5010864
Compare
47 tasks
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.
The
@OnEventhandler span was namedevent <name>and set nocode.function.nameat all. Both the name and the description conventions for thefunctionop are built from that attribute, so theeventprefix came from nowhere the conventions know about and Relay inferred no description for these spans. Cardinality was never the issue here — event names come from decorator metadata — the shape was.The span is now named after the event the handler listens to, with that set as
code.function.name; the prefixed name moves tosentry.descriptionon the streaming branch. This mirrors the bullmq helper directly below it, which already handled both lifecycles this way. Note that these spans areforceTransaction: true, so this changes the segment name (andsentry.segment.name) for event handlers —event myEvent.passbecomesmyEvent.pass.🤖 Generated with Claude Code