Skip to content

Commit 6fc3b38

Browse files
committed
Merge branch 'develop' into abhi-remove-sentry-tracing
2 parents 9a60e59 + 674a8f0 commit 6fc3b38

File tree

643 files changed

+18479
-8700
lines changed

Some content is hidden

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

643 files changed

+18479
-8700
lines changed

.craft.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ targets:
131131
id: '@sentry-internal/eslint-config-sdk'
132132
includeNames: /^sentry-internal-eslint-config-sdk-\d.*\.tgz$/
133133

134-
## 8. Experimental packages
134+
## 8. Deprecated packages we still release (but no packages depend on them anymore)
135+
- name: npm
136+
id: '@sentry/hub'
137+
includeNames: /^sentry-hub-\d.*\.tgz$/
138+
139+
## 9. Experimental packages
135140
- name: npm
136141
id: '@sentry/node-experimental'
137142
includeNames: /^sentry-node-experimental-\d.*\.tgz$/

.github/CANARY_FAILURE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
title: '{{ env.TITLE }}'
3-
labels: 'Type: Tests'
3+
labels: 'Type: Tests, Waiting for: Product Owner'
44
---
55
Canary tests failed: {{ env.RUN_LINK }}

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,7 @@ jobs:
899899
- name: Run integration tests
900900
env:
901901
NODE_VERSION: ${{ matrix.node }}
902+
TS_VERSION: ${{ matrix.typescript }}
902903
run: |
903904
cd dev-packages/node-integration-tests
904905
yarn test
@@ -1042,9 +1043,8 @@ jobs:
10421043
'node-express-app',
10431044
'create-react-app',
10441045
'create-next-app',
1045-
# disabling remix e2e tests because of flakes
1046-
# 'create-remix-app',
1047-
# 'create-remix-app-v2',
1046+
'create-remix-app',
1047+
'create-remix-app-v2',
10481048
'debug-id-sourcemaps',
10491049
'nextjs-app-dir',
10501050
'nextjs-14',
@@ -1056,7 +1056,8 @@ jobs:
10561056
'sveltekit-2',
10571057
'generic-ts3.8',
10581058
'node-experimental-fastify-app',
1059-
'node-hapi-app',
1059+
# TODO(v8): Re-enable hapi tests
1060+
# 'node-hapi-app',
10601061
'node-exports-test-app',
10611062
'vue-3'
10621063
]

CODEOWNERS

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
packages/replay @getsentry/replay-sdk
2-
packages/replay-worker @getsentry/replay-sdk
3-
dev-packages/browser-integration-tests/suites/replay @getsentry/replay-sdk
1+
packages/replay @getsentry/replay-sdk-web
2+
packages/replay-worker @getsentry/replay-sdk-web
3+
packages/replay-canvas @getsentry/replay-sdk-web
4+
packages/feedback @getsentry/replay-sdk-web
5+
dev-packages/browser-integration-tests/suites/replay @getsentry/replay-sdk-web

MIGRATION.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Upgrading from 7.x to 8.x
22

3+
## Removal of the `MetricsAggregator` integration class and `metricsAggregatorIntegration`
4+
5+
The SDKs now support metrics features without any additional configuration.
6+
7+
## Updated behaviour of `tracePropagationTargets` in the browser (HTTP tracing headers & CORS)
8+
9+
We updated the behaviour of the SDKs when no `tracePropagationTargets` option was defined. As a reminder, you can
10+
provide a list of strings or RegExes that will be matched against URLs to tell the SDK, to which outgoing requests
11+
tracing HTTP headers should be attached to. These tracing headers are used for distributed tracing.
12+
13+
Previously, on the browser, when `tracePropagationTargets` were not defined, they defaulted to the following:
14+
`['localhost', /^\/(?!\/)/]`. This meant that all request targets to that had "localhost" in the URL, or started with a
15+
`/` were equipped with tracing headers. This default was chosen to prevent CORS errors in your browser applications.
16+
However, this default had a few flaws.
17+
18+
Going forward, when the `tracePropagationTargets` option is not set, tracing headers will be attached to all outgoing
19+
requests on the same origin. For example, if you're on `https://example.com/` and you send a request to
20+
`https://example.com/api`, the request will be traced (ie. will have trace headers attached). Requests to
21+
`https://api.example.com/` will not, because it is on a different origin. The same goes for all applications running on
22+
`localhost`.
23+
24+
When you provide a `tracePropagationTargets` option, all of the entries you defined will now be matched be matched
25+
against the full URL of the outgoing request. Previously, it was only matched against what you called request APIs with.
26+
For example, if you made a request like `fetch("/api/posts")`, the provided `tracePropagationTargets` were only compared
27+
against `"/api/posts"`. Going forward they will be matched against the entire URL, for example, if you were on the page
28+
`https://example.com/` and you made the same request, it would be matched against `"https://example.com/api/posts"`.
29+
30+
But that is not all. Because it would be annoying having to create matchers for the entire URL, if the request is a
31+
same-origin request, we also match the `tracePropagationTargets` against the resolved `pathname` of the request.
32+
Meaning, a matcher like `/^\/api/` would match a request call like `fetch('/api/posts')`, or
33+
`fetch('https://same-origin.com/api/posts')` but not `fetch('https://different-origin.com/api/posts')`.
34+
335
## Removal of the `tracingOrigins` option
436

