Skip to content

Commit 226bbcc

Browse files
authored
Merge pull request getsentry#10131 from getsentry/prepare-release/7.93.0
meta: Update CHANGELOG for 7.93.0
2 parents 0f20667 + 0fb8b64 commit 226bbcc

File tree

276 files changed

+4966
-1703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+4966
-1703
lines changed

CHANGELOG.md

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

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

7+
## 7.93.0
8+
9+
### Important Changes
10+
11+
#### Deprecations
12+
13+
As we're moving closer to the next major version of the SDK, more public APIs were deprecated.
14+
15+
To get a head start on migrating to the replacement APIs, please take a look at our
16+
[migration guide](https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md).
17+
18+
- feat(core): Deprecate `getActiveTransaction()` & `scope.getTransaction()` (#10098)
19+
- feat(core): Deprecate `Hub.shouldSendDefaultPii` (#10062)
20+
- feat(core): Deprecate `new Transaction()` (#10125)
21+
- feat(core): Deprecate `scope.getSpan()` & `scope.setSpan()` (#10114)
22+
- feat(core): Deprecate `scope.setTransactionName()` (#10113)
23+
- feat(core): Deprecate `span.startChild()` (#10091)
24+
- feat(core): Deprecate `startTransaction()` (#10073)
25+
- feat(core): Deprecate `Transaction.getDynamicSamplingContext` in favor of `getDynamicSamplingContextFromSpan` (#10094)
26+
- feat(core): Deprecate arguments for `startSpan()` (#10101)
27+
- feat(core): Deprecate hub capture APIs and add them to `Scope` (#10039)
28+
- feat(core): Deprecate session APIs on hub and add global replacements (#10054)
29+
- feat(core): Deprecate span `name` and `description` (#10056)
30+
- feat(core): Deprecate span `tags`, `data`, `context` & setters (#10053)
31+
- feat(core): Deprecate transaction metadata in favor of attributes (#10097)
32+
- feat(core): Deprecate `span.sampled` in favor of `span.isRecording()` (#10034)
33+
- ref(node-experimental): Deprecate `lastEventId` on scope (#10093)
34+
35+
#### Cron Monitoring Support for `node-schedule` library
36+
37+
This release adds auto instrumented check-ins for the `node-schedule` library.
38+
39+
```ts
40+
import * as Sentry from '@sentry/node';
41+
import * as schedule from 'node-schedule';
42+
43+
const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule);
44+
45+
const job = scheduleWithCheckIn.scheduleJob('my-cron-job', '* * * * *', () => {
46+
console.log('You will see this message every minute');
47+
});
48+
```
49+
50+
- feat(node): Instrumentation for `node-schedule` library (#10086)
51+
52+
### Other Changes
53+
54+
- feat(core): Add `span.spanContext()` (#10037)
55+
- feat(core): Add `spanToJSON()` method to get span properties (#10074)
56+
- feat(core): Allow to pass `scope` to `startSpan` APIs (#10076)
57+
- feat(core): Allow to pass start/end timestamp for spans flexibly (#10060)
58+
- feat(node): Make `getModuleFromFilename` compatible with ESM (#10061)
59+
- feat(replay): Update rrweb to 2.7.3 (#10072)
60+
- feat(utils): Add `parameterize` function (#9145)
61+
- fix(astro): Use correct package name for CF (#10099)
62+
- fix(core): Do not run `setup` for integration on client multiple times (#10116)
63+
- fix(core): Ensure we copy passed in span data/tags/attributes (#10105)
64+
- fix(cron): Make name required for instrumentNodeCron option (#10070)
65+
- fix(nextjs): Don't capture not-found and redirect errors in generation functions (#10057)
66+
- fix(node): `LocalVariables` integration should have correct name (#10084)
67+
- fix(node): Anr events should have an `event_id` (#10068)
68+
- fix(node): Revert to only use sync debugger for `LocalVariables` (#10077)
69+
- fix(node): Update ANR min node version to v16.17.0 (#10107)
70+
71+
772
## 7.92.0
873

974
### Important Changes

MIGRATION.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,89 @@ npx @sentry/migr8@latest
88

99
This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!
1010

11+
## Deprecate `Hub`
12+
13+
The `Hub` has been a very important part of the Sentry SDK API up until now.
14+
Hubs were the SDK's "unit of concurrency" to keep track of data across threads and to scope data to certain parts of your code.
15+
Because it is overly complicated and confusing to power users, it is going to be replaced by a set of new APIs: the "new Scope API".
16+
17+
`Scope`s have existed before in the SDK but we are now expanding on them because we have found them powerful enough to fully cover the `Hub` API.
18+
19+
If you are using the `Hub` right now, see the following table on how to migrate to the new API:
20+
21+
| Old `Hub` API | New `Scope` API |
22+
| --- | --- |
23+
| `new Hub()` | `withScope()`, `withIsolationScope()` or `new Scope()` |
24+
| hub.isOlderThan() | REMOVED - Was used to compare `Hub` instances, which are gonna be removed |
25+
| hub.bindClient() | A combination of `scope.setClient()` and `client.setupIntegrations()` |
26+
| hub.pushScope() | `Sentry.withScope()` |
27+
| hub.popScope() | `Sentry.withScope()` |
28+
| hub.withScope() | `Sentry.withScope()` |
29+
| getClient() | `Sentry.getClient()` |
30+
| getScope() | `Sentry.getCurrentScope()` to get the currently active scope |
31+
| getIsolationScope() | `Sentry.getIsolationScope()` |
32+
| getStack() | REMOVED - The stack used to hold scopes. Scopes are used directly now |
33+
| getStackTop() | REMOVED - The stack used to hold scopes. Scopes are used directly now |
34+
| captureException() | `Sentry.captureException()` |
35+
| captureMessage() | `Sentry.captureMessage()` |
36+
| captureEvent() | `Sentry.captureEvent()` |
37+
| lastEventId() | REMOVED - Use event processors or beforeSend instead |
38+
| addBreadcrumb() | `Sentry.addBreadcrumb()` |
39+
| setUser() | `Sentry.setUser()` |
40+
| setTags() | `Sentry.setTags()` |
41+
| setExtras() | `Sentry.setExtras()` |
42+
| setTag() | `Sentry.setTag()` |
43+
| setExtra() | `Sentry.setExtra()` |
44+
| setContext() | `Sentry.setContext()` |
45+
| configureScope() | REMOVED - Scopes are now the unit of concurrency |
46+
| run() | `Sentry.withScope()` or `Sentry.withIsolationScope()` |
47+
| getIntegration() | `client.getIntegration()` |
48+
| startTransaction() | `Sentry.startSpan()`, `Sentry.startInactiveSpan()` or `Sentry.startSpanManual()` |
49+
| traceHeaders() | REMOVED - The closest equivalent is now `spanToTraceHeader(getActiveSpan())` |
50+
| captureSession() | `Sentry.captureSession()` |
51+
| startSession() | `Sentry.startSession()` |
52+
| endSession() | `Sentry.endSession()` |
53+
| shouldSendDefaultPii() | REMOVED - The closest equivalent is `Sentry.getClient().getOptions().sendDefaultPii` |
54+
55+
## Deprecate `scope.getSpan()` and `scope.setSpan()`
56+
57+
Instead, you can get the currently active span via `Sentry.getActiveSpan()`.
58+
Setting a span on the scope happens automatically when you use the new performance APIs `startSpan()` and `startSpanManual()`.
59+
60+
## Deprecate `scope.setTransactionName()`
61+
62+
Instead, either set this as attributes or tags, or use an event processor to set `event.transaction`.
63+
64+
## Deprecate `scope.getTransaction()` and `getActiveTransaction()`
65+
66+
Instead, you should not rely on the active transaction, but just use `startSpan()` APIs, which handle this for you.
67+
68+
## Deprecate arguments for `startSpan()` APIs
69+
70+
In v8, the API to start a new span will be reduced from the currently available options.
71+
Going forward, only these argument will be passable to `startSpan()`, `startSpanManual()` and `startInactiveSpan()`:
72+
73+
* `name`
74+
* `attributes`
75+
* `origin`
76+
* `op`
77+
* `startTime`
78+
* `scope`
79+
80+
## Deprecate `startTransaction()` & `span.startChild()`
81+
82+
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
83+
Instead, use the new performance APIs:
84+
85+
* `startSpan()`
86+
* `startSpanManual()`
87+
* `startInactiveSpan()`
88+
89+
You can [read more about the new performance APIs here](./docs/v8-new-performance-apis.md).
90+
1191
## Deprecate `Sentry.lastEventId()` and `hub.lastEventId()`
1292

13-
`Sentry.lastEventId()` sometimes causes race conditons, so we are deprecating it in favour of the `beforeSend` callback.
93+
`Sentry.lastEventId()` sometimes causes race conditions, so we are deprecating it in favour of the `beforeSend` callback.
1494

1595
```js
1696
// Before
@@ -46,6 +126,19 @@ In v8, the Span class is heavily reworked. The following properties & methods ar
46126
* `span.setName(newName)`: Use `span.updateName(newName)` instead.
47127
* `span.toTraceparent()`: use `spanToTraceHeader(span)` util instead.
48128
* `span.getTraceContext()`: Use `spanToTraceContext(span)` utility function instead.
129+
* `span.sampled`: Use `span.isRecording()` instead.
130+
* `span.spanId`: Use `span.spanContext().spanId` instead.
131+
* `span.traceId`: Use `span.spanContext().traceId` instead.
132+
* `span.name`: Use `spanToJSON(span).description` instead.
133+
* `span.description`: Use `spanToJSON(span).description` instead.
134+
* `span.getDynamicSamplingContext`: Use `getDynamicSamplingContextFromSpan` utility function instead.
135+
* `transaction.setMetadata()`: Use attributes instead, or set data on the scope.
136+
* `transaction.metadata`: Use attributes instead, or set data on the scope.
137+
* `span.tags`: Set tags on the surrounding scope instead, or use attributes.
138+
* `span.data`: Use `spanToJSON(span).data` instead.
139+
* `span.setTag()`: Use `span.setAttribute()` instead or set tags on the surrounding scope.
140+
* `span.setData()`: Use `span.setAttribute()` instead.
141+
* `transaction.setContext()`: Set context on the surrounding scope instead.
49142

50143
## Deprecate `pushScope` & `popScope` in favor of `withScope`
51144

dev-packages/browser-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"dependencies": {
4646
"@babel/preset-typescript": "^7.16.7",
4747
"@playwright/test": "^1.31.1",
48-
"@sentry-internal/rrweb": "2.6.0",
48+
"@sentry-internal/rrweb": "2.7.3",
4949
"@sentry/browser": "7.92.0",
5050
"@sentry/tracing": "7.92.0",
5151
"axios": "1.6.0",

dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,62 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
66

7-
sentryTest('captures Breadcrumb for clicks & debounces them for a second', async ({ getLocalTestUrl, page }) => {
8-
const url = await getLocalTestUrl({ testDir: __dirname });
9-
10-
await page.route('**/foo', route => {
11-
return route.fulfill({
12-
status: 200,
13-
body: JSON.stringify({
14-
userNames: ['John', 'Jane'],
15-
}),
16-
headers: {
17-
'Content-Type': 'application/json',
18-
},
7+
sentryTest(
8+
'captures Breadcrumb for clicks & debounces them for a second',
9+
async ({ getLocalTestUrl, page, browserName }) => {
10+
sentryTest.skip(browserName === 'chromium', 'This consistently flakes on chrome.');
11+
12+
const url = await getLocalTestUrl({ testDir: __dirname });
13+
14+
await page.route('**/foo', route => {
15+
return route.fulfill({
16+
status: 200,
17+
body: JSON.stringify({
18+
userNames: ['John', 'Jane'],
19+
}),
20+
headers: {
21+
'Content-Type': 'application/json',
22+
},
23+
});
1924
});
20-
});
21-
22-
const promise = getFirstSentryEnvelopeRequest<Event>(page);
23-
24-
await page.goto(url);
25-
26-
await page.click('#button1');
27-
// not debounced because other target
28-
await page.click('#button2');
29-
// This should be debounced
30-
await page.click('#button2');
31-
32-
// Wait a second for the debounce to finish
33-
await page.waitForTimeout(1000);
34-
await page.click('#button2');
35-
36-
const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]);
37-
38-
expect(eventData.exception?.values).toHaveLength(1);
39-
40-
expect(eventData.breadcrumbs).toEqual([
41-
{
42-
timestamp: expect.any(Number),
43-
category: 'ui.click',
44-
message: 'body > button#button1[type="button"]',
45-
},
46-
{
47-
timestamp: expect.any(Number),
48-
category: 'ui.click',
49-
message: 'body > button#button2[type="button"]',
50-
},
51-
{
52-
timestamp: expect.any(Number),
53-
category: 'ui.click',
54-
message: 'body > button#button2[type="button"]',
55-
},
56-
]);
57-
});
25+
26+
const promise = getFirstSentryEnvelopeRequest<Event>(page);
27+
28+
await page.goto(url);
29+
30+
await page.click('#button1');
31+
// not debounced because other target
32+
await page.click('#button2');
33+
// This should be debounced
34+
await page.click('#button2');
35+
36+
// Wait a second for the debounce to finish
37+
await page.waitForTimeout(1000);
38+
await page.click('#button2');
39+
40+
const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]);
41+
42+
expect(eventData.exception?.values).toHaveLength(1);
43+
44+
expect(eventData.breadcrumbs).toEqual([
45+
{
46+
timestamp: expect.any(Number),
47+
category: 'ui.click',
48+
message: 'body > button#button1[type="button"]',
49+
},
50+
{
51+
timestamp: expect.any(Number),
52+
category: 'ui.click',
53+
message: 'body > button#button2[type="button"]',
54+
},
55+
{
56+
timestamp: expect.any(Number),
57+
category: 'ui.click',
58+
message: 'body > button#button2[type="button"]',
59+
},
60+
]);
61+
},
62+
);
5863

5964
sentryTest(
6065
'uses the annotated component name in the breadcrumb messages and adds it to the data object',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sentry.captureMessage('a');
2+
3+
Sentry.captureException(new Error('test_simple_breadcrumb_error'));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers';
6+
7+
sentryTest(
8+
'should capture recorded transactions as breadcrumbs for the following event sent',
9+
async ({ getLocalTestPath, page }) => {
10+
const url = await getLocalTestPath({ testDir: __dirname });
11+
12+
const events = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url });
13+
14+
const errorEvent = events.find(event => event.exception?.values?.[0].value === 'test_simple_breadcrumb_error')!;
15+
16+
expect(errorEvent.breadcrumbs).toHaveLength(1);
17+
expect(errorEvent.breadcrumbs?.[0]).toMatchObject({
18+
category: 'sentry.event',
19+
event_id: expect.any(String),
20+
level: expect.any(String),
21+
});
22+
},
23+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Sentry.captureEvent({
2+
event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2',
3+
message: 'someMessage',
4+
transaction: 'wat',
5+
type: 'transaction',
6+
});
7+
8+
Sentry.captureException(new Error('test_simple_breadcrumb_error'));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers';
6+
7+
sentryTest(
8+
'should capture recorded transactions as breadcrumbs for the following event sent',
9+
async ({ getLocalTestPath, page }) => {
10+
const url = await getLocalTestPath({ testDir: __dirname });
11+
12+
const events = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url });
13+
14+
const errorEvent = events.find(event => event.exception?.values?.[0].value === 'test_simple_breadcrumb_error')!;
15+
16+
expect(errorEvent.breadcrumbs).toHaveLength(1);
17+
expect(errorEvent.breadcrumbs?.[0]).toMatchObject({
18+
category: 'sentry.transaction',
19+
message: expect.any(String),
20+
});
21+
},
22+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { parameterize } from '@sentry/utils';
2+
3+
const x = 'first';
4+
const y = 'second';
5+
6+
Sentry.captureMessage(parameterize`This is a log statement with ${x} and ${y} params`);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
7+
sentryTest('should capture a parameterized representation of the message', async ({ getLocalTestPath, page }) => {
8+
const bundle = process.env.PW_BUNDLE;
9+
10+
if (bundle && bundle.startsWith('bundle_')) {
11+
sentryTest.skip();
12+
}
13+
14+
const url = await getLocalTestPath({ testDir: __dirname });
15+
16+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
17+
18+
expect(eventData.logentry).toStrictEqual({
19+
message: 'This is a log statement with %s and %s params',
20+
params: ['first', 'second'],
21+
});
22+
});

0 commit comments

Comments
 (0)