@sentry/node 8.18.0 → 8.20.0

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.
Files changed (48) hide show
  1. package/build/cjs/integrations/anr/index.js +1 -1
  2. package/build/cjs/integrations/http.js +2 -2
  3. package/build/cjs/integrations/http.js.map +1 -1
  4. package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
  5. package/build/cjs/integrations/node-fetch.js +62 -2
  6. package/build/cjs/integrations/node-fetch.js.map +1 -1
  7. package/build/cjs/integrations/tracing/express.js +6 -5
  8. package/build/cjs/integrations/tracing/express.js.map +1 -1
  9. package/build/cjs/sdk/client.js +60 -3
  10. package/build/cjs/sdk/client.js.map +1 -1
  11. package/build/cjs/sdk/index.js +3 -0
  12. package/build/cjs/sdk/index.js.map +1 -1
  13. package/build/cjs/sdk/initOtel.js +1 -1
  14. package/build/cjs/sdk/initOtel.js.map +1 -1
  15. package/build/esm/integrations/anr/index.js +1 -1
  16. package/build/esm/integrations/anr/worker-script.js +2 -2
  17. package/build/esm/integrations/http.js +2 -2
  18. package/build/esm/integrations/http.js.map +1 -1
  19. package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
  20. package/build/esm/integrations/local-variables/worker-script.js +1 -1
  21. package/build/esm/integrations/node-fetch.js +61 -4
  22. package/build/esm/integrations/node-fetch.js.map +1 -1
  23. package/build/esm/integrations/tracing/express.js +6 -5
  24. package/build/esm/integrations/tracing/express.js.map +1 -1
  25. package/build/esm/sdk/client.js +60 -4
  26. package/build/esm/sdk/client.js.map +1 -1
  27. package/build/esm/sdk/index.js +3 -0
  28. package/build/esm/sdk/index.js.map +1 -1
  29. package/build/esm/sdk/initOtel.js +1 -1
  30. package/build/esm/sdk/initOtel.js.map +1 -1
  31. package/build/types/integrations/http.d.ts +9 -3
  32. package/build/types/integrations/http.d.ts.map +1 -1
  33. package/build/types/integrations/node-fetch.d.ts.map +1 -1
  34. package/build/types/integrations/tracing/express.d.ts +7 -6
  35. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  36. package/build/types/sdk/client.d.ts +10 -2
  37. package/build/types/sdk/client.d.ts.map +1 -1
  38. package/build/types/sdk/index.d.ts.map +1 -1
  39. package/build/types/sdk/initOtel.d.ts +1 -0
  40. package/build/types/sdk/initOtel.d.ts.map +1 -1
  41. package/build/types/types.d.ts +6 -2
  42. package/build/types/types.d.ts.map +1 -1
  43. package/build/types-ts3.8/integrations/http.d.ts +9 -3
  44. package/build/types-ts3.8/integrations/tracing/express.d.ts +7 -6
  45. package/build/types-ts3.8/sdk/client.d.ts +10 -2
  46. package/build/types-ts3.8/sdk/initOtel.d.ts +1 -0
  47. package/build/types-ts3.8/types.d.ts +6 -2
  48. package/package.json +7 -6
@@ -1 +1 @@
1
- {"version":3,"file":"initOtel.js","sources":["../../../src/sdk/initOtel.ts"],"sourcesContent":["import moduleModule from 'module';\nimport { DiagLogLevel, diag } from '@opentelemetry/api';\nimport { Resource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport {\n SEMRESATTRS_SERVICE_NAME,\n SEMRESATTRS_SERVICE_NAMESPACE,\n SEMRESATTRS_SERVICE_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport { SDK_VERSION } from '@sentry/core';\nimport { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry';\nimport { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/utils';\n\nimport { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing';\nimport { SentryContextManager } from '../otel/contextManager';\nimport type { EsmLoaderHookOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport type { NodeClient } from './client';\n\ndeclare const __IMPORT_META_URL_REPLACEMENT__: string;\n\n/**\n * Initialize OpenTelemetry for Node.\n */\nexport function initOpenTelemetry(client: NodeClient): void {\n if (client.getOptions().debug) {\n setupOpenTelemetryLogger();\n }\n\n const provider = setupOtel(client);\n client.traceProvider = provider;\n}\n\n/** Initialize the ESM loader. */\nexport function maybeInitializeEsmLoader(esmHookConfig?: EsmLoaderHookOptions): void {\n const [nodeMajor = 0, nodeMinor = 0] = process.versions.node.split('.').map(Number);\n\n // Register hook was added in v20.6.0 and v18.19.0\n if (nodeMajor >= 22 || (nodeMajor === 20 && nodeMinor >= 6) || (nodeMajor === 18 && nodeMinor >= 19)) {\n // We need to work around using import.meta.url directly because jest complains about it.\n const importMetaUrl =\n typeof __IMPORT_META_URL_REPLACEMENT__ !== 'undefined' ? __IMPORT_META_URL_REPLACEMENT__ : undefined;\n\n if (!GLOBAL_OBJ._sentryEsmLoaderHookRegistered && importMetaUrl) {\n try {\n // @ts-expect-error register is available in these versions\n moduleModule.register('import-in-the-middle/hook.mjs', importMetaUrl, { data: esmHookConfig });\n GLOBAL_OBJ._sentryEsmLoaderHookRegistered = true;\n } catch (error) {\n logger.warn('Failed to register ESM hook', error);\n }\n }\n } else {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] You are using Node.js in ESM mode (\"import syntax\"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS (\"require() syntax\"), or use version 7.x of the Sentry Node.js SDK.',\n );\n });\n }\n}\n\ninterface NodePreloadOptions {\n debug?: boolean;\n integrations?: string[];\n}\n\n/**\n * Preload OpenTelemetry for Node.\n * This can be used to preload instrumentation early, but set up Sentry later.\n * By preloading the OTEL instrumentation wrapping still happens early enough that everything works.\n */\nexport function preloadOpenTelemetry(options: NodePreloadOptions = {}): void {\n const { debug } = options;\n\n if (debug) {\n logger.enable();\n setupOpenTelemetryLogger();\n }\n\n if (!isCjs()) {\n maybeInitializeEsmLoader();\n }\n\n // These are all integrations that we need to pre-load to ensure they are set up before any other code runs\n getPreloadMethods(options.integrations).forEach(fn => {\n fn();\n\n if (debug) {\n logger.log(`[Sentry] Preloaded ${fn.id} instrumentation`);\n }\n });\n}\n\nfunction getPreloadMethods(integrationNames?: string[]): ((() => void) & { id: string })[] {\n const instruments = getOpenTelemetryInstrumentationToPreload();\n\n if (!integrationNames) {\n return instruments;\n }\n\n return instruments.filter(instrumentation => integrationNames.includes(instrumentation.id));\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 [SEMRESATTRS_SERVICE_NAME]: 'node',\n [SEMRESATTRS_SERVICE_NAMESPACE]: 'sentry',\n [SEMRESATTRS_SERVICE_VERSION]: SDK_VERSION,\n }),\n forceFlushTimeoutMillis: 500,\n });\n provider.addSpanProcessor(\n new SentrySpanProcessor({\n timeout: client.getOptions().maxSpanWaitDuration,\n }),\n );\n\n // Initialize the provider\n provider.register({\n propagator: new SentryPropagator(),\n contextManager: new SentryContextManager(),\n });\n\n return provider;\n}\n\n/**\n * Setup the OTEL logger to use our own logger.\n */\nfunction setupOpenTelemetryLogger(): void {\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 // Disable diag, to ensure this works even if called multiple times\n diag.disable();\n diag.setLogger(otelLogger, DiagLogLevel.DEBUG);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,MAAM,EAAoB;AAC5D,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE;AACjC,IAAI,wBAAwB,EAAE,CAAA;AAC9B,GAAE;AACF;AACA,EAAE,MAAM,QAAS,GAAE,SAAS,CAAC,MAAM,CAAC,CAAA;AACpC,EAAE,MAAM,CAAC,aAAc,GAAE,QAAQ,CAAA;AACjC,CAAA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,aAAa,EAA+B;AACrF,EAAE,MAAM,CAAC,SAAA,GAAY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CAAC,mBAAmB;AACtD,KAAK,CAAC;AACN,GAAG,CAAA;AACH;AACA;AACA,EAAE,QAAQ,CAAC,QAAQ,CAAC;AACpB,IAAI,UAAU,EAAE,IAAI,gBAAgB,EAAE;AACtC,IAAI,cAAc,EAAE,IAAI,oBAAoB,EAAE;AAC9C,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,QAAQ,CAAA;AACjB,CAAA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,GAAS;AAC1C,EAAE,MAAM,UAAW,GAAE,IAAI,KAAK,CAAC,SAAiE;AAChG,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChC,MAAM,MAAM,aAAa,IAAA,KAAS,SAAU,GAAE,OAAQ,GAAE,IAAI,CAAA;AAC5D,MAAM,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;AACtD,KAAK;AACL,GAAG,CAAC,CAAA;AACJ;AACA;AACA,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAChB,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;AAChD;;;;"}
1
+ {"version":3,"file":"initOtel.js","sources":["../../../src/sdk/initOtel.ts"],"sourcesContent":["import moduleModule from 'module';\nimport { DiagLogLevel, diag } from '@opentelemetry/api';\nimport { Resource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport {\n SEMRESATTRS_SERVICE_NAME,\n SEMRESATTRS_SERVICE_NAMESPACE,\n SEMRESATTRS_SERVICE_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport { SDK_VERSION } from '@sentry/core';\nimport { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry';\nimport { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/utils';\n\nimport { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing';\nimport { SentryContextManager } from '../otel/contextManager';\nimport type { EsmLoaderHookOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport type { NodeClient } from './client';\n\ndeclare const __IMPORT_META_URL_REPLACEMENT__: string;\n\n/**\n * Initialize OpenTelemetry for Node.\n */\nexport function initOpenTelemetry(client: NodeClient): void {\n if (client.getOptions().debug) {\n setupOpenTelemetryLogger();\n }\n\n const provider = setupOtel(client);\n client.traceProvider = provider;\n}\n\n/** Initialize the ESM loader. */\nexport function maybeInitializeEsmLoader(esmHookConfig?: EsmLoaderHookOptions): void {\n const [nodeMajor = 0, nodeMinor = 0] = process.versions.node.split('.').map(Number);\n\n // Register hook was added in v20.6.0 and v18.19.0\n if (nodeMajor >= 22 || (nodeMajor === 20 && nodeMinor >= 6) || (nodeMajor === 18 && nodeMinor >= 19)) {\n // We need to work around using import.meta.url directly because jest complains about it.\n const importMetaUrl =\n typeof __IMPORT_META_URL_REPLACEMENT__ !== 'undefined' ? __IMPORT_META_URL_REPLACEMENT__ : undefined;\n\n if (!GLOBAL_OBJ._sentryEsmLoaderHookRegistered && importMetaUrl) {\n try {\n // @ts-expect-error register is available in these versions\n moduleModule.register('import-in-the-middle/hook.mjs', importMetaUrl, { data: esmHookConfig });\n GLOBAL_OBJ._sentryEsmLoaderHookRegistered = true;\n } catch (error) {\n logger.warn('Failed to register ESM hook', error);\n }\n }\n } else {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] You are using Node.js in ESM mode (\"import syntax\"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS (\"require() syntax\"), or use version 7.x of the Sentry Node.js SDK.',\n );\n });\n }\n}\n\ninterface NodePreloadOptions {\n debug?: boolean;\n integrations?: string[];\n registerEsmLoaderHooks?: EsmLoaderHookOptions;\n}\n\n/**\n * Preload OpenTelemetry for Node.\n * This can be used to preload instrumentation early, but set up Sentry later.\n * By preloading the OTEL instrumentation wrapping still happens early enough that everything works.\n */\nexport function preloadOpenTelemetry(options: NodePreloadOptions = {}): void {\n const { debug } = options;\n\n if (debug) {\n logger.enable();\n setupOpenTelemetryLogger();\n }\n\n if (!isCjs()) {\n maybeInitializeEsmLoader(options.registerEsmLoaderHooks);\n }\n\n // These are all integrations that we need to pre-load to ensure they are set up before any other code runs\n getPreloadMethods(options.integrations).forEach(fn => {\n fn();\n\n if (debug) {\n logger.log(`[Sentry] Preloaded ${fn.id} instrumentation`);\n }\n });\n}\n\nfunction getPreloadMethods(integrationNames?: string[]): ((() => void) & { id: string })[] {\n const instruments = getOpenTelemetryInstrumentationToPreload();\n\n if (!integrationNames) {\n return instruments;\n }\n\n return instruments.filter(instrumentation => integrationNames.includes(instrumentation.id));\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 [SEMRESATTRS_SERVICE_NAME]: 'node',\n [SEMRESATTRS_SERVICE_NAMESPACE]: 'sentry',\n [SEMRESATTRS_SERVICE_VERSION]: SDK_VERSION,\n }),\n forceFlushTimeoutMillis: 500,\n });\n provider.addSpanProcessor(\n new SentrySpanProcessor({\n timeout: client.getOptions().maxSpanWaitDuration,\n }),\n );\n\n // Initialize the provider\n provider.register({\n propagator: new SentryPropagator(),\n contextManager: new SentryContextManager(),\n });\n\n return provider;\n}\n\n/**\n * Setup the OTEL logger to use our own logger.\n */\nfunction setupOpenTelemetryLogger(): void {\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 // Disable diag, to ensure this works even if called multiple times\n diag.disable();\n diag.setLogger(otelLogger, DiagLogLevel.DEBUG);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBA;AACA;AACA;AACO,SAAS,iBAAiB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M,CAAC;AACtC,IAAI,QAAQ,EAAE,IAAI,QAAQ,CAAC;AAC3B,MAAM,CAAC,wBAAwB,GAAG,MAAM;AACxC,MAAM,CAAC,6BAA6B,GAAG,QAAQ;AAC/C,MAAM,CAAC,2BAA2B,GAAG,WAAW;AAChD,KAAK,CAAC;AACN,IAAI,uBAAuB,EAAE,GAAG;AAChC,GAAG,CAAC,CAAA;AACJ,EAAE,QAAQ,CAAC,gBAAgB;AAC3B,IAAI,IAAI,mBAAmB,CAAC;AAC5B,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,mBAAmB;AACtD,KAAK,CAAC;AACN,GAAG,CAAA;AACH;AACA;AACA,EAAE,QAAQ,CAAC,QAAQ,CAAC;AACpB,IAAI,UAAU,EAAE,IAAI,gBAAgB,EAAE;AACtC,IAAI,cAAc,EAAE,IAAI,oBAAoB,EAAE;AAC9C,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,QAAQ,CAAA;AACjB,CAAA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,GAAS;AAC1C,EAAE,MAAM,UAAW,GAAE,IAAI,KAAK,CAAC,SAAiE;AAChG,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChC,MAAM,MAAM,aAAa,IAAA,KAAS,SAAU,GAAE,OAAQ,GAAE,IAAI,CAAA;AAC5D,MAAM,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;AACtD,KAAK;AACL,GAAG,CAAC,CAAA;AACJ;AACA;AACA,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAChB,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;AAChD;;;;"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type { ClientRequest, ServerResponse } from 'node:http';
2
+ import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';
3
3
  import type { Span } from '@opentelemetry/api';
4
4
  import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
5
5
  import type { HTTPModuleRequestIncomingMessage } from '../transports/http-module';
@@ -15,16 +15,22 @@ interface HttpOptions {
15
15
  *
16
16
  * The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.
17
17
  * For example: `'https://someService.com/users/details?id=123'`
18
+ *
19
+ * The `request` param contains the original {@type RequestOptions} object used to make the outgoing request.
20
+ * You can use it to filter on additional properties like method, headers, etc.
18
21
  */
19
- ignoreOutgoingRequests?: (url: string) => boolean;
22
+ ignoreOutgoingRequests?: (url: string, request: RequestOptions) => boolean;
20
23
  /**
21
24
  * Do not capture spans or breadcrumbs for incoming HTTP requests to URLs where the given callback returns `true`.
22
25
  * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.
23
26
  *
24
27
  * The `urlPath` param consists of the URL path and query string (if any) of the incoming request.
25
28
  * For example: `'/users/details?id=123'`
29
+ *
30
+ * The `request` param contains the original {@type IncomingMessage} object of the incoming request.
31
+ * You can use it to filter on additional properties like method, headers, etc.
26
32
  */
27
- ignoreIncomingRequests?: (urlPath: string) => boolean;
33
+ ignoreIncomingRequests?: (urlPath: string, request: IncomingMessage) => boolean;
28
34
  /**
29
35
  * Additional instrumentation options that are passed to the underlying HttpInstrumentation.
30
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/integrations/http.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAkB1E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAMlF,UAAU,WAAW;IACnB;;;OAGG;IACH,WAAW,CAAC,EAA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yDD,eAAO,MAAM,0BAA0B,iFAAiD,CAAC"}
1
+ {"version":3,"file":"node-fetch.d.ts","sourceRoot":"","sources":["../../../src/integrations/node-fetch.ts"],"names":[],"mappings":"AA8BA,UAAU,gBAAgB;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAiGD,eAAO,MAAM,0BAA0B,iFAAiD,CAAC"}
@@ -19,22 +19,23 @@ interface MiddlewareError extends Error {
19
19
  };
20
20
  }
21
21
  type ExpressMiddleware = (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
22
- /**
23
- * An Express-compatible error handler.
24
- */
25
- export declare function expressErrorHandler(options?: {
22
+ interface ExpressHandlerOptions {
26
23
  /**
27
24
  * Callback method deciding whether error should be captured and sent to Sentry
28
25
  * @param error Captured middleware error
29
26
  */
30
27
  shouldHandleError?(this: void, error: MiddlewareError): boolean;
31
- }): ExpressMiddleware;
28
+ }
29
+ /**
30
+ * An Express-compatible error handler.
31
+ */
32
+ export declare function expressErrorHandler(options?: ExpressHandlerOptions): ExpressMiddleware;
32
33
  /**
33
34
  * Setup an error handler for Express.
34
35
  * The error handler must be before any other middleware and after all controllers.
35
36
  */
36
37
  export declare function setupExpressErrorHandler(app: {
37
38
  use: (middleware: ExpressMiddleware) => unknown;
38
- }): void;
39
+ }, options?: ExpressHandlerOptions): void;
39
40
  export {};
40
41
  //# sourceMappingURL=express.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/express.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAcvC,eAAO,MAAM,iBAAiB;;CAoC7B,CAAC;AAWF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,2CAAyC,CAAC;AAE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,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC9B,CAAC;CACH;AAED,KAAK,iBAAiB,GAAG,CACvB,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,KACnC,IAAI,CAAC;AAEV,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC;CACjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,iBAAiB,CAqCtF;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE;IAAE,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAA;CAAE,EACxD,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAGN"}
@@ -6,12 +6,20 @@ import type { NodeClientOptions } from '../types';
6
6
  export declare class NodeClient extends ServerRuntimeClient<NodeClientOptions> {
7
7
  traceProvider: BasicTracerProvider | undefined;
8
8
  private _tracer;
9
+ private _clientReportInterval;
10
+ private _clientReportOnExitFlushListener;
9
11
  constructor(options: NodeClientOptions);
10
12
  /** Get the OTEL tracer. */
11
13
  get tracer(): Tracer;
14
+ flush(timeout?: number): Promise<boolean>;
15
+ close(timeout?: number | undefined): PromiseLike<boolean>;
12
16
  /**
13
- * @inheritDoc
17
+ * Will start tracking client reports for this client.
18
+ *
19
+ * NOTICE: This method will create an interval that is periodically called and attach a `process.on('beforeExit')`
20
+ * hook. To clean up these resources, call `.close()` when you no longer intend to use the client. Not doing so will
21
+ * result in a memory leak.
14
22
  */
15
- flush(timeout?: number): Promise<boolean>;
23
+ startClientReportTracking(): void;
16
24
  }
17
25
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/sdk/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAe,mBAAmB,EAAoB,MAAM,cAAc,CAAC;AAGlF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,2DAA2D;AAC3D,qBAAa,UAAW,SAAQ,mBAAmB,CAAC,iBAAiB,CAAC;IAC7D,aAAa,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACtD,OAAO,CAAC,OAAO,CAAqB;gBAEjB,OAAO,EAAE,iBAAiB;IAiB7C,2BAA2B;IAC3B,IAAW,MAAM,IAAI,MAAM,CAW1B;IAED;;OAEG;IACU,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAUvD"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/sdk/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAe,mBAAmB,EAAoB,MAAM,cAAc,CAAC;AAIlF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD,2DAA2D;AAC3D,qBAAa,UAAW,SAAQ,mBAAmB,CAAC,iBAAiB,CAAC;IAC7D,aAAa,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACtD,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,qBAAqB,CAA6B;IAC1D,OAAO,CAAC,gCAAgC,CAA2B;gBAEhD,OAAO,EAAE,iBAAiB;IAiB7C,2BAA2B;IAC3B,IAAW,MAAM,IAAI,MAAM,CAW1B;IAIY,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB/C,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC;IAYhE;;;;;;OAMG;IASI,yBAAyB,IAAI,IAAI;CAoBzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAU,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAsBlE,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOtC;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,WAAW,EAAE,CAoBxE;AAED,qDAAqD;AACrD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,EAAE,CAStE;AAYD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,UAAU,GAAG,SAAS,CAElF;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,UAAU,CAEhG;AA2ED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAqBjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAU,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAsBlE,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOtC;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,WAAW,EAAE,CAoBxE;AAED,qDAAqD;AACrD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,EAAE,CAStE;AAYD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,UAAU,GAAG,SAAS,CAElF;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,UAAU,CAEhG;AA6ED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAqBjD"}
@@ -10,6 +10,7 @@ export declare function maybeInitializeEsmLoader(esmHookConfig?: EsmLoaderHookOp
10
10
  interface NodePreloadOptions {
11
11
  debug?: boolean;
12
12
  integrations?: string[];
13
+ registerEsmLoaderHooks?: EsmLoaderHookOptions;
13
14
  }
14
15
  /**
15
16
  * Preload OpenTelemetry for Node.
@@ -1 +1 @@
1
- {"version":3,"file":"initOtel.d.ts","sourceRoot":"","sources":["../../../src/sdk/initOtel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAYpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAO1D;AAED,iCAAiC;AACjC,wBAAgB,wBAAwB,CAAC,aAAa,CAAC,EAAE,oBAAoB,GAAG,IAAI,CA0BnF;AAED,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAoB3E;AAYD,+BAA+B;AAC/B,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAwBjE"}
1
+ {"version":3,"file":"initOtel.d.ts","sourceRoot":"","sources":["../../../src/sdk/initOtel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAYpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAO1D;AAED,iCAAiC;AACjC,wBAAgB,wBAAwB,CAAC,aAAa,CAAC,EAAE,oBAAoB,GAAG,IAAI,CA0BnF;AAED,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,sBAAsB,CAAC,EAAE,oBAAoB,CAAC;CAC/C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAoB3E;AAYD,+BAA+B;AAC/B,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAwBjE"}
@@ -3,8 +3,8 @@ import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
3
  import type { ClientOptions, Options, SamplingContext, Scope, Span, TracePropagationTargets } from '@sentry/types';
4
4
  import type { NodeTransportOptions } from './transports';
5
5
  export interface EsmLoaderHookOptions {
6
- include?: string[];
7
- exclude?: string[];
6
+ include?: Array<string | RegExp>;
7
+ exclude?: Array<string | RegExp>;
8
8
  }
9
9
  export interface BaseNodeOptions {
10
10
  /**
@@ -97,6 +97,10 @@ export interface BaseNodeOptions {
97
97
  * Defaults to `true`.
98
98
  */
99
99
  registerEsmLoaderHooks?: boolean | EsmLoaderHookOptions;
100
+ /**
101
+ * Configures in which interval client reports will be flushed. Defaults to `60_000` (milliseconds).
102
+ */
103
+ clientReportFlushInterval?: number;
100
104
  /** Callback that is executed when a fatal global error occurs. */
101
105
  onFatalError?(this: void, error: Error): void;
102
106
  }
@@ -1 +1 @@
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;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE7B;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;;;;;;;OAgBG;IACH,sBAAsB,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC;IAExD;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC,kEAAkE;IAClE,YAAY,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,oBAAoB,CAAC,EAAE,eAAe;CAAG;AAEtF;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa,CAAC,oBAAoB,CAAC,EAAE,eAAe;CAAG;AAElG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,KAAK,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { ClientRequest, ServerResponse } from 'node:http';
2
+ import { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } from 'node:http';
3
3
  import { Span } from '@opentelemetry/api';
4
4
  import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
5
5
  import { HTTPModuleRequestIncomingMessage } from '../transports/http-module';
@@ -15,16 +15,22 @@ interface HttpOptions {
15
15
  *
16
16
  * The `url` param contains the entire URL, including query string (if any), protocol, host, etc. of the outgoing request.
17
17
  * For example: `'https://someService.com/users/details?id=123'`
18
+ *
19
+ * The `request` param contains the original {@type RequestOptions} object used to make the outgoing request.
20
+ * You can use it to filter on additional properties like method, headers, etc.
18
21
  */
19
- ignoreOutgoingRequests?: (url: string) => boolean;
22
+ ignoreOutgoingRequests?: (url: string, request: RequestOptions) => boolean;
20
23
  /**
21
24
  * Do not capture spans or breadcrumbs for incoming HTTP requests to URLs where the given callback returns `true`.
22
25
  * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.
23
26
  *
24
27
  * The `urlPath` param consists of the URL path and query string (if any) of the incoming request.
25
28
  * For example: `'/users/details?id=123'`
29
+ *
30
+ * The `request` param contains the original {@type IncomingMessage} object of the incoming request.
31
+ * You can use it to filter on additional properties like method, headers, etc.
26
32
  */
27
- ignoreIncomingRequests?: (urlPath: string) => boolean;
33
+ ignoreIncomingRequests?: (urlPath: string, request: IncomingMessage) => boolean;
28
34
  /**
29
35
  * Additional instrumentation options that are passed to the underlying HttpInstrumentation.
30
36
  */
@@ -19,22 +19,23 @@ interface MiddlewareError extends Error {
19
19
  };
20
20
  }
21
21
  type ExpressMiddleware = (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
22
- /**
23
- * An Express-compatible error handler.
24
- */
25
- export declare function expressErrorHandler(options?: {
22
+ interface ExpressHandlerOptions {
26
23
  /**
27
24
  * Callback method deciding whether error should be captured and sent to Sentry
28
25
  * @param error Captured middleware error
29
26
  */
30
27
  shouldHandleError?(this: void, error: MiddlewareError): boolean;
31
- }): ExpressMiddleware;
28
+ }
29
+ /**
30
+ * An Express-compatible error handler.
31
+ */
32
+ export declare function expressErrorHandler(options?: ExpressHandlerOptions): ExpressMiddleware;
32
33
  /**
33
34
  * Setup an error handler for Express.
34
35
  * The error handler must be before any other middleware and after all controllers.
35
36
  */
36
37
  export declare function setupExpressErrorHandler(app: {
37
38
  use: (middleware: ExpressMiddleware) => unknown;
38
- }): void;
39
+ }, options?: ExpressHandlerOptions): void;
39
40
  export {};
40
41
  //# sourceMappingURL=express.d.ts.map
@@ -6,12 +6,20 @@ import { NodeClientOptions } from '../types';
6
6
  export declare class NodeClient extends ServerRuntimeClient<NodeClientOptions> {
7
7
  traceProvider: BasicTracerProvider | undefined;
8
8
  private _tracer;
9
+ private _clientReportInterval;
10
+ private _clientReportOnExitFlushListener;
9
11
  constructor(options: NodeClientOptions);
10
12
  /*Get the OTEL tracer. */
11
13
  readonly tracer: Tracer;
14
+ flush(timeout?: number): Promise<boolean>;
15
+ close(timeout?: number | undefined): PromiseLike<boolean>;
12
16
  /**
13
- * @inheritDoc
17
+ * Will start tracking client reports for this client.
18
+ *
19
+ * NOTICE: This method will create an interval that is periodically called and attach a `process.on('beforeExit')`
20
+ * hook. To clean up these resources, call `.close()` when you no longer intend to use the client. Not doing so will
21
+ * result in a memory leak.
14
22
  */
15
- flush(timeout?: number): Promise<boolean>;
23
+ startClientReportTracking(): void;
16
24
  }
17
25
  //# sourceMappingURL=client.d.ts.map
@@ -10,6 +10,7 @@ export declare function maybeInitializeEsmLoader(esmHookConfig?: EsmLoaderHookOp
10
10
  interface NodePreloadOptions {
11
11
  debug?: boolean;
12
12
  integrations?: string[];
13
+ registerEsmLoaderHooks?: EsmLoaderHookOptions;
13
14
  }
14
15
  /**
15
16
  * Preload OpenTelemetry for Node.
@@ -3,8 +3,8 @@ import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
3
  import { ClientOptions, Options, SamplingContext, Scope, Span, TracePropagationTargets } from '@sentry/types';
4
4
  import { NodeTransportOptions } from './transports';
5
5
  export interface EsmLoaderHookOptions {
6
- include?: string[];
7
- exclude?: string[];
6
+ include?: Array<string | RegExp>;
7
+ exclude?: Array<string | RegExp>;
8
8
  }
9
9
  export interface BaseNodeOptions {
10
10
  /**
@@ -97,6 +97,10 @@ export interface BaseNodeOptions {
97
97
  * Defaults to `true`.
98
98
  */
99
99
  registerEsmLoaderHooks?: boolean | EsmLoaderHookOptions;
100
+ /**
101
+ * Configures in which interval client reports will be flushed. Defaults to `60_000` (milliseconds).
102
+ */
103
+ clientReportFlushInterval?: number;
100
104
  /** Callback that is executed when a fatal global error occurs. */
101
105
  onFatalError?(this: void, error: Error): void;
102
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node",
3
- "version": "8.18.0",
3
+ "version": "8.20.0",
4
4
  "description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
@@ -87,11 +87,12 @@
87
87
  "@opentelemetry/resources": "^1.25.1",
88
88
  "@opentelemetry/sdk-trace-base": "^1.25.1",
89
89
  "@opentelemetry/semantic-conventions": "^1.25.1",
90
- "@prisma/instrumentation": "5.16.1",
91
- "@sentry/core": "8.18.0",
92
- "@sentry/opentelemetry": "8.18.0",
93
- "@sentry/types": "8.18.0",
94
- "@sentry/utils": "8.18.0"
90
+ "@prisma/instrumentation": "5.17.0",
91
+ "@sentry/core": "8.20.0",
92
+ "@sentry/opentelemetry": "8.20.0",
93
+ "@sentry/types": "8.20.0",
94
+ "@sentry/utils": "8.20.0",
95
+ "import-in-the-middle": "^1.10.0"
95
96
  },
96
97
  "devDependencies": {
97
98
  "@types/node": "^14.18.0"