Skip to content

Commit 2d8f3ae

Browse files
authored
Merge branch 'develop' into onur/fix-flaky-remix-e2e-tests
2 parents c25aab0 + b67d9b4 commit 2d8f3ae

File tree

43 files changed

+695
-602
lines changed

Some content is hidden

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

43 files changed

+695
-602
lines changed

MIGRATION.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ npx @sentry/migr8@latest
1010
This will let you select which updates to run, and automatically update your code. Make sure to still review all code
1111
changes!
1212

13+
## Deprecate transaction-related options to `BrowserTracing`
14+
15+
When configuring the `BrowserTracing` integration, some options have been renamed:
16+
17+
- `startTransactionOnPageLoad` --> `spanOnPageLoad`
18+
- `startTransactionOnLocationChange` --> `spanOnLocationChange`
19+
- `markBackgroundTransactions` --> `markBackgroundSpan`
20+
21+
Also, `beforeNavigate` is replaced with a `beforeStartSpan` callback, which receives `StartSpanOptions`.
22+
1323
## Deprecate using `getClient()` to check if the SDK was initialized
1424

1525
In v8, `getClient()` will stop returning `undefined` if `Sentry.init()` was not called. For cases where this may be used
@@ -36,6 +46,7 @@ The following list shows how integrations should be migrated:
3646

3747
| Old | New | Packages |
3848
| ------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------- |
49+
| `new BrowserTracing()` | `browserTracingIntegration()` | `@sentry/browser` |
3950
| `new InboundFilters()` | `inboundFiltersIntegration()` | `@sentry/core`, `@sentry/browser`, `@sentry/node`, `@sentry/deno`, `@sentry/bun`, `@sentry/vercel-edge` |
4051
| `new FunctionToString()` | `functionToStringIntegration()` | `@sentry/core`, `@sentry/browser`, `@sentry/node`, `@sentry/deno`, `@sentry/bun`, `@sentry/vercel-edge` |
4152
| `new LinkedErrors()` | `linkedErrorsIntegration()` | `@sentry/core`, `@sentry/browser`, `@sentry/node`, `@sentry/deno`, `@sentry/bun`, `@sentry/vercel-edge` |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"apollo-server": "^3.11.1",
3737
"axios": "^0.27.2",
3838
"cors": "^2.8.5",
39+
"cron": "^3.1.6",
3940
"express": "^4.17.3",
4041
"graphql": "^16.3.0",
4142
"http-terminator": "^3.2.0",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Sentry from '@sentry/node';
2+
import { CronJob } from 'cron';
3+
4+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5+
const CronJobWithCheckIn = Sentry.cron.instrumentCron(CronJob, 'my-cron-job');
6+
7+
setTimeout(() => {
8+
process.exit(0);
9+
}, 1_000);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';
2+
3+
afterAll(() => {
4+
cleanupChildProcesses();
5+
});
6+
7+
test('node-cron types should match', done => {
8+
createRunner(__dirname, 'scenario.ts').ensureNoErrorOutput().start(done);
9+
});

