Skip to content

Commit 7865a2c

Browse files
committed
wip
1 parent b54f2c8 commit 7865a2c

File tree

135 files changed

+262
-10576
lines changed

Some content is hidden

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

135 files changed

+262
-10576
lines changed

dev-packages/node-core-integration-tests/suites/anr/app-path.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import * as assert from 'assert';
43
import * as crypto from 'crypto';
54
import * as path from 'path';
65
import * as url from 'url';
6+
import { setupOtel } from '../../utils/setupOtel.js';
77

88
global._sentryDebugIds = { [new Error().stack]: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa' };
99

@@ -19,7 +19,6 @@ const client = Sentry.init({
1919
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100, appRootPath: __dirname })],
2020
});
2121

22-
2322
setupOtel(client);
2423

2524
Sentry.setUser({ email: '[email protected]' });

dev-packages/node-core-integration-tests/suites/anr/basic-multiple.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import * as assert from 'assert';
43
import * as crypto from 'crypto';
4+
import { setupOtel } from '../../utils/setupOtel.js';
55

66
global._sentryDebugIds = { [new Error().stack]: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa' };
77

@@ -15,7 +15,6 @@ const client = Sentry.init({
1515
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100, maxAnrEvents: 2 })],
1616
});
1717

18-
1918
setupOtel(client);
2019

2120
Sentry.setUser({ email: '[email protected]' });

dev-packages/node-core-integration-tests/suites/anr/basic.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import * as assert from 'assert';
43
import * as crypto from 'crypto';
4+
import { setupOtel } from '../../utils/setupOtel.js';
55

66
global._sentryDebugIds = { [new Error().stack]: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa' };
77

@@ -15,7 +15,6 @@ const client = Sentry.init({
1515
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

18-
1918
setupOtel(client);
2019

2120
Sentry.setUser({ email: '[email protected]' });

dev-packages/node-core-integration-tests/suites/anr/indefinite.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import * as assert from 'assert';
43
import * as crypto from 'crypto';
4+
import { setupOtel } from '../../utils/setupOtel.js';
55

66
setTimeout(() => {
77
process.exit();
@@ -13,7 +13,6 @@ const client = Sentry.init({
1313
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1414
});
1515

16-
1716
setupOtel(client);
1817

1918
Sentry.setUser({ email: '[email protected]' });

dev-packages/node-core-integration-tests/suites/anr/isolated.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import * as assert from 'assert';
43
import * as crypto from 'crypto';
4+
import { setupOtel } from '../../utils/setupOtel.js';
55

66
setTimeout(() => {
77
process.exit();
@@ -13,7 +13,6 @@ const client = Sentry.init({
1313
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1414
});
1515

16-
1716
setupOtel(client);
1817

1918
async function longWork() {

dev-packages/node-core-integration-tests/suites/anr/should-exit-forced.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ function configureSentry() {
66
dsn: 'https://[email protected]/1337',
77
release: '1.0',
88
debug: true,
9-
integrations: [Sentry.anrIntegration({ captureStackTrace: true })
10-
11-
setupOtel(client);],
9+
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
1210
});
11+
setupOtel(client);
1312
}
1413

1514
async function main() {

dev-packages/node-core-integration-tests/suites/anr/should-exit.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ function configureSentry() {
66
dsn: 'https://[email protected]/1337',
77
release: '1.0',
88
debug: true,
9-
integrations: [Sentry.anrIntegration({ captureStackTrace: true })
10-
11-
setupOtel(client);],
9+
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
1210
});
11+
setupOtel(client);
1312
}
1413

1514
async function main() {

dev-packages/node-core-integration-tests/suites/breadcrumbs/process-thread/app.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../utils/setupOtel.js';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
43
import { spawn } from 'child_process';
54
import { join } from 'path';
65
import { Worker } from 'worker_threads';
6+
import { setupOtel } from '../../../utils/setupOtel.js';
77

88
const __dirname = new URL('.', import.meta.url).pathname;
99

@@ -14,7 +14,6 @@ const client = Sentry.init({
1414
transport: loggingTransport,
1515
});
1616

17-
1817
setupOtel(client);
1918

2019
(async () => {

dev-packages/node-core-integration-tests/suites/child-process/fork.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
43
import { fork } from 'child_process';
54
import * as path from 'path';
5+
import { setupOtel } from '../../utils/setupOtel.js';
66

77
const __dirname = new URL('.', import.meta.url).pathname;
88

@@ -13,7 +13,6 @@ const client = Sentry.init({
1313
transport: loggingTransport,
1414
});
1515

16-
1716
setupOtel(client);
1817

1918
fork(path.join(__dirname, 'child.mjs'));

dev-packages/node-core-integration-tests/suites/child-process/worker.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../utils/setupOtel.js';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
43
import * as path from 'path';
54
import { Worker } from 'worker_threads';
5+
import { setupOtel } from '../../utils/setupOtel.js';
66

77
const __dirname = new URL('.', import.meta.url).pathname;
88

@@ -13,7 +13,6 @@ const client = Sentry.init({
1313
transport: loggingTransport,
1414
});
1515

16-
1716
setupOtel(client);
1817

1918
new Worker(path.join(__dirname, 'child.mjs'));

dev-packages/node-core-integration-tests/suites/client-reports/drop-reasons/before-send/scenario.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../../utils/setupOtel';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
import { setupOtel } from '../../../../utils/setupOtel';
44

55
// eslint-disable-next-line @typescript-eslint/no-floating-promises
66
(async () => {

dev-packages/node-core-integration-tests/suites/client-reports/drop-reasons/event-processors/scenario.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../../utils/setupOtel';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
import { setupOtel } from '../../../../utils/setupOtel';
44

55
// eslint-disable-next-line @typescript-eslint/no-floating-promises
66
(async () => {

dev-packages/node-core-integration-tests/suites/client-reports/periodic-send/scenario.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../utils/setupOtel';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
import { setupOtel } from '../../../utils/setupOtel';
44

55
const client = Sentry.init({
66
dsn: 'https://[email protected]/1337',
@@ -11,7 +11,6 @@ const client = Sentry.init({
1111
},
1212
});
1313

14-
1514
setupOtel(client);
1615

1716
Sentry.captureException(new Error('this should get dropped by before send'));
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../utils/setupOtel.js';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
import { setupOtel } from '../../../utils/setupOtel.js';
44

55
const client = Sentry.init({
66
dsn: 'https://[email protected]/1337',
@@ -9,5 +9,4 @@ const client = Sentry.init({
99
transport: loggingTransport,
1010
});
1111

12-
1312
setupOtel(client);

dev-packages/node-core-integration-tests/suites/esm/warn-esm/server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ app.get('/test/success', (req, res) => {
1919
res.send({ response: 'response 3' });
2020
});
2121

22-
2322
startExpressServerAndSendPortToRunner(app);

dev-packages/node-core-integration-tests/suites/public-api/onUnhandledRejectionIntegration/scenario-strict.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../utils/setupOtel';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
import { setupOtel } from '../../../utils/setupOtel';
44

55
const client = Sentry.init({
66
dsn: 'https://[email protected]/1337',
@@ -9,7 +9,6 @@ const client = Sentry.init({
99
integrations: [Sentry.onUnhandledRejectionIntegration({ mode: 'strict' })],
1010
});
1111

12-
1312
setupOtel(client);
1413

1514
// eslint-disable-next-line @typescript-eslint/no-floating-promises

dev-packages/node-core-integration-tests/suites/public-api/onUnhandledRejectionIntegration/scenario-warn.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import * as Sentry from '@sentry/node-core';
2-
import { setupOtel } from '../../../utils/setupOtel';
32
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
import { setupOtel } from '../../../utils/setupOtel';
44

55
const client = Sentry.init({
66
dsn: 'https://[email protected]/1337',
77
release: '1.0',
88
transport: loggingTransport,
99
});
1010

11-
1211
setupOtel(client);
1312

1413
// eslint-disable-next-line @typescript-eslint/no-floating-promises

packages/node-core/src/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export {
66
type SentryHttpInstrumentationOptions,
77
} from './integrations/http/SentryHttpInstrumentation';
88
export { nativeNodeFetchIntegration } from './integrations/node-fetch';
9+
export {
10+
SentryNodeFetchInstrumentation,
11+
type SentryNodeFetchInstrumentationOptions,
12+
} from './integrations/node-fetch/SentryNodeFetchInstrumentation';
913

1014
export { nodeContextIntegration } from './integrations/context';
1115
export { contextLinesIntegration } from './integrations/contextlines';
@@ -20,12 +24,20 @@ export { childProcessIntegration } from './integrations/childProcess';
2024
export { createSentryWinstonTransport } from './integrations/winston';
2125

2226
export { SentryContextManager } from './otel/contextManager';
23-
export { generateInstrumentOnce } from './otel/instrument';
27+
export { generateInstrumentOnce, instrumentWhenWrapped, INSTRUMENTED } from './otel/instrument';
2428

2529
export { init, getDefaultIntegrations, initWithoutDefaultIntegrations, validateOpenTelemetrySetup } from './sdk';
30+
export { setIsolationScope } from './sdk/scope';
2631
export { getSentryRelease, defaultStackParser } from './sdk/api';
2732
export { createGetModuleFromFilename } from './utils/module';
28-
export { makeNodeTransport } from './transports';
33+
export { addOriginToSpan } from './utils/addOriginToSpan';
34+
export { getRequestUrl } from './utils/getRequestUrl';
35+
export { isCjs } from './utils/commonjs';
36+
export { ensureIsWrapped } from './utils/ensureIsWrapped';
37+
export { createMissingInstrumentationContext } from './utils/createMissingInstrumentationContext';
38+
export { envToBool } from './utils/envToBool';
39+
export { makeNodeTransport, type NodeTransportOptions } from './transports';
40+
export type { HTTPModuleRequestIncomingMessage } from './transports/http-module';
2941
export { NodeClient } from './sdk/client';
3042
export { cron } from './cron';
3143
export { NODE_VERSION } from './nodeVersion';

packages/node-core/src/sdk/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ function _init(
133133

134134
updateScopeFromEnvVariables();
135135

136-
setupOpenTelemetryLogger();
136+
if (options.debug) {
137+
setupOpenTelemetryLogger();
138+
}
137139

138140
enhanceDscWithOpenTelemetryRootSpanName(client);
139141
setupEventContextTrace(client);

0 commit comments

Comments
 (0)