537
After its deprecation in v7 the `tracingOrigins` option is now removed in favor of the `tracePropagationTargets` option.
@@ -27,6 +59,11 @@ The following previously deprecated API has been removed from the `@sentry/nextj
2759
- `IS_BUILD`
2860
- `isBuild`
2961

62+
## Removal of `Span` class export from SDK packages
63+
64+
In v8, we are no longer exporting the `Span` class from SDK packages (e.g. `@sentry/browser` or `@sentry/node`).
65+
Internally, this class is now called `SentrySpan`, and it is no longer meant to be used by users directly.
66+
3067
## Removal of Severity Enum
3168

3269
In v7 we deprecated the `Severity` enum in favor of using the `SeverityLevel` type. In v8 we removed the `Severity`
@@ -59,6 +96,11 @@ to access and mutate the current scope.
5996
`@sentry/tracing` has been removed. All exports from `@sentry/tracing` should be available in `@sentry/core` or in
6097
`@sentry/browser` and `@sentry/node`.
6198

99+
## Removal of `makeXHRTransport` transport (#10703)
100+
101+
The `makeXHRTransport` transport has been removed. Only `makeFetchTransport` is available now. This means that the
102+
Sentry SDK requires the fetch API to be available in the environment.
103+
62104
## General API Changes
63105

64106
- The minumum supported Node version for all the SDK packages is Node 14 (#10527)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@playwright/test": "^1.40.1",
4949
"@sentry-internal/rrweb": "2.11.0",
5050
"@sentry/browser": "7.100.0",
51-
"axios": "1.6.0",
51+
"axios": "1.6.7",
5252
"babel-loader": "^8.2.2",
5353
"html-webpack-plugin": "^5.5.0",
5454
"pako": "^2.1.0",

dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ sentryTest('should capture feedback (@sentry-internal/feedback import)', async (
4444
const feedbackEvent = envelopeRequestParser((await feedbackRequestPromise).request());
4545
expect(feedbackEvent).toEqual({
4646
type: 'feedback',
47+
breadcrumbs: expect.any(Array),
4748
contexts: {
4849
feedback: {
4950
contact_email: '[email protected]',

dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ sentryTest('should capture feedback (@sentry-internal/feedback import)', async (
5050

5151
expect(breadcrumbs).toEqual(
5252
expect.arrayContaining([
53-
{
53+
expect.objectContaining({
5454
category: 'sentry.feedback',
5555
data: { feedbackId: expect.any(String) },
56-
},
56+
}),
5757
]),
5858
);
5959

6060
expect(feedbackEvent).toEqual({
6161
type: 'feedback',
62+
breadcrumbs: expect.any(Array),
6263
contexts: {
6364
feedback: {
6465
contact_email: '[email protected]',

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ sentryTest(
7878

7979
await page.goto(url);
8080
await page.locator('#annotated-button').click();
81-
await page.evaluate('Sentry.captureException("test exception")');
8281

83-
const eventData = await promise;
82+
const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]);
8483

8584
expect(eventData.breadcrumbs).toEqual([
8685
{

dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts

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

7+
// This test rarely flakes with timeouts. The reason might be:
8+
// https://github.com/microsoft/playwright/issues/10376
79
sentryTest(
810
'should assign request and response context from a failed 500 fetch request',
911
async ({ getLocalTestPath, page }) => {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://[email protected]/1337',
7+
});
8+
9+
Sentry.metrics.increment('increment');
10+
Sentry.metrics.increment('increment');
11+
Sentry.metrics.distribution('distribution', 42);
12+
Sentry.metrics.distribution('distribution', 45);
13+
Sentry.metrics.gauge('gauge', 5);
14+
Sentry.metrics.gauge('gauge', 15);
15+
Sentry.metrics.set('set', 'nope');
16+
Sentry.metrics.set('set', 'another');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../utils/fixtures';
4+
import { getFirstSentryEnvelopeRequest, properEnvelopeRequestParser } from '../../utils/helpers';
5+
6+
sentryTest('collects metrics', async ({ getLocalTestUrl, page }) => {
7+
const url = await getLocalTestUrl({ testDir: __dirname });
8+
9+
const statsdBuffer = await getFirstSentryEnvelopeRequest<Uint8Array>(page, url, properEnvelopeRequestParser);
10+
const statsdString = new TextDecoder().decode(statsdBuffer);
11+
// Replace all the Txxxxxx to remove the timestamps
12+
const normalisedStatsdString = statsdString.replace(/T\d+\n?/g, 'T000000');
13+
14+
expect(normalisedStatsdString).toEqual(
15+
'increment@none:2|c|T000000distribution@none:42:45|d|T000000gauge@none:15:5:15:20:2|g|T000000set@none:3387254:3443787523|s|T000000',
16+
);
17+
});

dev-packages/browser-integration-tests/suites/public-api/debug/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sentryTest('logs debug messages correctly', async ({ getLocalTestUrl, page }) =>
2525
? [
2626
'Sentry Logger [log]: Integration installed: InboundFilters',
2727
'Sentry Logger [log]: Integration installed: FunctionToString',
28-
'Sentry Logger [log]: Integration installed: TryCatch',
28+
'Sentry Logger [log]: Integration installed: BrowserApiErrors',
2929
'Sentry Logger [log]: Integration installed: Breadcrumbs',
3030
'Sentry Logger [log]: Global Handler attached: onerror',
3131
'Sentry Logger [log]: Global Handler attached: onunhandledrejection',

dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/subject.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ async function run() {
66
});
77
}
88

9-
run();
9+
(async () => {
10+
await run();
11+
})();
Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
1-
async function run() {
2-
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
3-
const span_1 = transaction.startChild({
4-
op: 'span_1',
5-
data: {
6-
foo: 'bar',
7-
baz: [1, 2, 3],
1+
Sentry.startSpan({ name: 'root_span' }, () => {
2+
Sentry.startSpan(
3+
{
4+
name: 'span_1',
5+
data: {
6+
foo: 'bar',
7+
baz: [1, 2, 3],
8+
},
89
},
9-
});
10-
11-
await new Promise(resolve => setTimeout(resolve, 1));
12-
13-
// span_1 finishes
14-
span_1.end();
10+
() => undefined,
11+
);
1512

1613
// span_2 doesn't finish
17-
const span_2 = transaction.startChild({ op: 'span_2' });
18-
await new Promise(resolve => setTimeout(resolve, 1));
19-
20-
const span_3 = transaction.startChild({ op: 'span_3' });
21-
await new Promise(resolve => setTimeout(resolve, 1));
14+
Sentry.startInactiveSpan({ name: 'span_2' });
2215

23-
// span_4 is the child of span_3 but doesn't finish.
24-
const span_4 = span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });
16+
Sentry.startSpan({ name: 'span_3' }, () => {
17+
// span_4 is the child of span_3 but doesn't finish.
18+
Sentry.startInactiveSpan({ name: 'span_4', data: { qux: 'quux' } });
2519

26-
// span_5 is another child of span_3 but finishes.
27-
const span_5 = span_3.startChild({ op: 'span_5' }).end();
28-
29-
// span_3 also finishes
30-
span_3.end();
31-
32-
transaction.end();
33-
}
34-
35-
run();
20+
// span_5 is another child of span_3 but finishes.
21+
Sentry.startInactiveSpan({ name: 'span_5' }).end();
22+
});
23+
});

dev-packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ sentryTest('should report a transaction in an envelope', async ({ getLocalTestPa
1212
const url = await getLocalTestPath({ testDir: __dirname });
1313
const transaction = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
1414

15-
expect(transaction.transaction).toBe('test_transaction_1');
15+
expect(transaction.transaction).toBe('root_span');
1616
expect(transaction.spans).toBeDefined();
1717
});
1818

19-
sentryTest('should report finished spans as children of the root transaction', async ({ getLocalTestPath, page }) => {
19+
sentryTest('should report finished spans as children of the root span', async ({ getLocalTestPath, page }) => {
2020
if (shouldSkipTracingTest()) {
2121
sentryTest.skip();
2222
}
@@ -31,17 +31,17 @@ sentryTest('should report finished spans as children of the root transaction', a
3131
const span_1 = transaction.spans?.[0];
3232

3333
expect(span_1).toBeDefined();
34-
expect(span_1!.op).toBe('span_1');
34+
expect(span_1!.description).toBe('span_1');
3535
expect(span_1!.parent_span_id).toEqual(rootSpanId);
3636
expect(span_1!.data).toMatchObject({ foo: 'bar', baz: [1, 2, 3] });
3737

3838
const span_3 = transaction.spans?.[1];
3939
expect(span_3).toBeDefined();
40-
expect(span_3!.op).toBe('span_3');
40+
expect(span_3!.description).toBe('span_3');
4141
expect(span_3!.parent_span_id).toEqual(rootSpanId);
4242

4343
const span_5 = transaction.spans?.[2];
4444
expect(span_5).toBeDefined();
45-
expect(span_5!.op).toBe('span_5');
45+
expect(span_5!.description).toBe('span_5');
4646
expect(span_5!.parent_span_id).toEqual(span_3!.span_id);
4747
});

dev-packages/browser-integration-tests/suites/public-api/startTransaction/circular_data/subject.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const chicken = {};
22
const egg = { contains: chicken };
33
chicken.lays = egg;
44

5-
const transaction = Sentry.startTransaction({ name: 'circular_object_test_transaction', data: { chicken } });
6-
const span = transaction.startChild({ op: 'circular_object_test_span', data: { chicken } });
7-
8-
span.end();
9-
transaction.end();
5+
Sentry.startSpan({ name: 'circular_object_test_transaction', data: { chicken } }, () => {
6+
Sentry.startSpan({ op: 'circular_object_test_span', data: { chicken } }, () => undefined);
7+
});

dev-packages/browser-integration-tests/suites/replay/captureReplay/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
4545
integrations: [
4646
'InboundFilters',
4747
'FunctionToString',
48-
'TryCatch',
48+
'BrowserApiErrors',
4949
'Breadcrumbs',
5050
'GlobalHandlers',
5151
'LinkedErrors',
@@ -82,7 +82,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
8282
integrations: [
8383
'InboundFilters',
8484
'FunctionToString',
85-
'TryCatch',
85+
'BrowserApiErrors',
8686
'Breadcrumbs',
8787
'GlobalHandlers',
8888
'LinkedErrors',

dev-packages/browser-integration-tests/suites/replay/captureReplayFromReplayPackage/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ sentryTest('should capture replays (@sentry/replay export)', async ({ getLocalTe
4545
integrations: [
4646
'InboundFilters',
4747
'FunctionToString',
48-
'TryCatch',
48+
'BrowserApiErrors',
4949
'Breadcrumbs',
5050
'GlobalHandlers',
5151
'LinkedErrors',
@@ -82,7 +82,7 @@ sentryTest('should capture replays (@sentry/replay export)', async ({ getLocalTe
8282
integrations: [
8383
'InboundFilters',
8484
'FunctionToString',
85-
'TryCatch',
85+
'BrowserApiErrors',
8686
'Breadcrumbs',
8787
'GlobalHandlers',
8888
'LinkedErrors',

dev-packages/browser-integration-tests/suites/replay/errorResponse/test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ sentryTest('should stop recording after receiving an error response', async ({ g
2323
});
2424

2525
const url = await getLocalTestPath({ testDir: __dirname });
26-
await page.goto(url);
26+
await Promise.all([page.goto(url), waitForReplayRequest(page)]);
2727

28-
await waitForReplayRequest(page);
2928
await page.locator('button').click();
3029

3130
expect(called).toBe(1);

dev-packages/browser-integration-tests/suites/replay/errors/errorModeCustomTransport/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Sentry.init({
1414
replaysOnErrorSampleRate: 1.0,
1515
integrations: [window.Replay],
1616
transport: options => {
17-
const transport = new Sentry.makeXHRTransport(options);
17+
const transport = new Sentry.makeFetchTransport(options);
1818

1919
delete transport.send.__sentry__baseTransport__;
2020

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-custom/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ window.Sentry = Sentry;
44

55
Sentry.init({
66
dsn: 'https://[email protected]/1337',
7-
integrations: [Sentry.browserTracingIntegration({ idleTimeout: 9000 })],
7+
integrations: [Sentry.browserTracingIntegration({ idleTimeout: 9000, instrumentPageLoad: false })],
88
tracesSampleRate: 1,
99
});

0 commit comments

Comments
 (0)