From 3bcf98d61c74acfb743acb06dab85ee3ab823b87 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 25 Jun 2026 16:56:51 +0200 Subject: [PATCH] docs(react-native): Use top-level Sentry.setAttribute / setAttributes The RN SDK now re-exports the top-level `setAttribute`/`setAttributes` from @sentry/core. Update the Scope Attributes example to lead with the ergonomic top-level form, matching the surrounding setTag/setUser docs. Co-Authored-By: Claude Opus 4.8 --- .../react-native/enriching-events/scopes/index.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/platforms/react-native/enriching-events/scopes/index.mdx b/docs/platforms/react-native/enriching-events/scopes/index.mdx index c76596575cdb1..dc6b359e82276 100644 --- a/docs/platforms/react-native/enriching-events/scopes/index.mdx +++ b/docs/platforms/react-native/enriching-events/scopes/index.mdx @@ -138,10 +138,10 @@ Scope attributes are key-value pairs that are automatically included in structur ```javascript // Set a single attribute -Sentry.getIsolationScope().setAttribute("org_id", "abc123"); +Sentry.setAttribute("org_id", "abc123"); // Set multiple attributes at once -Sentry.getIsolationScope().setAttributes({ +Sentry.setAttributes({ user_tier: "premium", request_count: 42, is_admin: true, @@ -151,6 +151,8 @@ Sentry.getIsolationScope().setAttributes({ Sentry.getIsolationScope().removeAttribute("org_id"); ``` +The top-level `Sentry.setAttribute` and `Sentry.setAttributes` methods set data on the isolation scope. You can also call them on a specific scope, for example `Sentry.getIsolationScope().setAttribute(...)`. + Attributes support primitive values: strings, numbers, and booleans. Non-primitive values (objects, arrays, etc.) are not synced to the native layer. You can also set attributes within a specific scope using `withScope`: