Skip to content

Commit 55103c8

Browse files
committed
Merge remote-tracking branch 'origin/develop' into lforst-min-nextjs-version
2 parents 6a89e31 + df5f44e commit 55103c8

File tree

115 files changed

+3142
-3151
lines changed

Some content is hidden

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

115 files changed

+3142
-3151
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ jobs:
871871
yarn test
872872
873873
job_remix_integration_tests:
874-
name: Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) ${{ matrix.tracingIntegration && 'TracingIntegration'}} Tests
874+
name: Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
875875
needs: [job_get_metadata, job_build]
876876
if: needs.job_get_metadata.outputs.changed_remix == 'true' || github.event_name != 'pull_request'
877877
runs-on: ubuntu-20.04

.size-limit.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,26 @@ module.exports = [
5555
limit: '35 KB',
5656
},
5757
{
58-
name: '@sentry/browser (incl. Feedback) - Webpack (gzipped)',
58+
name: '@sentry/browser (incl. feedbackIntegration) - Webpack (gzipped)',
5959
path: 'packages/browser/build/npm/esm/index.js',
6060
import: '{ init, feedbackIntegration }',
6161
gzip: true,
6262
limit: '50 KB',
6363
},
64+
{
65+
name: '@sentry/browser (incl. feedbackModalIntegration) - Webpack (gzipped)',
66+
path: 'packages/browser/build/npm/esm/index.js',
67+
import: '{ init, feedbackIntegration, feedbackModalIntegration }',
68+
gzip: true,
69+
limit: '50 KB',
70+
},
71+
{
72+
name: '@sentry/browser (incl. feedbackScreenshotIntegration) - Webpack (gzipped)',
73+
path: 'packages/browser/build/npm/esm/index.js',
74+
import: '{ init, feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration }',
75+
gzip: true,
76+
limit: '50 KB',
77+
},
6478
{
6579
name: '@sentry/browser (incl. sendFeedback) - Webpack (gzipped)',
6680
path: 'packages/browser/build/npm/esm/index.js',

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/app/entry.server.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1+
import * as Sentry from '@sentry/remix';
2+
3+
Sentry.init({
4+
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
5+
environment: 'qa', // dynamic sampling bias to keep transactions
6+
dsn: process.env.E2E_TEST_DSN,
7+
tunnel: 'http://localhost:3031/', // proxy server
8+
});
9+
110
import { PassThrough } from 'node:stream';
211

312
import type { AppLoadContext, EntryContext } from '@remix-run/node';
413
import { createReadableStreamFromReadable } from '@remix-run/node';
514
import { installGlobals } from '@remix-run/node';
615
import { RemixServer } from '@remix-run/react';
7-
import * as Sentry from '@sentry/remix';
816
import * as isbotModule from 'isbot';
917
import { renderToPipeableStream } from 'react-dom/server';
1018

1119
installGlobals();
1220

1321
const ABORT_DELAY = 5_000;
1422

15-
Sentry.init({
16-
environment: 'qa', // dynamic sampling bias to keep transactions
17-
dsn: process.env.E2E_TEST_DSN,
18-
// Performance Monitoring
19-
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
20-
tunnel: 'http://localhost:3031/', // proxy server
21-
});
22-
2323
export const handleError = Sentry.wrapRemixHandleError;
2424

2525
export default function handleRequest(

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/behaviour-server.test.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
77
// We use this to identify the transactions
88
const testTag = uuid4();
99

10-
// no server span here!
10+
const httpServerTransactionPromise = waitForTransaction('create-remix-app-express-vite-dev', transactionEvent => {
11+
return (
12+
transactionEvent.type === 'transaction' &&
13+
transactionEvent.contexts?.trace?.op === 'http.server' &&
14+
transactionEvent.tags?.['sentry_test'] === testTag
15+
);
16+
});
1117

1218
const pageLoadTransactionPromise = waitForTransaction('create-remix-app-express-vite-dev', transactionEvent => {
1319
return (
@@ -20,16 +26,25 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
2026
page.goto(`/?tag=${testTag}`);
2127

2228
const pageloadTransaction = await pageLoadTransactionPromise;
29+
const httpServerTransaction = await httpServerTransactionPromise;
2330

2431
expect(pageloadTransaction).toBeDefined();
32+
expect(httpServerTransaction).toBeDefined();
33+
34+
const httpServerTraceId = httpServerTransaction.contexts?.trace?.trace_id;
35+
const httpServerSpanId = httpServerTransaction.contexts?.trace?.span_id;
2536

2637
const pageLoadTraceId = pageloadTransaction.contexts?.trace?.trace_id;
2738
const pageLoadSpanId = pageloadTransaction.contexts?.trace?.span_id;
2839
const pageLoadParentSpanId = pageloadTransaction.contexts?.trace?.parent_span_id;
2940

41+
expect(httpServerTransaction.transaction).toBe('routes/_index');
3042
expect(pageloadTransaction.transaction).toBe('routes/_index');
3143

32-
expect(pageLoadTraceId).toBeDefined();
33-
expect(pageLoadParentSpanId).toBeUndefined();
34-
expect(pageLoadSpanId).toBeDefined();
44+
expect(httpServerTraceId).toBeDefined();
45+
expect(httpServerSpanId).toBeDefined();
46+
47+
expect(pageLoadTraceId).toEqual(httpServerTraceId);
48+
expect(pageLoadParentSpanId).toEqual(httpServerSpanId);
49+
expect(pageLoadSpanId).not.toEqual(httpServerSpanId);
3550
});

dev-packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.server.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
import * as Sentry from '@sentry/remix';
2+
3+
Sentry.init({
4+
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
5+
environment: 'qa', // dynamic sampling bias to keep transactions
6+
dsn: process.env.E2E_TEST_DSN,
7+
tunnel: 'http://localhost:3031/', // proxy server
8+
});
9+
110
/**
211
* By default, Remix will handle generating the HTTP Response for you.
312
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
@@ -10,22 +19,13 @@ import type { AppLoadContext, EntryContext } from '@remix-run/node';
1019
import { createReadableStreamFromReadable } from '@remix-run/node';
1120
import { installGlobals } from '@remix-run/node';
1221
import { RemixServer } from '@remix-run/react';
13-
import * as Sentry from '@sentry/remix';
1422
import isbot from 'isbot';
1523
import { renderToPipeableStream } from 'react-dom/server';
1624

1725
installGlobals();
1826

1927
const ABORT_DELAY = 5_000;
2028

21-
Sentry.init({
22-
environment: 'qa', // dynamic sampling bias to keep transactions
23-
dsn: process.env.E2E_TEST_DSN,
24-
// Performance Monitoring
25-
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
26-
tunnel: 'http://localhost:3031/', // proxy server
27-
});
28-
2929
export const handleError = Sentry.wrapRemixHandleError;
3030

3131
export default function handleRequest(

dev-packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
import * as Sentry from '@sentry/remix';
2+
3+
Sentry.init({
4+
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
5+
environment: 'qa', // dynamic sampling bias to keep transactions
6+
dsn: process.env.E2E_TEST_DSN,
7+
tunnel: 'http://localhost:3031/', // proxy server
8+
});
9+
110
/**
211
* By default, Remix will handle generating the HTTP Response for you.
312
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
@@ -9,20 +18,11 @@ import { PassThrough } from 'node:stream';
918
import type { AppLoadContext, EntryContext } from '@remix-run/node';
1019
import { Response } from '@remix-run/node';
1120
import { RemixServer } from '@remix-run/react';
12-
import * as Sentry from '@sentry/remix';
1321
import isbot from 'isbot';
1422
import { renderToPipeableStream } from 'react-dom/server';
1523

1624
const ABORT_DELAY = 5_000;
1725

18-
Sentry.init({
19-
environment: 'qa', // dynamic sampling bias to keep transactions
20-
dsn: process.env.E2E_TEST_DSN,
21-
// Performance Monitoring
22-
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
23-
tunnel: 'http://localhost:3031/', // proxy server
24-
});
25-
2626
export const handleError = Sentry.wrapRemixHandleError;
2727

2828
export default function handleRequest(

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const DEPENDENTS: Dependent[] = [
7171
},
7272
{
7373
package: '@sentry/remix',
74-
compareWith: nodeExperimentalExports,
74+
compareWith: nodeExports,
7575
exports: Object.keys(SentryRemix),
7676
},
7777
{

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export function makeBaseNPMConfig(options = {}) {
5252

5353
sourcemap: true,
5454

55+
// Include __esModule property when generating exports
56+
// Before the upgrade to Rollup 4 this was included by default and when it was gone it broke tests
57+
esModule: true,
58+
5559
// output individual files rather than one big bundle
5660
preserveModules: true,
5761

dev-packages/rollup-utils/plugins/bundlePlugins.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import * as childProcess from 'child_process';
1313
import commonjs from '@rollup/plugin-commonjs';
1414
import { nodeResolve } from '@rollup/plugin-node-resolve';
1515
import replace from '@rollup/plugin-replace';
16+
import terser from '@rollup/plugin-terser';
1617
import license from 'rollup-plugin-license';
17-
import { terser } from 'rollup-plugin-terser';
1818

1919
/**
2020
* Create a plugin to add an identification banner to the top of stand-alone bundles.

jest/jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,11 @@ module.exports = {
1919
__DEBUG_BUILD__: true,
2020
},
2121
testPathIgnorePatterns: ['<rootDir>/build/', '<rootDir>/node_modules/'],
22+
23+
// On CI, we do not need the pretty CLI output, as it makes logs harder to parse
24+
...(process.env.CI
25+
? {
26+
coverageReporters: ['json', 'lcov', 'clover'],
27+
}
28+
: {}),
2229
};

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@
8686
],
8787
"devDependencies": {
8888
"@biomejs/biome": "^1.4.0",
89-
"@rollup/plugin-commonjs": "^21.0.1",
89+
"@rollup/plugin-commonjs": "^25.0.7",
9090
"@rollup/plugin-json": "^6.1.0",
91-
"@rollup/plugin-node-resolve": "^13.1.3",
92-
"@rollup/plugin-replace": "^3.0.1",
93-
"@rollup/plugin-sucrase": "^4.0.3",
94-
"@rollup/plugin-typescript": "^8.3.1",
91+
"@rollup/plugin-node-resolve": "^15.2.3",
92+
"@rollup/plugin-replace": "^5.0.5",
93+
"@rollup/plugin-sucrase": "^5.0.2",
94+
"@rollup/plugin-terser": "^0.4.4",
95+
"@rollup/plugin-typescript": "^11.1.6",
9596
"@size-limit/file": "~11.0.1",
9697
"@size-limit/webpack": "~11.0.1",
9798
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
@@ -120,10 +121,9 @@
120121
"prettier": "^3.1.1",
121122
"replace-in-file": "^4.0.0",
122123
"rimraf": "^3.0.2",
123-
"rollup": "^2.67.1",
124-
"rollup-plugin-cleanup": "3.2.1",
125-
"rollup-plugin-license": "^2.6.1",
126-
"rollup-plugin-terser": "^7.0.2",
124+
"rollup": "^4.13.0",
125+
"rollup-plugin-cleanup": "^3.2.1",
126+
"rollup-plugin-license": "^3.3.1",
127127
"sinon": "^7.3.2",
128128
"size-limit": "~11.0.1",
129129
"ts-jest": "^27.1.4",
@@ -134,7 +134,8 @@
134134
"yalc": "^1.0.0-pre.53"
135135
},
136136
"resolutions": {
137-
"**/agent-base": "5",
137+
"wrap-ansi": "7.0.0",
138+
"string-width": "4.1.0",
138139
"**/terser/source-map": "0.7.4"
139140
},
140141
"version": "0.0.0",

packages/astro/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
},
5959
"devDependencies": {
6060
"astro": "^3.5.0",
61-
"rollup": "^3.20.2",
6261
"vite": "4.0.5"
6362
},
6463
"scripts": {

packages/astro/src/index.types.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ export declare function flush(timeout?: number | undefined): PromiseLike<boolean
2424

2525
// eslint-disable-next-line deprecation/deprecation
2626
export declare const makeMain: typeof clientSdk.makeMain;
27-
export declare const getActiveSpan: typeof clientSdk.getActiveSpan;
2827
// eslint-disable-next-line deprecation/deprecation
2928
export declare const getCurrentHub: typeof clientSdk.getCurrentHub;
3029
export declare const getClient: typeof clientSdk.getClient;
31-
export declare const startSpan: typeof clientSdk.startSpan;
32-
export declare const startInactiveSpan: typeof clientSdk.startInactiveSpan;
33-
export declare const startSpanManual: typeof clientSdk.startSpanManual;
34-
export declare const withActiveSpan: typeof clientSdk.withActiveSpan;
35-
export declare const getRootSpan: typeof clientSdk.getRootSpan;
30+
export declare const continueTrace: typeof clientSdk.continueTrace;
31+
3632
export declare const Span: clientSdk.Span;
3733

3834
export declare const metrics: typeof clientSdk.metrics & typeof serverSdk.metrics;

packages/core/src/envelope.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type {
2+
Attachment,
3+
AttachmentItem,
24
DsnComponents,
35
Event,
46
EventEnvelope,
@@ -11,6 +13,7 @@ import type {
1113
SessionItem,
1214
} from '@sentry/types';
1315
import {
16+
createAttachmentEnvelopeItem,
1417
createEnvelope,
1518
createEventEnvelopeHeaders,
1619
dsnToString,
@@ -86,3 +89,31 @@ export function createEventEnvelope(
8689
const eventItem: EventItem = [{ type: eventType }, event];
8790
return createEnvelope<EventEnvelope>(envelopeHeaders, [eventItem]);
8891
}
92+
93+
/**
94+
* Create an Envelope from an event.
95+
*/
96+
export function createAttachmentEnvelope(
97+
event: Event,
98+
attachments: Attachment[],
99+
dsn?: DsnComponents,
100+
metadata?: SdkMetadata,
101+
tunnel?: string,
102+
): EventEnvelope {
103+
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
104+
enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
105+
106+
const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);
107+
108+
// Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
109+
// sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may
110+
// have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid
111+
// of this `delete`, lest we miss putting it back in the next time the property is in use.)
112+
delete event.sdkProcessingMetadata;
113+
114+
const attachmentItems: AttachmentItem[] = [];
115+
for (const attachment of attachments || []) {
116+
attachmentItems.push(createAttachmentEnvelopeItem(attachment));
117+
}
118+
return createEnvelope<EventEnvelope>(envelopeHeaders, attachmentItems);
119+
}

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type { IntegrationIndex } from './integration';
88

99
export * from './tracing';
1010
export * from './semanticAttributes';
11-
export { createEventEnvelope, createSessionEnvelope } from './envelope';
11+
export { createEventEnvelope, createSessionEnvelope, createAttachmentEnvelope } from './envelope';
1212
export {
1313
captureCheckIn,
1414
withMonitor,

packages/core/src/utils/spanUtils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ export function spanIsSampled(span: Span): boolean {
162162
// We align our trace flags with the ones OpenTelemetry use
163163
// So we also check for sampled the same way they do.
164164
const { traceFlags } = span.spanContext();
165-
// eslint-disable-next-line no-bitwise
166-
return Boolean(traceFlags & TRACE_FLAG_SAMPLED);
165+
return traceFlags === TRACE_FLAG_SAMPLED;
167166
}
168167

169168
/** Get the status message to use for a JSON representation of a span. */

packages/deno/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"deno-types": "node ./scripts/download-deno-types.mjs",
4040
"build": "run-s build:transpile build:types",
4141
"build:dev": "yarn build",
42-
"build:transpile": "yarn deno-types && rollup -c rollup.config.js",
42+
"build:transpile": "yarn deno-types && rollup -c rollup.config.mjs",
4343
"build:types": "run-s deno-types build:types:tsc build:types:bundle",
4444
"build:types:tsc": "tsc -p tsconfig.types.json",
4545
"build:types:bundle": "rollup -c rollup.types.config.mjs",
File renamed without changes.

packages/feedback/.eslintrc.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,6 @@ module.exports = {
1111
parserOptions: {
1212
project: ['tsconfig.test.json'],
1313
},
14-
rules: {
15-
'no-console': 'off',
16-
},
17-
},
18-
{
19-
files: ['test/**/*.ts'],
20-
21-
rules: {
22-
// most of these errors come from `new Promise(process.nextTick)`
23-
'@typescript-eslint/unbound-method': 'off',
24-
// TODO: decide if we want to enable this again after the migration
25-
// We can take the freedom to be a bit more lenient with tests
26-
'@typescript-eslint/no-floating-promises': 'off',
27-
},
28-
},
29-
{
30-
files: ['src/types/deprecated.ts'],
31-
rules: {
32-
'@typescript-eslint/naming-convention': 'off',
33-
},
3414
},
3515
],
3616
};

0 commit comments

Comments
 (0)