Skip to content

Commit ea3a45f

Browse files
authored
chore(changelog): Add entry for scope attributes (#18555)
Forgot to add a changelog entry in #18184 and didn't want to rerun CI again because I was fighting it since yesterday. This PR also reformats the existing entries so that the paragraphs about the important changes are indented correctly. Closes #18557 (added automatically)
1 parent 8da7295 commit ea3a45f

File tree

1 file changed

+46
-27
lines changed

1 file changed

+46
-27
lines changed

CHANGELOG.md

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,63 @@
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 logs** ([18184](https://github.com/getsentry/sentry-javascript/pull/18184))
8+
9+
You can now set attributes on the SDK's scopes which will be applied to all logs 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.geGlobalScope().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.logger.info(`user ${user.id} logged in`, { activeSince: 100 });
19+
Sentry.logger.info(`updated ${user.id} last activity`);
20+
});
21+
22+
// scope attributes `is_admin` and `auth_provider` are added
23+
Sentry.logger.warn('stale website version, reloading page');
24+
```
25+
726
- **feat(vue): Add TanStack Router integration ([#18359](https://github.com/getsentry/sentry-javascript/pull/18359))**
827

9-
The `@sentry/vue` package now includes support for TanStack Router. Use `tanstackRouterBrowserTracingIntegration` to automatically instrument pageload and navigation transactions with parameterized routes:
28+
The `@sentry/vue` package now includes support for TanStack Router. Use `tanstackRouterBrowserTracingIntegration` to automatically instrument pageload and navigation transactions with parameterized routes:
1029

11-
```javascript
12-
import { createApp } from 'vue';
13-
import { createRouter } from '@tanstack/vue-router';
14-
import * as Sentry from '@sentry/vue';
15-
import { tanstackRouterBrowserTracingIntegration } from '@sentry/vue/tanstackrouter';
30+
```javascript
31+
import { createApp } from 'vue';
32+
import { createRouter } from '@tanstack/vue-router';
33+
import * as Sentry from '@sentry/vue';
34+
import { tanstackRouterBrowserTracingIntegration } from '@sentry/vue/tanstackrouter';
1635

17-
const router = createRouter({
18-
// your router config
19-
});
36+
const router = createRouter({
37+
// your router config
38+
});
2039

21-
Sentry.init({
22-
app,
23-
dsn: '__PUBLIC_DSN__',
24-
integrations: [tanstackRouterBrowserTracingIntegration(router)],
25-
tracesSampleRate: 1.0,
26-
});
27-
```
40+
Sentry.init({
41+
app,
42+
dsn: '__PUBLIC_DSN__',
43+
integrations: [tanstackRouterBrowserTracingIntegration(router)],
44+
tracesSampleRate: 1.0,
45+
});
46+
```
2847

2948
- **feat(nextjs): Add tree-shaking configuration to `webpack` build config ([#18359](https://github.com/getsentry/sentry-javascript/pull/18359))**
3049

3150
- **feat(replay): Add Request body with `attachRawBodyFromRequest` option ([#18501](https://github.com/getsentry/sentry-javascript/pull/18501))**
3251

33-
To attach the raw request body (from `Request` objects passed as the first `fetch` argument) to replay events,
34-
you can now use the `attachRawBodyFromRequest` option in the Replay integration:
52+
To attach the raw request body (from `Request` objects passed as the first `fetch` argument) to replay events,
53+
you can now use the `attachRawBodyFromRequest` option in the Replay integration:
3554

36-
```js
37-
Sentry.init({
38-
integrations: [
39-
Sentry.replayIntegration({
40-
attachRawBodyFromRequest: true,
41-
}),
42-
],
43-
});
44-
```
55+
```js
56+
Sentry.init({
57+
integrations: [
58+
Sentry.replayIntegration({
59+
attachRawBodyFromRequest: true,
60+
}),
61+
],
62+
});
63+
```
4564

4665
## 10.31.0
4766

0 commit comments

Comments
 (0)