feat(search-attributes): Add search attribute names - #610
Conversation
Emit typed search name constants from aliases, leftover keys, and deprecation-chain names so consumers do not hardcode search strings. Co-authored-by: Cursor <cursoragent@cursor.com>
Regenerate the JS package so search name constants and AttributeSearchName are available to consumers. Co-authored-by: Cursor <cursoragent@cursor.com>
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Names
Other
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
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 e8e14cb. Configure here.
…tribute-names # Conflicts: # javascript/sentry-conventions/src/attributes.ts
| .replaceAll('_', '__') | ||
| .replaceAll('.', '_') |
There was a problem hiding this comment.
So this is pretty pedantic but could we consider flipping these?
| .replaceAll('_', '__') | |
| .replaceAll('.', '_') | |
| .replaceAll('_', '_') | |
| .replaceAll('.', '__') |
. separates a level, and _ separates a multi-word name inside that level. So . is a "heavier" split than _. I think the constants read better if names stay closer together - so e.g. keep "step functions" together as SEARCH_AWS__STEP_FUNCTIONS__ACTIVITY__ARN instead of SEARCH_AWS_STEP__FUNCTIONS_ACTIVITY_ARN.
FWIW this also would make it align with Relay.
There was a problem hiding this comment.
Sounds good to me!
|
|
||
| function stripSentrySearchPrefix(searchKey: string): string { | ||
| const prefix = 'sentry.'; | ||
| return searchKey.startsWith(prefix) ? searchKey.slice(prefix.length) : searchKey; |
There was a problem hiding this comment.
TBH I think I'd rather handle these by putting search aliases on the attributes instead of a blanket policy here - having this enforced by the code generator feels like the wrong place compared to the model JSON 👀

Description
Generate typed
SEARCH_*constants for Sentry search names so consumers can avoid hardcoded strings, and publish the search-specific API from its own module:What changed
AttributeSearchName, search metadata types, andATTRIBUTE_SEARCH_METADATAinto a dedicatedsearch.tsfile instead ofattributes.ts.@sentry/conventions/attributes/searchpackage export, build entry, and compatibility shims for older bundlers and TypeScript resolvers.SEARCH_TRANSACTION = 'transaction'.sentry.in generated search names, sosentry.transactionandtransactionproduce onlySEARCH_TRANSACTION = 'transaction'.canonicalNameanddeprecationChainmetadata without exposing duplicate_SEARCH_*constants.ai.model_idandai.model.idcannot collide.ATTRIBUTE_SEARCH_METADATAkeyed bysearch_alias.name ?? attribute.key.Test plan
yarn test:js— 9,224 tests passyarn lint:types:jsyarn lint:jsyarn build:js@sentry/conventions/attributes/search