feat: Mirror SDK-set tags to scope attributes - #23878
Conversation
Tags the SDK sets itself only reach error events. Setting the same key as a scope attribute makes them available on logs, metrics and streamed spans too, following the pattern established for the nextjs turbopack tag in #20558. Covers the turbopack tag on the nextjs client (server and edge already did this), the react-router runtime tag, the aws-serverless timeout tag and the vercel-ai tool error tags. Tags written directly to event.tags are not covered, as the Event type has no attributes field to mirror them into. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4psoVcy916Mi8aZLPAF15
|
bugbot run |
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.
Reviewed by Cursor Bugbot for commit 3988407. Configure here.
| it('sets the runtime attribute to browser', () => { | ||
| reactRouterInit({}); | ||
| expect(setAttribute).toHaveBeenCalledWith('runtime', 'browser'); | ||
| }); |
There was a problem hiding this comment.
Feat PR lacks integration tests
Low Severity
This feat PR only adds unit tests that assert setAttribute was called. The project review rules ask feat PRs to include at least one integration or E2E test, and that tests cover the new behaviour on sent payloads. Several new call sites also have no coverage, so it is not verified that the mirrored attributes actually reach logs, metrics, or streamed spans. Flagged because that requirement is in the review rules file.
Additional Locations (1)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 3988407. Configure here.
size-limit report 📦
|
|
hmm the issue with this is that attributes on scopes are also applied to logs and metrics. Which is a billing concern. I know I said this differently just a minute ago but maybe we just don't convert these tags to attributes. I don't see them as really necessary tbh. If they are necessary, we likely need to set them in span processing hook instead to omit it from logs and metrics |


Duplicates tags the SDK sets itself onto scope attributes, so they also reach logs, metrics and streamed spans.