Skip to content

Expose top-level Sentry.setAttribute / Sentry.setAttributes for API parity with core #6350

Description

@antonis

@sentry/core 10.61.0 added top-level Sentry.setAttribute(key, value) and Sentry.setAttributes(attrs) APIs (getsentry/sentry-javascript#21705). The RN SDK re-exports core via an explicit allowlist (packages/core/src/js/index.ts), so these are not currently exposed to RN users.

This is a low-priority parity enhancement, not a bug — RN users can already call getCurrentScope().setAttribute(...), which works and syncs to native today.

Why it's safe/cheap: the new functions delegate to getIsolationScope().setAttribute(s), and RN already patches the isolation scope (enableSyncToNative(getIsolationScope()) in sdk.tsx) to forward primitive attributes to native. So exposing them gets native scope-sync for free — no extra wiring.

Scope of work:

  • Add setAttribute, setAttributes to the export { … } from '@sentry/core' block in packages/core/src/js/index.ts
  • Regenerate API report (yarn build:sdk && yarn api-report)
  • Add a test asserting Sentry.setAttribute('k', 'v') forwards to NATIVE.setAttribute (isolation-scope → native path)
  • CHANGELOG entry
  • Note: only primitive values sync to native (existing scopeSync behavior)

Activity

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions