@sentry/node 8.0.0-alpha.1 → 8.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -93
- package/cjs/index.js +3665 -77
- package/cjs/index.js.map +1 -1
- package/esm/index.js +3614 -31
- package/esm/index.js.map +1 -1
- package/esm/integrations/anr/worker-script.js +2 -2
- package/esm/package.json +1 -0
- package/package.json +21 -6
- package/types/index.d.ts +6 -5
- package/types/index.d.ts.map +1 -1
- package/types/integrations/anr/index.d.ts.map +1 -1
- package/types/integrations/anr/worker-script.d.ts +1 -1
- package/types/integrations/anr/worker-script.d.ts.map +1 -1
- package/types/integrations/http.d.ts +4 -0
- package/types/integrations/http.d.ts.map +1 -1
- package/types/integrations/local-variables/common.d.ts +1 -0
- package/types/integrations/local-variables/common.d.ts.map +1 -1
- package/types/integrations/local-variables/local-variables-sync.d.ts +1 -0
- package/types/integrations/local-variables/local-variables-sync.d.ts.map +1 -1
- package/types/integrations/tracing/fastify.d.ts +9 -0
- package/types/integrations/tracing/fastify.d.ts.map +1 -1
- package/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/types/integrations/tracing/prisma.d.ts.map +1 -1
- package/types/proxy/helpers.d.ts +2 -2
- package/types/proxy/helpers.d.ts.map +1 -1
- package/types/proxy/index.d.ts.map +1 -1
- package/types/sdk/hub.d.ts.map +1 -1
- package/types/sdk/init.d.ts.map +1 -1
- package/types/transports/http-module.d.ts +2 -2
- package/types/transports/http-module.d.ts.map +1 -1
- package/types/types.d.ts +12 -4
- package/types/types.d.ts.map +1 -1
- package/types-ts3.8/index.d.ts +6 -5
- package/types-ts3.8/integrations/anr/worker-script.d.ts +1 -1
- package/types-ts3.8/integrations/http.d.ts +4 -0
- package/types-ts3.8/integrations/local-variables/common.d.ts +1 -0
- package/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +1 -0
- package/types-ts3.8/integrations/tracing/fastify.d.ts +9 -0
- package/types-ts3.8/proxy/helpers.d.ts +2 -2
- package/types-ts3.8/transports/http-module.d.ts +2 -2
- package/types-ts3.8/types.d.ts +12 -4
- package/cjs/cron/common.js +0 -56
- package/cjs/cron/common.js.map +0 -1
- package/cjs/cron/cron.js +0 -102
- package/cjs/cron/cron.js.map +0 -1
- package/cjs/cron/index.js +0 -15
- package/cjs/cron/index.js.map +0 -1
- package/cjs/cron/node-cron.js +0 -61
- package/cjs/cron/node-cron.js.map +0 -1
- package/cjs/cron/node-schedule.js +0 -57
- package/cjs/cron/node-schedule.js.map +0 -1
- package/cjs/debug-build.js +0 -11
- package/cjs/debug-build.js.map +0 -1
- package/cjs/integrations/anr/index.js +0 -145
- package/cjs/integrations/anr/index.js.map +0 -1
- package/cjs/integrations/anr/worker-script.js +0 -2
- package/cjs/integrations/anr/worker-script.js.map +0 -1
- package/cjs/integrations/console.js +0 -40
- package/cjs/integrations/console.js.map +0 -1
- package/cjs/integrations/context.js +0 -435
- package/cjs/integrations/context.js.map +0 -1
- package/cjs/integrations/contextlines.js +0 -137
- package/cjs/integrations/contextlines.js.map +0 -1
- package/cjs/integrations/http.js +0 -137
- package/cjs/integrations/http.js.map +0 -1
- package/cjs/integrations/local-variables/common.js +0 -87
- package/cjs/integrations/local-variables/common.js.map +0 -1
- package/cjs/integrations/local-variables/index.js +0 -8
- package/cjs/integrations/local-variables/index.js.map +0 -1
- package/cjs/integrations/local-variables/local-variables-sync.js +0 -400
- package/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
- package/cjs/integrations/modules.js +0 -99
- package/cjs/integrations/modules.js.map +0 -1
- package/cjs/integrations/node-fetch.js +0 -82
- package/cjs/integrations/node-fetch.js.map +0 -1
- package/cjs/integrations/onuncaughtexception.js +0 -137
- package/cjs/integrations/onuncaughtexception.js.map +0 -1
- package/cjs/integrations/onunhandledrejection.js +0 -90
- package/cjs/integrations/onunhandledrejection.js.map +0 -1
- package/cjs/integrations/spotlight.js +0 -109
- package/cjs/integrations/spotlight.js.map +0 -1
- package/cjs/integrations/tracing/express.js +0 -103
- package/cjs/integrations/tracing/express.js.map +0 -1
- package/cjs/integrations/tracing/fastify.js +0 -33
- package/cjs/integrations/tracing/fastify.js.map +0 -1
- package/cjs/integrations/tracing/graphql.js +0 -34
- package/cjs/integrations/tracing/graphql.js.map +0 -1
- package/cjs/integrations/tracing/hapi/index.js +0 -81
- package/cjs/integrations/tracing/hapi/index.js.map +0 -1
- package/cjs/integrations/tracing/index.js +0 -37
- package/cjs/integrations/tracing/index.js.map +0 -1
- package/cjs/integrations/tracing/koa.js +0 -21
- package/cjs/integrations/tracing/koa.js.map +0 -1
- package/cjs/integrations/tracing/mongo.js +0 -33
- package/cjs/integrations/tracing/mongo.js.map +0 -1
- package/cjs/integrations/tracing/mongoose.js +0 -33
- package/cjs/integrations/tracing/mongoose.js.map +0 -1
- package/cjs/integrations/tracing/mysql.js +0 -26
- package/cjs/integrations/tracing/mysql.js.map +0 -1
- package/cjs/integrations/tracing/mysql2.js +0 -33
- package/cjs/integrations/tracing/mysql2.js.map +0 -1
- package/cjs/integrations/tracing/nest.js +0 -26
- package/cjs/integrations/tracing/nest.js.map +0 -1
- package/cjs/integrations/tracing/postgres.js +0 -34
- package/cjs/integrations/tracing/postgres.js.map +0 -1
- package/cjs/integrations/tracing/prisma.js +0 -33
- package/cjs/integrations/tracing/prisma.js.map +0 -1
- package/cjs/nodeVersion.js +0 -12
- package/cjs/nodeVersion.js.map +0 -1
- package/cjs/otel/contextManager.js +0 -16
- package/cjs/otel/contextManager.js.map +0 -1
- package/cjs/proxy/base.js +0 -126
- package/cjs/proxy/base.js.map +0 -1
- package/cjs/proxy/index.js +0 -209
- package/cjs/proxy/index.js.map +0 -1
- package/cjs/proxy/parse-proxy-response.js +0 -104
- package/cjs/proxy/parse-proxy-response.js.map +0 -1
- package/cjs/sdk/api.js +0 -74
- package/cjs/sdk/api.js.map +0 -1
- package/cjs/sdk/client.js +0 -57
- package/cjs/sdk/client.js.map +0 -1
- package/cjs/sdk/hub.js +0 -104
- package/cjs/sdk/hub.js.map +0 -1
- package/cjs/sdk/init.js +0 -224
- package/cjs/sdk/init.js.map +0 -1
- package/cjs/sdk/initOtel.js +0 -70
- package/cjs/sdk/initOtel.js.map +0 -1
- package/cjs/sdk/scope.js +0 -18
- package/cjs/sdk/scope.js.map +0 -1
- package/cjs/transports/http.js +0 -160
- package/cjs/transports/http.js.map +0 -1
- package/cjs/utils/addOriginToSpan.js +0 -11
- package/cjs/utils/addOriginToSpan.js.map +0 -1
- package/cjs/utils/errorhandling.js +0 -44
- package/cjs/utils/errorhandling.js.map +0 -1
- package/cjs/utils/getRequestUrl.js +0 -18
- package/cjs/utils/getRequestUrl.js.map +0 -1
- package/cjs/utils/module.js +0 -62
- package/cjs/utils/module.js.map +0 -1
- package/esm/cron/common.js +0 -54
- package/esm/cron/common.js.map +0 -1
- package/esm/cron/cron.js +0 -100
- package/esm/cron/cron.js.map +0 -1
- package/esm/cron/index.js +0 -13
- package/esm/cron/index.js.map +0 -1
- package/esm/cron/node-cron.js +0 -56
- package/esm/cron/node-cron.js.map +0 -1
- package/esm/cron/node-schedule.js +0 -55
- package/esm/cron/node-schedule.js.map +0 -1
- package/esm/debug-build.js +0 -9
- package/esm/debug-build.js.map +0 -1
- package/esm/integrations/anr/index.js +0 -139
- package/esm/integrations/anr/index.js.map +0 -1
- package/esm/integrations/anr/worker-script.js.map +0 -1
- package/esm/integrations/console.js +0 -38
- package/esm/integrations/console.js.map +0 -1
- package/esm/integrations/context.js +0 -427
- package/esm/integrations/context.js.map +0 -1
- package/esm/integrations/contextlines.js +0 -131
- package/esm/integrations/contextlines.js.map +0 -1
- package/esm/integrations/http.js +0 -132
- package/esm/integrations/http.js.map +0 -1
- package/esm/integrations/local-variables/common.js +0 -81
- package/esm/integrations/local-variables/common.js.map +0 -1
- package/esm/integrations/local-variables/index.js +0 -6
- package/esm/integrations/local-variables/index.js.map +0 -1
- package/esm/integrations/local-variables/local-variables-sync.js +0 -394
- package/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
- package/esm/integrations/modules.js +0 -97
- package/esm/integrations/modules.js.map +0 -1
- package/esm/integrations/node-fetch.js +0 -80
- package/esm/integrations/node-fetch.js.map +0 -1
- package/esm/integrations/onuncaughtexception.js +0 -134
- package/esm/integrations/onuncaughtexception.js.map +0 -1
- package/esm/integrations/onunhandledrejection.js +0 -87
- package/esm/integrations/onunhandledrejection.js.map +0 -1
- package/esm/integrations/spotlight.js +0 -106
- package/esm/integrations/spotlight.js.map +0 -1
- package/esm/integrations/tracing/express.js +0 -96
- package/esm/integrations/tracing/express.js.map +0 -1
- package/esm/integrations/tracing/fastify.js +0 -31
- package/esm/integrations/tracing/fastify.js.map +0 -1
- package/esm/integrations/tracing/graphql.js +0 -32
- package/esm/integrations/tracing/graphql.js.map +0 -1
- package/esm/integrations/tracing/hapi/index.js +0 -77
- package/esm/integrations/tracing/hapi/index.js.map +0 -1
- package/esm/integrations/tracing/index.js +0 -35
- package/esm/integrations/tracing/index.js.map +0 -1
- package/esm/integrations/tracing/koa.js +0 -19
- package/esm/integrations/tracing/koa.js.map +0 -1
- package/esm/integrations/tracing/mongo.js +0 -31
- package/esm/integrations/tracing/mongo.js.map +0 -1
- package/esm/integrations/tracing/mongoose.js +0 -31
- package/esm/integrations/tracing/mongoose.js.map +0 -1
- package/esm/integrations/tracing/mysql.js +0 -24
- package/esm/integrations/tracing/mysql.js.map +0 -1
- package/esm/integrations/tracing/mysql2.js +0 -31
- package/esm/integrations/tracing/mysql2.js.map +0 -1
- package/esm/integrations/tracing/nest.js +0 -24
- package/esm/integrations/tracing/nest.js.map +0 -1
- package/esm/integrations/tracing/postgres.js +0 -32
- package/esm/integrations/tracing/postgres.js.map +0 -1
- package/esm/integrations/tracing/prisma.js +0 -31
- package/esm/integrations/tracing/prisma.js.map +0 -1
- package/esm/nodeVersion.js +0 -9
- package/esm/nodeVersion.js.map +0 -1
- package/esm/otel/contextManager.js +0 -14
- package/esm/otel/contextManager.js.map +0 -1
- package/esm/proxy/base.js +0 -121
- package/esm/proxy/base.js.map +0 -1
- package/esm/proxy/index.js +0 -203
- package/esm/proxy/index.js.map +0 -1
- package/esm/proxy/parse-proxy-response.js +0 -102
- package/esm/proxy/parse-proxy-response.js.map +0 -1
- package/esm/sdk/api.js +0 -69
- package/esm/sdk/api.js.map +0 -1
- package/esm/sdk/client.js +0 -52
- package/esm/sdk/client.js.map +0 -1
- package/esm/sdk/hub.js +0 -102
- package/esm/sdk/hub.js.map +0 -1
- package/esm/sdk/init.js +0 -221
- package/esm/sdk/init.js.map +0 -1
- package/esm/sdk/initOtel.js +0 -67
- package/esm/sdk/initOtel.js.map +0 -1
- package/esm/sdk/scope.js +0 -16
- package/esm/sdk/scope.js.map +0 -1
- package/esm/transports/http.js +0 -155
- package/esm/transports/http.js.map +0 -1
- package/esm/utils/addOriginToSpan.js +0 -9
- package/esm/utils/addOriginToSpan.js.map +0 -1
- package/esm/utils/errorhandling.js +0 -42
- package/esm/utils/errorhandling.js.map +0 -1
- package/esm/utils/getRequestUrl.js +0 -16
- package/esm/utils/getRequestUrl.js.map +0 -1
- package/esm/utils/module.js +0 -60
- package/esm/utils/module.js.map +0 -1
- package/types/integrations/local-variables/local-variables-async.d.ts +0 -14
- package/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
- package/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -14
package/cjs/sdk/hub.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const api = require('./api.js');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is for legacy reasons, and returns a proxy object instead of a hub to be used.
|
|
8
|
-
* @deprecated Use the methods directly.
|
|
9
|
-
*/
|
|
10
|
-
function getCurrentHub() {
|
|
11
|
-
return {
|
|
12
|
-
isOlderThan(_version) {
|
|
13
|
-
return false;
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
bindClient(client) {
|
|
17
|
-
const scope = core.getCurrentScope();
|
|
18
|
-
scope.setClient(client);
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
pushScope() {
|
|
22
|
-
// TODO: This does not work and is actually deprecated
|
|
23
|
-
return core.getCurrentScope();
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
popScope() {
|
|
27
|
-
// TODO: This does not work and is actually deprecated
|
|
28
|
-
return false;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
withScope: core.withScope,
|
|
32
|
-
getClient: () => api.getClient() ,
|
|
33
|
-
getScope: core.getCurrentScope,
|
|
34
|
-
getIsolationScope: core.getIsolationScope,
|
|
35
|
-
captureException: (exception, hint) => {
|
|
36
|
-
return core.getCurrentScope().captureException(exception, hint);
|
|
37
|
-
},
|
|
38
|
-
captureMessage: (message, level, hint) => {
|
|
39
|
-
return core.getCurrentScope().captureMessage(message, level, hint);
|
|
40
|
-
},
|
|
41
|
-
captureEvent: core.captureEvent,
|
|
42
|
-
addBreadcrumb: core.addBreadcrumb,
|
|
43
|
-
setUser: core.setUser,
|
|
44
|
-
setTags: core.setTags,
|
|
45
|
-
setTag: core.setTag,
|
|
46
|
-
setExtra: core.setExtra,
|
|
47
|
-
setExtras: core.setExtras,
|
|
48
|
-
setContext: core.setContext,
|
|
49
|
-
|
|
50
|
-
getIntegration(integration) {
|
|
51
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
52
|
-
return api.getClient().getIntegration(integration);
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
startTransaction(
|
|
56
|
-
_context,
|
|
57
|
-
_customSamplingContext,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
) {
|
|
60
|
-
// eslint-disable-next-line no-console
|
|
61
|
-
console.warn('startTransaction is a noop in @sentry/node-experimental. Use `startSpan` instead.');
|
|
62
|
-
// We return an object here as hub.ts checks for the result of this
|
|
63
|
-
// and renders a different warning if this is empty
|
|
64
|
-
return {};
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
startSession: core.startSession,
|
|
68
|
-
|
|
69
|
-
endSession: core.endSession,
|
|
70
|
-
|
|
71
|
-
captureSession(endSession) {
|
|
72
|
-
// both send the update and pull the session from the scope
|
|
73
|
-
if (endSession) {
|
|
74
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
75
|
-
return this.endSession();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// only send the update
|
|
79
|
-
_sendSessionUpdate();
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
shouldSendDefaultPii() {
|
|
83
|
-
const client = api.getClient();
|
|
84
|
-
const options = client.getOptions();
|
|
85
|
-
return Boolean(options.sendDefaultPii);
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Sends the current Session on the scope
|
|
92
|
-
*/
|
|
93
|
-
function _sendSessionUpdate() {
|
|
94
|
-
const scope = core.getCurrentScope();
|
|
95
|
-
const client = api.getClient();
|
|
96
|
-
|
|
97
|
-
const session = scope.getSession();
|
|
98
|
-
if (session) {
|
|
99
|
-
client.captureSession(session);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
exports.getCurrentHub = getCurrentHub;
|
|
104
|
-
//# sourceMappingURL=hub.js.map
|
package/cjs/sdk/hub.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hub.js","sources":["../../../src/sdk/hub.ts"],"sourcesContent":["import type {\n Client,\n CustomSamplingContext,\n EventHint,\n Hub,\n Integration,\n IntegrationClass,\n Scope,\n SeverityLevel,\n TransactionContext,\n} from '@sentry/types';\n\nimport {\n addBreadcrumb,\n captureEvent,\n endSession,\n getCurrentScope,\n getIsolationScope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startSession,\n withScope,\n} from '@sentry/core';\nimport { getClient } from './api';\n\n/**\n * This is for legacy reasons, and returns a proxy object instead of a hub to be used.\n * @deprecated Use the methods directly.\n */\nexport function getCurrentHub(): Hub {\n return {\n isOlderThan(_version: number): boolean {\n return false;\n },\n\n bindClient(client: Client): void {\n const scope = getCurrentScope();\n scope.setClient(client);\n },\n\n pushScope(): Scope {\n // TODO: This does not work and is actually deprecated\n return getCurrentScope();\n },\n\n popScope(): boolean {\n // TODO: This does not work and is actually deprecated\n return false;\n },\n\n withScope,\n getClient: <C extends Client>() => getClient() as C | undefined,\n getScope: getCurrentScope,\n getIsolationScope,\n captureException: (exception: unknown, hint?: EventHint) => {\n return getCurrentScope().captureException(exception, hint);\n },\n captureMessage: (message: string, level?: SeverityLevel, hint?: EventHint) => {\n return getCurrentScope().captureMessage(message, level, hint);\n },\n captureEvent,\n addBreadcrumb,\n setUser,\n setTags,\n setTag,\n setExtra,\n setExtras,\n setContext,\n\n getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {\n // eslint-disable-next-line deprecation/deprecation\n return getClient().getIntegration(integration);\n },\n\n startTransaction(\n _context: TransactionContext,\n _customSamplingContext?: CustomSamplingContext,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): any {\n // eslint-disable-next-line no-console\n console.warn('startTransaction is a noop in @sentry/node-experimental. Use `startSpan` instead.');\n // We return an object here as hub.ts checks for the result of this\n // and renders a different warning if this is empty\n return {};\n },\n\n startSession,\n\n endSession,\n\n captureSession(endSession?: boolean): void {\n // both send the update and pull the session from the scope\n if (endSession) {\n // eslint-disable-next-line deprecation/deprecation\n return this.endSession();\n }\n\n // only send the update\n _sendSessionUpdate();\n },\n\n shouldSendDefaultPii(): boolean {\n const client = getClient();\n const options = client.getOptions();\n return Boolean(options.sendDefaultPii);\n },\n };\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate(): void {\n const scope = getCurrentScope();\n const client = getClient();\n\n const session = scope.getSession();\n if (session) {\n client.captureSession(session);\n }\n}\n"],"names":["getCurrentScope","withScope","getClient","getIsolationScope","captureEvent","addBreadcrumb","setUser","setTags","setTag","setExtra","setExtras","setContext","startSession","endSession"],"mappings":";;;;;AA6BA;AACA;AACA;AACA;AACO,SAAS,aAAa,GAAQ;AACrC,EAAE,OAAO;AACT,IAAI,WAAW,CAAC,QAAQ,EAAmB;AAC3C,MAAM,OAAO,KAAK,CAAA;AAClB,KAAK;AACL;AACA,IAAI,UAAU,CAAC,MAAM,EAAgB;AACrC,MAAM,MAAM,KAAA,GAAQA,oBAAe,EAAE,CAAA;AACrC,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;AAC7B,KAAK;AACL;AACA,IAAI,SAAS,GAAU;AACvB;AACA,MAAM,OAAOA,oBAAe,EAAE,CAAA;AAC9B,KAAK;AACL;AACA,IAAI,QAAQ,GAAY;AACxB;AACA,MAAM,OAAO,KAAK,CAAA;AAClB,KAAK;AACL;AACA,eAAIC,cAAS;AACb,IAAI,SAAS,EAAE,MAAwBC,aAAS,EAAG;AACnD,IAAI,QAAQ,EAAEF,oBAAe;AAC7B,uBAAIG,sBAAiB;AACrB,IAAI,gBAAgB,EAAE,CAAC,SAAS,EAAW,IAAI,KAAiB;AAChE,MAAM,OAAOH,oBAAe,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAChE,KAAK;AACL,IAAI,cAAc,EAAE,CAAC,OAAO,EAAU,KAAK,EAAkB,IAAI,KAAiB;AAClF,MAAM,OAAOA,oBAAe,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACnE,KAAK;AACL,kBAAII,iBAAY;AAChB,mBAAIC,kBAAa;AACjB,aAAIC,YAAO;AACX,aAAIC,YAAO;AACX,YAAIC,WAAM;AACV,cAAIC,aAAQ;AACZ,eAAIC,cAAS;AACb,gBAAIC,eAAU;AACd;AACA,IAAI,cAAc,CAAwB,WAAW,EAAiC;AACtF;AACA,MAAM,OAAOT,aAAS,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AACpD,KAAK;AACL;AACA,IAAI,gBAAgB;AACpB,MAAM,QAAQ;AACd,MAAM,sBAAsB;AAC5B;AACA,MAAW;AACX;AACA,MAAM,OAAO,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAA;AACvG;AACA;AACA,MAAM,OAAO,EAAE,CAAA;AACf,KAAK;AACL;AACA,kBAAIU,iBAAY;AAChB;AACA,gBAAIC,eAAU;AACd;AACA,IAAI,cAAc,CAAC,UAAU,EAAkB;AAC/C;AACA,MAAM,IAAI,UAAU,EAAE;AACtB;AACA,QAAQ,OAAO,IAAI,CAAC,UAAU,EAAE,CAAA;AAChC,OAAM;AACN;AACA;AACA,MAAM,kBAAkB,EAAE,CAAA;AAC1B,KAAK;AACL;AACA,IAAI,oBAAoB,GAAY;AACpC,MAAM,MAAM,MAAA,GAASX,aAAS,EAAE,CAAA;AAChC,MAAM,MAAM,OAAQ,GAAE,MAAM,CAAC,UAAU,EAAE,CAAA;AACzC,MAAM,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;AAC5C,KAAK;AACL,GAAG,CAAA;AACH,CAAA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,GAAS;AACpC,EAAE,MAAM,KAAA,GAAQF,oBAAe,EAAE,CAAA;AACjC,EAAE,MAAM,MAAA,GAASE,aAAS,EAAE,CAAA;AAC5B;AACA,EAAE,MAAM,OAAQ,GAAE,KAAK,CAAC,UAAU,EAAE,CAAA;AACpC,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AAClC,GAAE;AACF;;;;"}
|
package/cjs/sdk/init.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const opentelemetry = require('@sentry/opentelemetry');
|
|
5
|
-
const utils = require('@sentry/utils');
|
|
6
|
-
const debugBuild = require('../debug-build.js');
|
|
7
|
-
const console$1 = require('../integrations/console.js');
|
|
8
|
-
const context = require('../integrations/context.js');
|
|
9
|
-
const contextlines = require('../integrations/contextlines.js');
|
|
10
|
-
const http = require('../integrations/http.js');
|
|
11
|
-
const index = require('../integrations/local-variables/index.js');
|
|
12
|
-
const modules = require('../integrations/modules.js');
|
|
13
|
-
const nodeFetch = require('../integrations/node-fetch.js');
|
|
14
|
-
const onuncaughtexception = require('../integrations/onuncaughtexception.js');
|
|
15
|
-
const onunhandledrejection = require('../integrations/onunhandledrejection.js');
|
|
16
|
-
const spotlight = require('../integrations/spotlight.js');
|
|
17
|
-
const index$1 = require('../integrations/tracing/index.js');
|
|
18
|
-
const http$1 = require('../transports/http.js');
|
|
19
|
-
const api = require('./api.js');
|
|
20
|
-
const client = require('./client.js');
|
|
21
|
-
const initOtel = require('./initOtel.js');
|
|
22
|
-
|
|
23
|
-
/** Get the default integrations for the Node Experimental SDK. */
|
|
24
|
-
function getDefaultIntegrations(options) {
|
|
25
|
-
// TODO
|
|
26
|
-
return [
|
|
27
|
-
// Common
|
|
28
|
-
core.inboundFiltersIntegration(),
|
|
29
|
-
core.functionToStringIntegration(),
|
|
30
|
-
core.linkedErrorsIntegration(),
|
|
31
|
-
core.requestDataIntegration(),
|
|
32
|
-
// Native Wrappers
|
|
33
|
-
console$1.consoleIntegration(),
|
|
34
|
-
http.httpIntegration(),
|
|
35
|
-
nodeFetch.nativeNodeFetchIntegration(),
|
|
36
|
-
// Global Handlers
|
|
37
|
-
onuncaughtexception.onUncaughtExceptionIntegration(),
|
|
38
|
-
onunhandledrejection.onUnhandledRejectionIntegration(),
|
|
39
|
-
// Event Info
|
|
40
|
-
contextlines.contextLinesIntegration(),
|
|
41
|
-
index.localVariablesIntegration(),
|
|
42
|
-
context.nodeContextIntegration(),
|
|
43
|
-
modules.modulesIntegration(),
|
|
44
|
-
http.httpIntegration(),
|
|
45
|
-
nodeFetch.nativeNodeFetchIntegration(),
|
|
46
|
-
...(core.hasTracingEnabled(options) ? index$1.getAutoPerformanceIntegrations() : []),
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Initialize Sentry for Node.
|
|
52
|
-
*/
|
|
53
|
-
function init(options = {}) {
|
|
54
|
-
const clientOptions = getClientOptions(options);
|
|
55
|
-
|
|
56
|
-
if (clientOptions.debug === true) {
|
|
57
|
-
if (debugBuild.DEBUG_BUILD) {
|
|
58
|
-
utils.logger.enable();
|
|
59
|
-
} else {
|
|
60
|
-
// use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped
|
|
61
|
-
utils.consoleSandbox(() => {
|
|
62
|
-
// eslint-disable-next-line no-console
|
|
63
|
-
console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
opentelemetry.setOpenTelemetryContextAsyncContextStrategy();
|
|
69
|
-
|
|
70
|
-
const scope = core.getCurrentScope();
|
|
71
|
-
scope.update(options.initialScope);
|
|
72
|
-
|
|
73
|
-
const client$1 = new client.NodeClient(clientOptions);
|
|
74
|
-
// The client is on the current scope, from where it generally is inherited
|
|
75
|
-
core.getCurrentScope().setClient(client$1);
|
|
76
|
-
|
|
77
|
-
if (isEnabled(client$1)) {
|
|
78
|
-
client$1.init();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (options.autoSessionTracking) {
|
|
82
|
-
startSessionTracking();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
updateScopeFromEnvVariables();
|
|
86
|
-
|
|
87
|
-
if (options.spotlight) {
|
|
88
|
-
// force integrations to be setup even if no DSN was set
|
|
89
|
-
// If they have already been added before, they will be ignored anyhow
|
|
90
|
-
const integrations = client$1.getOptions().integrations;
|
|
91
|
-
for (const integration of integrations) {
|
|
92
|
-
client$1.addIntegration(integration);
|
|
93
|
-
}
|
|
94
|
-
client$1.addIntegration(
|
|
95
|
-
spotlight.spotlightIntegration({
|
|
96
|
-
sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,
|
|
97
|
-
}),
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Always init Otel, even if tracing is disabled, because we need it for trace propagation & the HTTP integration
|
|
102
|
-
initOtel.initOtel();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function getClientOptions(options) {
|
|
106
|
-
if (options.defaultIntegrations === undefined) {
|
|
107
|
-
options.defaultIntegrations = getDefaultIntegrations(options);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const release = getRelease(options.release);
|
|
111
|
-
|
|
112
|
-
const autoSessionTracking =
|
|
113
|
-
typeof release !== 'string'
|
|
114
|
-
? false
|
|
115
|
-
: options.autoSessionTracking === undefined
|
|
116
|
-
? true
|
|
117
|
-
: options.autoSessionTracking;
|
|
118
|
-
|
|
119
|
-
const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);
|
|
120
|
-
|
|
121
|
-
const baseOptions = utils.dropUndefinedKeys({
|
|
122
|
-
transport: http$1.makeNodeTransport,
|
|
123
|
-
dsn: process.env.SENTRY_DSN,
|
|
124
|
-
environment: process.env.SENTRY_ENVIRONMENT,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const overwriteOptions = utils.dropUndefinedKeys({
|
|
128
|
-
release,
|
|
129
|
-
autoSessionTracking,
|
|
130
|
-
tracesSampleRate,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const clientOptions = {
|
|
134
|
-
...baseOptions,
|
|
135
|
-
...options,
|
|
136
|
-
...overwriteOptions,
|
|
137
|
-
stackParser: utils.stackParserFromStackParserOptions(options.stackParser || api.defaultStackParser),
|
|
138
|
-
integrations: core.getIntegrationsToSetup({
|
|
139
|
-
defaultIntegrations: options.defaultIntegrations,
|
|
140
|
-
integrations: options.integrations,
|
|
141
|
-
}),
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
return clientOptions;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function getRelease(release) {
|
|
148
|
-
if (release !== undefined) {
|
|
149
|
-
return release;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const detectedRelease = api.getSentryRelease();
|
|
153
|
-
if (detectedRelease !== undefined) {
|
|
154
|
-
return detectedRelease;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function getTracesSampleRate(tracesSampleRate) {
|
|
161
|
-
if (tracesSampleRate !== undefined) {
|
|
162
|
-
return tracesSampleRate;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;
|
|
166
|
-
if (!sampleRateFromEnv) {
|
|
167
|
-
return undefined;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const parsed = parseFloat(sampleRateFromEnv);
|
|
171
|
-
return isFinite(parsed) ? parsed : undefined;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Update scope and propagation context based on environmental variables.
|
|
176
|
-
*
|
|
177
|
-
* See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md
|
|
178
|
-
* for more details.
|
|
179
|
-
*/
|
|
180
|
-
function updateScopeFromEnvVariables() {
|
|
181
|
-
const sentryUseEnvironment = (process.env.SENTRY_USE_ENVIRONMENT || '').toLowerCase();
|
|
182
|
-
if (!['false', 'n', 'no', 'off', '0'].includes(sentryUseEnvironment)) {
|
|
183
|
-
const sentryTraceEnv = process.env.SENTRY_TRACE;
|
|
184
|
-
const baggageEnv = process.env.SENTRY_BAGGAGE;
|
|
185
|
-
const propagationContext = utils.propagationContextFromHeaders(sentryTraceEnv, baggageEnv);
|
|
186
|
-
core.getCurrentScope().setPropagationContext(propagationContext);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Enable automatic Session Tracking for the node process.
|
|
192
|
-
*/
|
|
193
|
-
function startSessionTracking() {
|
|
194
|
-
const client = core.getClient();
|
|
195
|
-
if (client && client.getOptions().autoSessionTracking) {
|
|
196
|
-
client.initSessionFlusher();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
core.startSession();
|
|
200
|
-
|
|
201
|
-
// Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because
|
|
202
|
-
// The 'beforeExit' event is not emitted for conditions causing explicit termination,
|
|
203
|
-
// such as calling process.exit() or uncaught exceptions.
|
|
204
|
-
// Ref: https://nodejs.org/api/process.html#process_event_beforeexit
|
|
205
|
-
process.on('beforeExit', () => {
|
|
206
|
-
const session = core.getIsolationScope().getSession();
|
|
207
|
-
|
|
208
|
-
// Only call endSession, if the Session exists on Scope and SessionStatus is not a
|
|
209
|
-
// Terminal Status i.e. Exited or Crashed because
|
|
210
|
-
// "When a session is moved away from ok it must not be updated anymore."
|
|
211
|
-
// Ref: https://develop.sentry.dev/sdk/sessions/
|
|
212
|
-
if (session && session.status !== 'ok') {
|
|
213
|
-
core.endSession();
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function isEnabled(client) {
|
|
219
|
-
return client.getOptions().enabled !== false && client.getTransport() !== undefined;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
exports.getDefaultIntegrations = getDefaultIntegrations;
|
|
223
|
-
exports.init = init;
|
|
224
|
-
//# sourceMappingURL=init.js.map
|
package/cjs/sdk/init.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sources":["../../../src/sdk/init.ts"],"sourcesContent":["import {\n endSession,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getIsolationScope,\n hasTracingEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n requestDataIntegration,\n startSession,\n} from '@sentry/core';\nimport { setOpenTelemetryContextAsyncContextStrategy } from '@sentry/opentelemetry';\nimport type { Client, Integration, Options } from '@sentry/types';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n logger,\n propagationContextFromHeaders,\n stackParserFromStackParserOptions,\n} from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\n\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOtel } from './initOtel';\n\n/** Get the default integrations for the Node Experimental SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n // TODO\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n modulesIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n ...(hasTracingEnabled(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): void {\n const clientOptions = getClientOptions(options);\n\n if (clientOptions.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n const client = new NodeClient(clientOptions);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n if (isEnabled(client)) {\n client.init();\n }\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n updateScopeFromEnvVariables();\n\n if (options.spotlight) {\n // force integrations to be setup even if no DSN was set\n // If they have already been added before, they will be ignored anyhow\n const integrations = client.getOptions().integrations;\n for (const integration of integrations) {\n client.addIntegration(integration);\n }\n client.addIntegration(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n // Always init Otel, even if tracing is disabled, because we need it for trace propagation & the HTTP integration\n initOtel();\n}\n\nfunction getClientOptions(options: NodeOptions): NodeClientOptions {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n const release = getRelease(options.release);\n\n const autoSessionTracking =\n typeof release !== 'string'\n ? false\n : options.autoSessionTracking === undefined\n ? true\n : options.autoSessionTracking;\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n autoSessionTracking,\n tracesSampleRate,\n });\n\n const clientOptions: NodeClientOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n const sentryUseEnvironment = (process.env.SENTRY_USE_ENVIRONMENT || '').toLowerCase();\n if (!['false', 'n', 'no', 'off', '0'].includes(sentryUseEnvironment)) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n\n/**\n * Enable automatic Session Tracking for the node process.\n */\nfunction startSessionTracking(): void {\n const client = getClient<NodeClient>();\n if (client && client.getOptions().autoSessionTracking) {\n client.initSessionFlusher();\n }\n\n startSession();\n\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // such as calling process.exit() or uncaught exceptions.\n // Ref: https://nodejs.org/api/process.html#process_event_beforeexit\n process.on('beforeExit', () => {\n const session = getIsolationScope().getSession();\n\n // Only call endSession, if the Session exists on Scope and SessionStatus is not a\n // Terminal Status i.e. Exited or Crashed because\n // \"When a session is moved away from ok it must not be updated anymore.\"\n // Ref: https://develop.sentry.dev/sdk/sessions/\n if (session && session.status !== 'ok') {\n endSession();\n }\n });\n}\n\nfunction isEnabled(client: Client): boolean {\n return client.getOptions().enabled !== false && client.getTransport() !== undefined;\n}\n"],"names":["inboundFiltersIntegration","functionToStringIntegration","linkedErrorsIntegration","requestDataIntegration","consoleIntegration","httpIntegration","nativeNodeFetchIntegration","onUncaughtExceptionIntegration","onUnhandledRejectionIntegration","contextLinesIntegration","localVariablesIntegration","nodeContextIntegration","modulesIntegration","hasTracingEnabled","getAutoPerformanceIntegrations","DEBUG_BUILD","logger","consoleSandbox","setOpenTelemetryContextAsyncContextStrategy","getCurrentScope","client","NodeClient","spotlightIntegration","initOtel","dropUndefinedKeys","makeNodeTransport","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","getSentryRelease","propagationContextFromHeaders","getClient","startSession","getIsolationScope","endSession"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyCA;AACO,SAAS,sBAAsB,CAAC,OAAO,EAA0B;AACxE;AACA,EAAE,OAAO;AACT;AACA,IAAIA,8BAAyB,EAAE;AAC/B,IAAIC,gCAA2B,EAAE;AACjC,IAAIC,4BAAuB,EAAE;AAC7B,IAAIC,2BAAsB,EAAE;AAC5B;AACA,IAAIC,4BAAkB,EAAE;AACxB,IAAIC,oBAAe,EAAE;AACrB,IAAIC,oCAA0B,EAAE;AAChC;AACA,IAAIC,kDAA8B,EAAE;AACpC,IAAIC,oDAA+B,EAAE;AACrC;AACA,IAAIC,oCAAuB,EAAE;AAC7B,IAAIC,+BAAyB,EAAE;AAC/B,IAAIC,8BAAsB,EAAE;AAC5B,IAAIC,0BAAkB,EAAE;AACxB,IAAIP,oBAAe,EAAE;AACrB,IAAIC,oCAA0B,EAAE;AAChC,IAAI,IAAIO,sBAAiB,CAAC,OAAO,CAAA,GAAIC,sCAA8B,EAAC,GAAI,EAAE,CAAC;AAC3E,GAAG,CAAA;AACH,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,IA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@opentelemetry/api');
|
|
4
|
-
const resources = require('@opentelemetry/resources');
|
|
5
|
-
const sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
6
|
-
const semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
7
|
-
const core = require('@sentry/core');
|
|
8
|
-
const opentelemetry = require('@sentry/opentelemetry');
|
|
9
|
-
const utils = require('@sentry/utils');
|
|
10
|
-
const debugBuild = require('../debug-build.js');
|
|
11
|
-
const contextManager = require('../otel/contextManager.js');
|
|
12
|
-
const api = require('./api.js');
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Initialize OpenTelemetry for Node.
|
|
16
|
-
*/
|
|
17
|
-
function initOtel() {
|
|
18
|
-
const client = api.getClient();
|
|
19
|
-
|
|
20
|
-
if (!client) {
|
|
21
|
-
debugBuild.DEBUG_BUILD &&
|
|
22
|
-
utils.logger.warn(
|
|
23
|
-
'No client available, skipping OpenTelemetry setup. This probably means that `Sentry.init()` was not called before `initOtel()`.',
|
|
24
|
-
);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (client.getOptions().debug) {
|
|
29
|
-
const otelLogger = new Proxy(utils.logger , {
|
|
30
|
-
get(target, prop, receiver) {
|
|
31
|
-
const actualProp = prop === 'verbose' ? 'debug' : prop;
|
|
32
|
-
return Reflect.get(target, actualProp, receiver);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
api$1.diag.setLogger(otelLogger, api$1.DiagLogLevel.DEBUG);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
opentelemetry.setupEventContextTrace(client);
|
|
40
|
-
|
|
41
|
-
const provider = setupOtel(client);
|
|
42
|
-
client.traceProvider = provider;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Just exported for tests. */
|
|
46
|
-
function setupOtel(client) {
|
|
47
|
-
// Create and configure NodeTracerProvider
|
|
48
|
-
const provider = new sdkTraceBase.BasicTracerProvider({
|
|
49
|
-
sampler: new opentelemetry.SentrySampler(client),
|
|
50
|
-
resource: new resources.Resource({
|
|
51
|
-
[semanticConventions.SemanticResourceAttributes.SERVICE_NAME]: 'node-experimental',
|
|
52
|
-
[semanticConventions.SemanticResourceAttributes.SERVICE_NAMESPACE]: 'sentry',
|
|
53
|
-
[semanticConventions.SemanticResourceAttributes.SERVICE_VERSION]: core.SDK_VERSION,
|
|
54
|
-
}),
|
|
55
|
-
forceFlushTimeoutMillis: 500,
|
|
56
|
-
});
|
|
57
|
-
provider.addSpanProcessor(new opentelemetry.SentrySpanProcessor());
|
|
58
|
-
|
|
59
|
-
// Initialize the provider
|
|
60
|
-
provider.register({
|
|
61
|
-
propagator: new opentelemetry.SentryPropagator(),
|
|
62
|
-
contextManager: new contextManager.SentryContextManager(),
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return provider;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
exports.initOtel = initOtel;
|
|
69
|
-
exports.setupOtel = setupOtel;
|
|
70
|
-
//# sourceMappingURL=initOtel.js.map
|
package/cjs/sdk/initOtel.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initOtel.js","sources":["../../../src/sdk/initOtel.ts"],"sourcesContent":["import { DiagLogLevel, diag } from '@opentelemetry/api';\nimport { Resource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';\nimport { SDK_VERSION } from '@sentry/core';\nimport { SentryPropagator, SentrySampler, SentrySpanProcessor, setupEventContextTrace } from '@sentry/opentelemetry';\nimport { logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from '../debug-build';\nimport { SentryContextManager } from '../otel/contextManager';\nimport { getClient } from './api';\nimport type { NodeClient } from './client';\n\n/**\n * Initialize OpenTelemetry for Node.\n */\nexport function initOtel(): void {\n const client = getClient<NodeClient>();\n\n if (!client) {\n DEBUG_BUILD &&\n logger.warn(\n 'No client available, skipping OpenTelemetry setup. This probably means that `Sentry.init()` was not called before `initOtel()`.',\n );\n return;\n }\n\n if (client.getOptions().debug) {\n const otelLogger = new Proxy(logger as typeof logger & { verbose: (typeof logger)['debug'] }, {\n get(target, prop, receiver) {\n const actualProp = prop === 'verbose' ? 'debug' : prop;\n return Reflect.get(target, actualProp, receiver);\n },\n });\n\n diag.setLogger(otelLogger, DiagLogLevel.DEBUG);\n }\n\n setupEventContextTrace(client);\n\n const provider = setupOtel(client);\n client.traceProvider = provider;\n}\n\n/** Just exported for tests. */\nexport function setupOtel(client: NodeClient): BasicTracerProvider {\n // Create and configure NodeTracerProvider\n const provider = new BasicTracerProvider({\n sampler: new SentrySampler(client),\n resource: new Resource({\n [SemanticResourceAttributes.SERVICE_NAME]: 'node-experimental',\n [SemanticResourceAttributes.SERVICE_NAMESPACE]: 'sentry',\n [SemanticResourceAttributes.SERVICE_VERSION]: SDK_VERSION,\n }),\n forceFlushTimeoutMillis: 500,\n });\n provider.addSpanProcessor(new SentrySpanProcessor());\n\n // Initialize the provider\n provider.register({\n propagator: new SentryPropagator(),\n contextManager: new SentryContextManager(),\n });\n\n return provider;\n}\n"],"names":["getClient","DEBUG_BUILD","logger","diag","DiagLogLevel","setupEventContextTrace","BasicTracerProvider","SentrySampler","Resource","SemanticResourceAttributes","SDK_VERSION","SentrySpanProcessor","SentryPropagator","SentryContextManager"],"mappings":";;;;;;;;;;;;;AAaA;AACA;AACA;AACO,SAAS,QAAQ,GAAS;AACjC,EAAE,MAAM,MAAA,GAASA,aAAS,EAAc,CAAA;AACxC;AACA,EAAE,IAAI,CAAC,MAAM,EAAE;AACf,IAAIC,sBAAY;AAChB,MAAMC,YAAM,CAAC,IAAI;AACjB,QAAQ,iIAAiI;AACzI,OAAO,CAAA;AACP,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE;AACjC,IAAI,MAAM,UAAW,GAAE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C,CAAA;AACJ;AACA,EAAE,OAAO,QAAQ,CAAA;AACjB;;;;;"}
|
package/cjs/sdk/scope.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
const api = require('@opentelemetry/api');
|
|
4
|
-
const opentelemetry = require('@sentry/opentelemetry');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Update the active isolation scope.
|
|
8
|
-
* Should be used with caution!
|
|
9
|
-
*/
|
|
10
|
-
function setIsolationScope(isolationScope) {
|
|
11
|
-
const scopes = opentelemetry.getScopesFromContext(api.context.active());
|
|
12
|
-
if (scopes) {
|
|
13
|
-
scopes.isolationScope = isolationScope;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.setIsolationScope = setIsolationScope;
|
|
18
|
-
//# sourceMappingURL=scope.js.map
|
package/cjs/sdk/scope.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sources":["../../../src/sdk/scope.ts"],"sourcesContent":["import { context } from '@opentelemetry/api';\nimport { getScopesFromContext } from '@sentry/opentelemetry';\nimport type { Scope } from '@sentry/types';\n\n/**\n * Update the active isolation scope.\n * Should be used with caution!\n */\nexport function setIsolationScope(isolationScope: Scope): void {\n const scopes = getScopesFromContext(context.active());\n if (scopes) {\n scopes.isolationScope = isolationScope;\n }\n}\n"],"names":["getScopesFromContext","context"],"mappings":";;;;;AAIA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,cAAc,EAAe;AAC/D,EAAE,MAAM,MAAO,GAAEA,kCAAoB,CAACC,WAAO,CAAC,MAAM,EAAE,CAAC,CAAA;AACvD,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,MAAM,CAAC,cAAe,GAAE,cAAc,CAAA;AAC1C,GAAE;AACF;;;;"}
|
package/cjs/transports/http.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
var {
|
|
2
|
-
_nullishCoalesce
|
|
3
|
-
} = require('@sentry/utils');
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
|
-
|
|
7
|
-
const http = require('http');
|
|
8
|
-
const https = require('https');
|
|
9
|
-
const stream = require('stream');
|
|
10
|
-
const zlib = require('zlib');
|
|
11
|
-
const core = require('@sentry/core');
|
|
12
|
-
const utils = require('@sentry/utils');
|
|
13
|
-
const index = require('../proxy/index.js');
|
|
14
|
-
|
|
15
|
-
// Estimated maximum size for reasonable standalone event
|
|
16
|
-
const GZIP_THRESHOLD = 1024 * 32;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Gets a stream from a Uint8Array or string
|
|
20
|
-
* Readable.from is ideal but was added in node.js v12.3.0 and v10.17.0
|
|
21
|
-
*/
|
|
22
|
-
function streamFromBody(body) {
|
|
23
|
-
return new stream.Readable({
|
|
24
|
-
read() {
|
|
25
|
-
this.push(body);
|
|
26
|
-
this.push(null);
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.
|
|
33
|
-
*/
|
|
34
|
-
function makeNodeTransport(options) {
|
|
35
|
-
let urlSegments;
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
urlSegments = new URL(options.url);
|
|
39
|
-
} catch (e) {
|
|
40
|
-
utils.consoleSandbox(() => {
|
|
41
|
-
// eslint-disable-next-line no-console
|
|
42
|
-
console.warn(
|
|
43
|
-
'[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.',
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
return core.createTransport(options, () => Promise.resolve({}));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const isHttps = urlSegments.protocol === 'https:';
|
|
50
|
-
|
|
51
|
-
// Proxy prioritization: http => `options.proxy` | `process.env.http_proxy`
|
|
52
|
-
// Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy`
|
|
53
|
-
const proxy = applyNoProxyOption(
|
|
54
|
-
urlSegments,
|
|
55
|
-
options.proxy || (isHttps ? process.env.https_proxy : undefined) || process.env.http_proxy,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const nativeHttpModule = isHttps ? https : http;
|
|
59
|
-
const keepAlive = options.keepAlive === undefined ? false : options.keepAlive;
|
|
60
|
-
|
|
61
|
-
// TODO(v7): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node
|
|
62
|
-
// versions(>= 8) as they had memory leaks when using it: #2555
|
|
63
|
-
const agent = proxy
|
|
64
|
-
? (new index.HttpsProxyAgent(proxy) )
|
|
65
|
-
: new nativeHttpModule.Agent({ keepAlive, maxSockets: 30, timeout: 2000 });
|
|
66
|
-
|
|
67
|
-
const requestExecutor = createRequestExecutor(options, _nullishCoalesce(options.httpModule, () => ( nativeHttpModule)), agent);
|
|
68
|
-
return core.createTransport(options, requestExecutor);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Honors the `no_proxy` env variable with the highest priority to allow for hosts exclusion.
|
|
73
|
-
*
|
|
74
|
-
* @param transportUrl The URL the transport intends to send events to.
|
|
75
|
-
* @param proxy The client configured proxy.
|
|
76
|
-
* @returns A proxy the transport should use.
|
|
77
|
-
*/
|
|
78
|
-
function applyNoProxyOption(transportUrlSegments, proxy) {
|
|
79
|
-
const { no_proxy } = process.env;
|
|
80
|
-
|
|
81
|
-
const urlIsExemptFromProxy =
|
|
82
|
-
no_proxy &&
|
|
83
|
-
no_proxy
|
|
84
|
-
.split(',')
|
|
85
|
-
.some(
|
|
86
|
-
exemption => transportUrlSegments.host.endsWith(exemption) || transportUrlSegments.hostname.endsWith(exemption),
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
if (urlIsExemptFromProxy) {
|
|
90
|
-
return undefined;
|
|
91
|
-
} else {
|
|
92
|
-
return proxy;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Creates a RequestExecutor to be used with `createTransport`.
|
|
98
|
-
*/
|
|
99
|
-
function createRequestExecutor(
|
|
100
|
-
options,
|
|
101
|
-
httpModule,
|
|
102
|
-
agent,
|
|
103
|
-
) {
|
|
104
|
-
const { hostname, pathname, port, protocol, search } = new URL(options.url);
|
|
105
|
-
return function makeRequest(request) {
|
|
106
|
-
return new Promise((resolve, reject) => {
|
|
107
|
-
let body = streamFromBody(request.body);
|
|
108
|
-
|
|
109
|
-
const headers = { ...options.headers };
|
|
110
|
-
|
|
111
|
-
if (request.body.length > GZIP_THRESHOLD) {
|
|
112
|
-
headers['content-encoding'] = 'gzip';
|
|
113
|
-
body = body.pipe(zlib.createGzip());
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const req = httpModule.request(
|
|
117
|
-
{
|
|
118
|
-
method: 'POST',
|
|
119
|
-
agent,
|
|
120
|
-
headers,
|
|
121
|
-
hostname,
|
|
122
|
-
path: `${pathname}${search}`,
|
|
123
|
-
port,
|
|
124
|
-
protocol,
|
|
125
|
-
ca: options.caCerts,
|
|
126
|
-
},
|
|
127
|
-
res => {
|
|
128
|
-
res.on('data', () => {
|
|
129
|
-
// Drain socket
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
res.on('end', () => {
|
|
133
|
-
// Drain socket
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
res.setEncoding('utf8');
|
|
137
|
-
|
|
138
|
-
// "Key-value pairs of header names and values. Header names are lower-cased."
|
|
139
|
-
// https://nodejs.org/api/http.html#http_message_headers
|
|
140
|
-
const retryAfterHeader = _nullishCoalesce(res.headers['retry-after'], () => ( null));
|
|
141
|
-
const rateLimitsHeader = _nullishCoalesce(res.headers['x-sentry-rate-limits'], () => ( null));
|
|
142
|
-
|
|
143
|
-
resolve({
|
|
144
|
-
statusCode: res.statusCode,
|
|
145
|
-
headers: {
|
|
146
|
-
'retry-after': retryAfterHeader,
|
|
147
|
-
'x-sentry-rate-limits': Array.isArray(rateLimitsHeader) ? rateLimitsHeader[0] : rateLimitsHeader,
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
req.on('error', reject);
|
|
154
|
-
body.pipe(req);
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
exports.makeNodeTransport = makeNodeTransport;
|
|
160
|
-
//# sourceMappingURL=http.js.map
|