Skip to content

Deprecate core semantic attribute constants with exact conventions equivalents #24961

Description

@nicohrubec

In getsentry/sentry-javascript, replace internal usages of the remaining public constants in packages/core/src/semanticAttributes.ts that have exact string equivalents in @sentry/conventions/attributes.

Add @deprecated notices pointing to the conventions alternatives, while preserving the existing public exports and their literal values for backwards compatibility. Update imports/usages across source and tests. This is a constant/import cleanup: emitted attribute keys, values, and behavior must remain unchanged.

The following 18 constants have verified 1:1 replacements in conventions 0.25.0:

Existing core constant Conventions export Identical attribute key
SEMANTIC_ATTRIBUTE_SENTRY_OP SENTRY_OP sentry.op
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN SENTRY_ORIGIN sentry.origin
SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE SENTRY_STATUS_MESSAGE sentry.status.message
SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON SENTRY_IDLE_SPAN_FINISH_REASON sentry.idle_span_finish_reason
SEMANTIC_ATTRIBUTE_SENTRY_RELEASE SENTRY_RELEASE sentry.release
SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT SENTRY_ENVIRONMENT sentry.environment
SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS SENTRY_SDK_INTEGRATIONS sentry.sdk.integrations
SEMANTIC_ATTRIBUTE_USER_ID USER_ID user.id
SEMANTIC_ATTRIBUTE_USER_EMAIL USER_EMAIL user.email
SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS USER_IP_ADDRESS user.ip_address
SEMANTIC_ATTRIBUTE_USER_USERNAME USER_NAME user.name
SEMANTIC_ATTRIBUTE_PROFILE_ID SENTRY_PROFILE_ID sentry.profile_id
SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME SENTRY_EXCLUSIVE_TIME sentry.exclusive_time
SEMANTIC_ATTRIBUTE_CACHE_HIT CACHE_HIT cache.hit
SEMANTIC_ATTRIBUTE_CACHE_KEY CACHE_KEY cache.key
SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE CACHE_ITEM_SIZE cache.item_size
SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD HTTP_REQUEST_METHOD http.request.method
GEN_AI_CONVERSATION_ID_ATTRIBUTE GEN_AI_CONVERSATION_ID gen_ai.conversation.id

Keep the five already-deprecated core exports (segment name/ID, SDK name/version, and URL full) compatible. The link-type constant is already handled in #24958.

Leave constants without exact string equivalents unchanged: sentry.sample_rate, sentry.previous_trace_sample_rate, sentry.measurement_unit, sentry.measurement_value, and sentry.custom_span_name. In particular, SENTRY_CLIENT_SAMPLE_RATE resolves to sentry.client_sample_rate, so it is not a 1:1 replacement for sentry.sample_rate.

Verify that emitted attributes and public exports remain compatible, and check bundle size impact. Follow #22081 for the existing deprecation/import migration pattern.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TaskjavascriptPull requests that update javascript code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions