Skip to content

Commit 8124f8f

Browse files
committed
add changelog note
1 parent a6c72b1 commit 8124f8f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
- **feat(core): Apply scope attributes to metrics ([#18738](https://github.com/getsentry/sentry-javascript/pull/18738))**
8+
9+
You can now set attributes on the SDK's scopes which will be applied to all metrics as long as the respective scopes are active. For the time being, only `string`, `number` and `boolean` attribute values are supported.
10+
11+
```ts
12+
Sentry.getGlobalScope().setAttributes({ is_admin: true, auth_provider: 'google' });
13+
14+
Sentry.withScope(scope => {
15+
scope.setAttribute('step', 'authentication');
16+
17+
// scope attributes `is_admin`, `auth_provider` and `step` are added
18+
Sentry.metrics.count('clicks', 1, { attributes: { activeSince: 100 } });
19+
Sentry.metrics.gauge('timeSinceRefresh', 4, { unit: 'hour' });
20+
});
21+
22+
// scope attributes `is_admin` and `auth_provider` are added
23+
Sentry.metrics.count('response_time', 283.33, { unit: 'millisecond' });
24+
```
25+
726
Work in this release was contributed by @xgedev, @Mohataseem89, @sebws, @G-Rath, and @gianpaj. Thank you for your contributions!
827

928
- ref(nextjs): Drop `resolve` dependency from the Next.js SDK ([#18618](https://github.com/getsentry/sentry-javascript/pull/18618))

0 commit comments

Comments
 (0)