Skip to content

perf(js): Make attribute descriptions tree-shakeable - #562

Open
scttcper wants to merge 5 commits into
mainfrom
scttcper/split-attribute-metadata
Open

perf(js): Make attribute descriptions tree-shakeable#562
scttcper wants to merge 5 commits into
mainfrom
scttcper/split-attribute-metadata

Conversation

@scttcper

@scttcper scttcper commented Aug 7, 2026

Copy link
Copy Markdown
Member

Sentry only uses the browser name and version descriptions in its frontend, but reading them from ATTRIBUTE_METADATA pulls in the entire table.

This moves documentation fields to an opt-in entry and adds named brief exports:

import {
  BROWSER_NAME_BRIEF,
  BROWSER_VERSION_BRIEF,
} from "@sentry/conventions/attributes/documentation";

With Rspack, that Sentry import drops from 240,110 bytes minified to 93 bytes. ATTRIBUTE_DOCUMENTATION remains available for build-time tooling that needs every description.

ATTRIBUTE_METADATA mixes runtime fields with descriptions, examples, and changelogs, making metadata consumers ship about 43 KB gzip.

Add focused metadata and documentation subpaths while leaving the existing attributes export alone. The runtime entry is about 11.5 KB gzip and constant imports still tree-shake down to basically nothing.

Co-Authored-By: Codex <noreply@openai.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Internal Changes 🔧

  • (js) Make attribute descriptions tree-shakeable by scttcper in #562

🤖 This preview updates automatically when you update the PR.

scttcper and others added 2 commits August 7, 2026 14:53
The first pass kept a full compatibility copy, so existing metadata imports stayed at 43 KB and the generated data was duplicated.

Make ATTRIBUTE_METADATA runtime-only at the existing entry point and keep the documentation fields exclusively in ATTRIBUTE_DOCUMENTATION. This is the actual split.

Co-Authored-By: Codex <noreply@openai.com>
ATTRIBUTE_METADATA is already runtime-only at the existing attributes entry, so the extra metadata subpath is just another spelling and generated shim.

Remove it and keep the split to attributes plus attributes/documentation.

Co-Authored-By: Codex <noreply@openai.com>
@scttcper
scttcper marked this pull request as ready for review August 7, 2026 22:05
@scttcper
scttcper requested review from a team, Lms24, cleptric, mjq and nsdeschenes as code owners August 7, 2026 22:05
},
'ai.response_format': {
brief: 'For an AI model call, the format of the response',

@scttcper scttcper Aug 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we probably want the brief

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 e8f9572. Configure here.

"./attributes/documentation": {
"import": "./dist/attributeDocumentation.mjs",
"require": "./dist/attributeDocumentation.cjs"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing legacy documentation export shims

Low Severity

The new @sentry/conventions/attributes/documentation export is only wired through package.json exports, with no root compatibility shims like attributes and op already have. Tooling that ignores exports (for example webpack 4 or older TypeScript) cannot resolve the documented import path.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e8f9572. Configure here.

Sentry only reads the browser name and version descriptions in the frontend, but accessing them through ATTRIBUTE_METADATA pulls in the entire table.

Export per-attribute brief strings from the documentation entry. The same Rspack import drops from 240 KB minified to 93 bytes.

Co-Authored-By: Codex <noreply@openai.com>
@scttcper scttcper changed the title perf(js): Split runtime attribute metadata perf(js): Make attribute descriptions tree-shakeable Aug 7, 2026
Co-Authored-By: Codex <noreply@openai.com>

# Conflicts:
#	javascript/sentry-conventions/src/attributes.ts
@scttcper

scttcper commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

i'm not sure this is the right way to go

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