dev-packages/node-integration-tests/utils/runner.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export function createRunner(...paths: string[]) {
7070
const flags: string[] = [];
7171
const ignored: EnvelopeItemType[] = [];
7272
let withSentryServer = false;
73+
let ensureNoErrorOutput = false;
7374

7475
if (testPath.endsWith('.ts')) {
7576
flags.push('-r', 'ts-node/register');
@@ -92,6 +93,10 @@ export function createRunner(...paths: string[]) {
9293
ignored.push(...types);
9394
return this;
9495
},
96+
ensureNoErrorOutput: function () {
97+
ensureNoErrorOutput = true;
98+
return this;
99+
},
95100
start: function (done?: (e?: unknown) => void) {
96101
const expectedEnvelopeCount = expectedEnvelopes.length;
97102

@@ -190,8 +195,19 @@ export function createRunner(...paths: string[]) {
190195

191196
CHILD_PROCESSES.add(child);
192197

198+
if (ensureNoErrorOutput) {
199+
child.stderr.on('data', (data: Buffer) => {
200+
const output = data.toString();
201+
complete(new Error(`Expected no error output but got: '${output}'`));
202+
});
203+
}
204+
193205
child.on('close', () => {
194206
hasExited = true;
207+
208+
if (ensureNoErrorOutput) {
209+
complete();
210+
}
195211
});
196212

197213
// Pass error to done to end the test quickly

packages/astro/src/client/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BrowserOptions } from '@sentry/browser';
22
import {
3-
BrowserTracing,
3+
browserTracingIntegration,
44
getDefaultIntegrations as getBrowserDefaultIntegrations,
55
init as initBrowserSdk,
66
setTag,
@@ -34,7 +34,7 @@ function getDefaultIntegrations(options: BrowserOptions): Integration[] | undefi
3434
// in which case everything inside will get treeshaken away
3535
if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
3636
if (hasTracingEnabled(options)) {
37-
return [...getBrowserDefaultIntegrations(options), new BrowserTracing()];
37+
return [...getBrowserDefaultIntegrations(options), browserTracingIntegration()];
3838
}
3939
}
4040

packages/astro/test/client/sdk.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { BrowserClient } from '@sentry/browser';
1+
import type { BrowserClient, BrowserTracing } from '@sentry/browser';
22
import { getCurrentScope } from '@sentry/browser';
33
import * as SentryBrowser from '@sentry/browser';
4-
import { BrowserTracing, SDK_VERSION, WINDOW, getClient } from '@sentry/browser';
4+
import { SDK_VERSION, WINDOW, browserTracingIntegration, getClient } from '@sentry/browser';
55
import { vi } from 'vitest';
66

77
import { init } from '../../../astro/src/client/sdk';
@@ -103,12 +103,13 @@ describe('Sentry client SDK', () => {
103103
it('Overrides the automatically default BrowserTracing instance with a a user-provided instance', () => {
104104
init({
105105
dsn: 'https://[email protected]/1337',
106-
integrations: [new BrowserTracing({ finalTimeout: 10, startTransactionOnLocationChange: false })],
106+
integrations: [browserTracingIntegration({ finalTimeout: 10, startTransactionOnLocationChange: false })],
107107
enableTracing: true,
108108
});
109109

110110
const integrationsToInit = browserInit.mock.calls[0][0]?.defaultIntegrations;
111111

112+
// eslint-disable-next-line deprecation/deprecation
112113
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing') as BrowserTracing;
113114
const options = browserTracing.options;
114115

packages/browser/src/index.bundle.feedback.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
// This is exported so the loader does not fail when switching off Replay/Tracing
22
import { Feedback, feedbackIntegration } from '@sentry-internal/feedback';
3-
import { BrowserTracing, Replay, addTracingExtensions, replayIntegration } from '@sentry-internal/integration-shims';
3+
import {
4+
BrowserTracing,
5+
Replay,
6+
addTracingExtensions,
7+
browserTracingIntegration,
8+
replayIntegration,
9+
} from '@sentry-internal/integration-shims';
410

511
import * as Sentry from './index.bundle.base';
612

713
// TODO (v8): Remove this as it was only needed for backwards compatibility
814
// eslint-disable-next-line deprecation/deprecation
915
Sentry.Integrations.Replay = Replay;
1016

17+
// eslint-disable-next-line deprecation/deprecation
1118
Sentry.Integrations.BrowserTracing = BrowserTracing;
1219

1320
export * from './index.bundle.base';
1421
export {
22+
// eslint-disable-next-line deprecation/deprecation
1523
BrowserTracing,
24+
browserTracingIntegration,
1625
addTracingExtensions,
1726
// eslint-disable-next-line deprecation/deprecation
1827
Replay,

packages/browser/src/index.bundle.replay.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
BrowserTracing,
44
Feedback,
55
addTracingExtensions,
6+
browserTracingIntegration,
67
feedbackIntegration,
78
} from '@sentry-internal/integration-shims';
89
import { Replay, replayIntegration } from '@sentry/replay';
@@ -13,11 +14,14 @@ import * as Sentry from './index.bundle.base';
1314
// eslint-disable-next-line deprecation/deprecation
1415
Sentry.Integrations.Replay = Replay;
1516

17+
// eslint-disable-next-line deprecation/deprecation
1618
Sentry.Integrations.BrowserTracing = BrowserTracing;
1719

1820
export * from './index.bundle.base';
1921
export {
22+
// eslint-disable-next-line deprecation/deprecation
2023
BrowserTracing,
24+
browserTracingIntegration,
2125
addTracingExtensions,
2226
// eslint-disable-next-line deprecation/deprecation
2327
Replay,

packages/browser/src/index.bundle.tracing.replay.feedback.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Feedback, feedbackIntegration } from '@sentry-internal/feedback';
2-
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
2+
import { BrowserTracing, Span, addExtensionMethods, browserTracingIntegration } from '@sentry-internal/tracing';
33
import { Replay, replayIntegration } from '@sentry/replay';
44

55
import * as Sentry from './index.bundle.base';
@@ -10,6 +10,7 @@ import * as Sentry from './index.bundle.base';
1010
// eslint-disable-next-line deprecation/deprecation
1111
Sentry.Integrations.Replay = Replay;
1212

13+
// eslint-disable-next-line deprecation/deprecation
1314
Sentry.Integrations.BrowserTracing = BrowserTracing;
1415

1516
// We are patching the global object with our hub extension methods
@@ -22,7 +23,9 @@ export {
2223
Replay,
2324
feedbackIntegration,
2425
replayIntegration,
26+
// eslint-disable-next-line deprecation/deprecation
2527
BrowserTracing,
28+
browserTracingIntegration,
2629
Span,
2730
addExtensionMethods,
2831
};

packages/browser/src/index.bundle.tracing.replay.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Feedback, feedbackIntegration } from '@sentry-internal/integration-shims';
2-
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
2+
import { BrowserTracing, Span, addExtensionMethods, browserTracingIntegration } from '@sentry-internal/tracing';
33
import { Replay, replayIntegration } from '@sentry/replay';
44

55
import * as Sentry from './index.bundle.base';
@@ -10,6 +10,7 @@ import * as Sentry from './index.bundle.base';
1010
// eslint-disable-next-line deprecation/deprecation
1111
Sentry.Integrations.Replay = Replay;
1212

13+
// eslint-disable-next-line deprecation/deprecation
1314
Sentry.Integrations.BrowserTracing = BrowserTracing;
1415

1516
// We are patching the global object with our hub extension methods
@@ -22,7 +23,9 @@ export {
2223
Replay,
2324
replayIntegration,
2425
feedbackIntegration,
26+
// eslint-disable-next-line deprecation/deprecation
2527
BrowserTracing,
28+
browserTracingIntegration,
2629
Span,
2730
addExtensionMethods,
2831
};

packages/browser/src/index.bundle.tracing.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This is exported so the loader does not fail when switching off Replay
22
import { Feedback, Replay, feedbackIntegration, replayIntegration } from '@sentry-internal/integration-shims';
3-
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
3+
import { BrowserTracing, Span, addExtensionMethods, browserTracingIntegration } from '@sentry-internal/tracing';
44

55
import * as Sentry from './index.bundle.base';
66

@@ -10,6 +10,7 @@ import * as Sentry from './index.bundle.base';
1010
// eslint-disable-next-line deprecation/deprecation
1111
Sentry.Integrations.Replay = Replay;
1212

13+
// eslint-disable-next-line deprecation/deprecation
1314
Sentry.Integrations.BrowserTracing = BrowserTracing;
1415

1516
// We are patching the global object with our hub extension methods
@@ -22,7 +23,9 @@ export {
2223
Replay,
2324
feedbackIntegration,
2425
replayIntegration,
26+
// eslint-disable-next-line deprecation/deprecation
2527
BrowserTracing,
28+
browserTracingIntegration,
2629
Span,
2730
addExtensionMethods,
2831
};

packages/browser/src/index.bundle.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Feedback,
55
Replay,
66
addTracingExtensions,
7+
browserTracingIntegration,
78
feedbackIntegration,
89
replayIntegration,
910
} from '@sentry-internal/integration-shims';
@@ -14,16 +15,19 @@ import * as Sentry from './index.bundle.base';
1415
// eslint-disable-next-line deprecation/deprecation
1516
Sentry.Integrations.Replay = Replay;
1617

18+
// eslint-disable-next-line deprecation/deprecation
1719
Sentry.Integrations.BrowserTracing = BrowserTracing;
1820

1921
export * from './index.bundle.base';
2022
export {
23+
// eslint-disable-next-line deprecation/deprecation
2124
BrowserTracing,
2225
addTracingExtensions,
2326
// eslint-disable-next-line deprecation/deprecation
2427
Replay,
2528
// eslint-disable-next-line deprecation/deprecation
2629
Feedback,
30+
browserTracingIntegration,
2731
feedbackIntegration,
2832
replayIntegration,
2933
};

packages/browser/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ export {
5454
} from '@sentry-internal/feedback';
5555

5656
export {
57+
// eslint-disable-next-line deprecation/deprecation
5758
BrowserTracing,
59+
browserTracingIntegration,
5860
defaultRequestInstrumentationOptions,
5961
instrumentOutgoingRequests,
6062
} from '@sentry-internal/tracing';

packages/browser/test/unit/profiling/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('BrowserProfilingIntegration', () => {
4444
send,
4545
};
4646
},
47-
integrations: [new Sentry.BrowserTracing(), new BrowserProfilingIntegration()],
47+
integrations: [Sentry.browserTracingIntegration(), new BrowserProfilingIntegration()],
4848
});
4949

5050
const client = Sentry.getClient<BrowserClient>();

0 commit comments

Comments
 (0)