@sentry/node 8.24.0 → 8.25.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 (35) hide show
  1. package/build/cjs/index.js +1 -0
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/anr/index.js +1 -1
  4. package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
  5. package/build/cjs/integrations/tracing/graphql.js +31 -0
  6. package/build/cjs/integrations/tracing/graphql.js.map +1 -1
  7. package/build/cjs/integrations/tracing/nest/helpers.js.map +1 -1
  8. package/build/cjs/integrations/tracing/nest/sentry-nest-instrumentation.js +53 -3
  9. package/build/cjs/integrations/tracing/nest/sentry-nest-instrumentation.js.map +1 -1
  10. package/build/esm/index.js +1 -1
  11. package/build/esm/integrations/anr/index.js +1 -1
  12. package/build/esm/integrations/anr/worker-script.js +2 -2
  13. package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
  14. package/build/esm/integrations/local-variables/worker-script.js +1 -1
  15. package/build/esm/integrations/tracing/graphql.js +32 -1
  16. package/build/esm/integrations/tracing/graphql.js.map +1 -1
  17. package/build/esm/integrations/tracing/nest/helpers.js.map +1 -1
  18. package/build/esm/integrations/tracing/nest/sentry-nest-instrumentation.js +53 -3
  19. package/build/esm/integrations/tracing/nest/sentry-nest-instrumentation.js.map +1 -1
  20. package/build/types/index.d.ts +1 -1
  21. package/build/types/index.d.ts.map +1 -1
  22. package/build/types/integrations/tracing/graphql.d.ts +15 -2
  23. package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
  24. package/build/types/integrations/tracing/nest/helpers.d.ts +3 -3
  25. package/build/types/integrations/tracing/nest/helpers.d.ts.map +1 -1
  26. package/build/types/integrations/tracing/nest/sentry-nest-instrumentation.d.ts +8 -2
  27. package/build/types/integrations/tracing/nest/sentry-nest-instrumentation.d.ts.map +1 -1
  28. package/build/types/integrations/tracing/nest/types.d.ts +11 -0
  29. package/build/types/integrations/tracing/nest/types.d.ts.map +1 -1
  30. package/build/types-ts3.8/index.d.ts +1 -1
  31. package/build/types-ts3.8/integrations/tracing/graphql.d.ts +15 -2
  32. package/build/types-ts3.8/integrations/tracing/nest/helpers.d.ts +3 -3
  33. package/build/types-ts3.8/integrations/tracing/nest/sentry-nest-instrumentation.d.ts +8 -2
  34. package/build/types-ts3.8/integrations/tracing/nest/types.d.ts +11 -0
  35. package/package.json +5 -5
@@ -27,7 +27,10 @@ class SentryNestInstrumentation extends InstrumentationBase {
27
27
  init() {
28
28
  const moduleDef = new InstrumentationNodeModuleDefinition(SentryNestInstrumentation.COMPONENT, supportedVersions);
29
29
 
30
- moduleDef.files.push(this._getInjectableFileInstrumentation(supportedVersions));
30
+ moduleDef.files.push(
31
+ this._getInjectableFileInstrumentation(supportedVersions),
32
+ this._getCatchFileInstrumentation(supportedVersions),
33
+ );
31
34
  return moduleDef;
32
35
  }
33
36
 
@@ -51,10 +54,28 @@ class SentryNestInstrumentation extends InstrumentationBase {
51
54
  );
52
55
  }
53
56
 
57
+ /**
58
+ * Wraps the @Catch decorator.
59
+ */
60
+ _getCatchFileInstrumentation(versions) {
61
+ return new InstrumentationNodeModuleFile(
62
+ '@nestjs/common/decorators/core/catch.decorator.js',
63
+ versions,
64
+ (moduleExports) => {
65
+ if (isWrapped(moduleExports.Catch)) {
66
+ this._unwrap(moduleExports, 'Catch');
67
+ }
68
+ this._wrap(moduleExports, 'Catch', this._createWrapCatch());
69
+ return moduleExports;
70
+ },
71
+ (moduleExports) => {
72
+ this._unwrap(moduleExports, 'Catch');
73
+ },
74
+ );
75
+ }
76
+
54
77
  /**
55
78
  * Creates a wrapper function for the @Injectable decorator.
56
- *
57
- * Wraps the use method to instrument nest class middleware.
58
79
  */
59
80
  _createWrapInjectable() {
60
81
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -170,6 +191,35 @@ class SentryNestInstrumentation extends InstrumentationBase {
170
191
  };
171
192
  };
172
193
  }
194
+
195
+ /**
196
+ * Creates a wrapper function for the @Catch decorator. Used to instrument exception filters.
197
+ */
198
+ _createWrapCatch() {
199
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
200
+ return function wrapCatch(original) {
201
+ return function wrappedCatch(...exceptions) {
202
+ return function (target) {
203
+ if (typeof target.prototype.catch === 'function' && !target.__SENTRY_INTERNAL__) {
204
+ // patch only once
205
+ if (isPatched(target)) {
206
+ return original(...exceptions)(target);
207
+ }
208
+
209
+ target.prototype.catch = new Proxy(target.prototype.catch, {
210
+ apply: (originalCatch, thisArgCatch, argsCatch) => {
211
+ return startSpan(getMiddlewareSpanOptions(target), () => {
212
+ return originalCatch.apply(thisArgCatch, argsCatch);
213
+ });
214
+ },
215
+ });
216
+ }
217
+
218
+ return original(...exceptions)(target);
219
+ };
220
+ };
221
+ };
222
+ }
173
223
  } SentryNestInstrumentation.__initStatic(); SentryNestInstrumentation.__initStatic2();
174
224
 
175
225
  export { SentryNestInstrumentation };
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-nest-instrumentation.js","sources":["../../../../../src/integrations/tracing/nest/sentry-nest-instrumentation.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/core';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport { getActiveSpan, startSpan, startSpanManual, withActiveSpan } from '@sentry/core';\nimport type { Span } from '@sentry/types';\nimport { SDK_VERSION } from '@sentry/utils';\nimport { getMiddlewareSpanOptions, isPatched } from './helpers';\nimport type { InjectableTarget } from './types';\n\nconst supportedVersions = ['>=8.0.0 <11'];\n\n/**\n * Custom instrumentation for nestjs.\n *\n * This hooks into the @Injectable decorator, which is applied on class middleware, interceptors and guards.\n */\nexport class SentryNestInstrumentation extends InstrumentationBase {\n public static readonly COMPONENT = '@nestjs/common';\n public static readonly COMMON_ATTRIBUTES = {\n component: SentryNestInstrumentation.COMPONENT,\n };\n\n public constructor(config: InstrumentationConfig = {}) {\n super('sentry-nestjs', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationNodeModuleDefinition {\n const moduleDef = new InstrumentationNodeModuleDefinition(SentryNestInstrumentation.COMPONENT, supportedVersions);\n\n moduleDef.files.push(this._getInjectableFileInstrumentation(supportedVersions));\n return moduleDef;\n }\n\n /**\n * Wraps the @Injectable decorator.\n */\n private _getInjectableFileInstrumentation(versions: string[]): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n '@nestjs/common/decorators/core/injectable.decorator.js',\n versions,\n (moduleExports: { Injectable: InjectableTarget }) => {\n if (isWrapped(moduleExports.Injectable)) {\n this._unwrap(moduleExports, 'Injectable');\n }\n this._wrap(moduleExports, 'Injectable', this._createWrapInjectable());\n return moduleExports;\n },\n (moduleExports: { Injectable: InjectableTarget }) => {\n this._unwrap(moduleExports, 'Injectable');\n },\n );\n }\n\n /**\n * Creates a wrapper function for the @Injectable decorator.\n *\n * Wraps the use method to instrument nest class middleware.\n */\n private _createWrapInjectable() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function wrapInjectable(original: any) {\n return function wrappedInjectable(options?: unknown) {\n return function (target: InjectableTarget) {\n // patch middleware\n if (typeof target.prototype.use === 'function' && !target.__SENTRY_INTERNAL__) {\n // patch only once\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.use = new Proxy(target.prototype.use, {\n apply: (originalUse, thisArgUse, argsUse) => {\n const [req, res, next, ...args] = argsUse;\n const prevSpan = getActiveSpan();\n\n return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => {\n const nextProxy = new Proxy(next, {\n apply: (originalNext, thisArgNext, argsNext) => {\n span.end();\n\n if (prevSpan) {\n return withActiveSpan(prevSpan, () => {\n return Reflect.apply(originalNext, thisArgNext, argsNext);\n });\n } else {\n return Reflect.apply(originalNext, thisArgNext, argsNext);\n }\n },\n });\n\n return originalUse.apply(thisArgUse, [req, res, nextProxy, args]);\n });\n },\n });\n }\n\n // patch guards\n if (typeof target.prototype.canActivate === 'function' && !target.__SENTRY_INTERNAL__) {\n // patch only once\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.canActivate = new Proxy(target.prototype.canActivate, {\n apply: (originalCanActivate, thisArgCanActivate, argsCanActivate) => {\n return startSpan(getMiddlewareSpanOptions(target), () => {\n return originalCanActivate.apply(thisArgCanActivate, argsCanActivate);\n });\n },\n });\n }\n\n // patch pipes\n if (typeof target.prototype.transform === 'function' && !target.__SENTRY_INTERNAL__) {\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.transform = new Proxy(target.prototype.transform, {\n apply: (originalTransform, thisArgTransform, argsTransform) => {\n return startSpan(getMiddlewareSpanOptions(target), () => {\n return originalTransform.apply(thisArgTransform, argsTransform);\n });\n },\n });\n }\n\n // patch interceptors\n if (typeof target.prototype.intercept === 'function' && !target.__SENTRY_INTERNAL__) {\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.intercept = new Proxy(target.prototype.intercept, {\n apply: (originalIntercept, thisArgIntercept, argsIntercept) => {\n const [executionContext, next, args] = argsIntercept;\n const prevSpan = getActiveSpan();\n\n return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => {\n const nextProxy = new Proxy(next, {\n get: (thisArgNext, property, receiver) => {\n if (property === 'handle') {\n const originalHandle = Reflect.get(thisArgNext, property, receiver);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (...args: any[]) => {\n span.end();\n\n if (prevSpan) {\n return withActiveSpan(prevSpan, () => {\n return Reflect.apply(originalHandle, thisArgNext, args);\n });\n } else {\n return Reflect.apply(originalHandle, thisArgNext, args);\n }\n };\n }\n\n return Reflect.get(target, property, receiver);\n },\n });\n\n return originalIntercept.apply(thisArgIntercept, [executionContext, nextProxy, args]);\n });\n },\n });\n }\n\n return original(options)(target);\n };\n };\n };\n }\n}\n"],"names":[],"mappings":";;;;;;AAaA,M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sentry-nest-instrumentation.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/core';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport { getActiveSpan, startSpan, startSpanManual, withActiveSpan } from '@sentry/core';\nimport type { Span } from '@sentry/types';\nimport { SDK_VERSION } from '@sentry/utils';\nimport { getMiddlewareSpanOptions, isPatched } from './helpers';\nimport type { CatchTarget, InjectableTarget } from './types';\n\nconst supportedVersions = ['>=8.0.0 <11'];\n\n/**\n * Custom instrumentation for nestjs.\n *\n * This hooks into the @Injectable decorator, which is applied on class middleware, interceptors and guards.\n */\nexport class SentryNestInstrumentation extends InstrumentationBase {\n public static readonly COMPONENT = '@nestjs/common';\n public static readonly COMMON_ATTRIBUTES = {\n component: SentryNestInstrumentation.COMPONENT,\n };\n\n public constructor(config: InstrumentationConfig = {}) {\n super('sentry-nestjs', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationNodeModuleDefinition {\n const moduleDef = new InstrumentationNodeModuleDefinition(SentryNestInstrumentation.COMPONENT, supportedVersions);\n\n moduleDef.files.push(\n this._getInjectableFileInstrumentation(supportedVersions),\n this._getCatchFileInstrumentation(supportedVersions),\n );\n return moduleDef;\n }\n\n /**\n * Wraps the @Injectable decorator.\n */\n private _getInjectableFileInstrumentation(versions: string[]): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n '@nestjs/common/decorators/core/injectable.decorator.js',\n versions,\n (moduleExports: { Injectable: InjectableTarget }) => {\n if (isWrapped(moduleExports.Injectable)) {\n this._unwrap(moduleExports, 'Injectable');\n }\n this._wrap(moduleExports, 'Injectable', this._createWrapInjectable());\n return moduleExports;\n },\n (moduleExports: { Injectable: InjectableTarget }) => {\n this._unwrap(moduleExports, 'Injectable');\n },\n );\n }\n\n /**\n * Wraps the @Catch decorator.\n */\n private _getCatchFileInstrumentation(versions: string[]): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n '@nestjs/common/decorators/core/catch.decorator.js',\n versions,\n (moduleExports: { Catch: CatchTarget }) => {\n if (isWrapped(moduleExports.Catch)) {\n this._unwrap(moduleExports, 'Catch');\n }\n this._wrap(moduleExports, 'Catch', this._createWrapCatch());\n return moduleExports;\n },\n (moduleExports: { Catch: CatchTarget }) => {\n this._unwrap(moduleExports, 'Catch');\n },\n );\n }\n\n /**\n * Creates a wrapper function for the @Injectable decorator.\n */\n private _createWrapInjectable() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function wrapInjectable(original: any) {\n return function wrappedInjectable(options?: unknown) {\n return function (target: InjectableTarget) {\n // patch middleware\n if (typeof target.prototype.use === 'function' && !target.__SENTRY_INTERNAL__) {\n // patch only once\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.use = new Proxy(target.prototype.use, {\n apply: (originalUse, thisArgUse, argsUse) => {\n const [req, res, next, ...args] = argsUse;\n const prevSpan = getActiveSpan();\n\n return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => {\n const nextProxy = new Proxy(next, {\n apply: (originalNext, thisArgNext, argsNext) => {\n span.end();\n\n if (prevSpan) {\n return withActiveSpan(prevSpan, () => {\n return Reflect.apply(originalNext, thisArgNext, argsNext);\n });\n } else {\n return Reflect.apply(originalNext, thisArgNext, argsNext);\n }\n },\n });\n\n return originalUse.apply(thisArgUse, [req, res, nextProxy, args]);\n });\n },\n });\n }\n\n // patch guards\n if (typeof target.prototype.canActivate === 'function' && !target.__SENTRY_INTERNAL__) {\n // patch only once\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.canActivate = new Proxy(target.prototype.canActivate, {\n apply: (originalCanActivate, thisArgCanActivate, argsCanActivate) => {\n return startSpan(getMiddlewareSpanOptions(target), () => {\n return originalCanActivate.apply(thisArgCanActivate, argsCanActivate);\n });\n },\n });\n }\n\n // patch pipes\n if (typeof target.prototype.transform === 'function' && !target.__SENTRY_INTERNAL__) {\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.transform = new Proxy(target.prototype.transform, {\n apply: (originalTransform, thisArgTransform, argsTransform) => {\n return startSpan(getMiddlewareSpanOptions(target), () => {\n return originalTransform.apply(thisArgTransform, argsTransform);\n });\n },\n });\n }\n\n // patch interceptors\n if (typeof target.prototype.intercept === 'function' && !target.__SENTRY_INTERNAL__) {\n if (isPatched(target)) {\n return original(options)(target);\n }\n\n target.prototype.intercept = new Proxy(target.prototype.intercept, {\n apply: (originalIntercept, thisArgIntercept, argsIntercept) => {\n const [executionContext, next, args] = argsIntercept;\n const prevSpan = getActiveSpan();\n\n return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => {\n const nextProxy = new Proxy(next, {\n get: (thisArgNext, property, receiver) => {\n if (property === 'handle') {\n const originalHandle = Reflect.get(thisArgNext, property, receiver);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (...args: any[]) => {\n span.end();\n\n if (prevSpan) {\n return withActiveSpan(prevSpan, () => {\n return Reflect.apply(originalHandle, thisArgNext, args);\n });\n } else {\n return Reflect.apply(originalHandle, thisArgNext, args);\n }\n };\n }\n\n return Reflect.get(target, property, receiver);\n },\n });\n\n return originalIntercept.apply(thisArgIntercept, [executionContext, nextProxy, args]);\n });\n },\n });\n }\n\n return original(options)(target);\n };\n };\n };\n }\n\n /**\n * Creates a wrapper function for the @Catch decorator. Used to instrument exception filters.\n */\n private _createWrapCatch() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function wrapCatch(original: any) {\n return function wrappedCatch(...exceptions: unknown[]) {\n return function (target: CatchTarget) {\n if (typeof target.prototype.catch === 'function' && !target.__SENTRY_INTERNAL__) {\n // patch only once\n if (isPatched(target)) {\n return original(...exceptions)(target);\n }\n\n target.prototype.catch = new Proxy(target.prototype.catch, {\n apply: (originalCatch, thisArgCatch, argsCatch) => {\n return startSpan(getMiddlewareSpanOptions(target), () => {\n return originalCatch.apply(thisArgCatch, argsCatch);\n });\n },\n });\n }\n\n return original(...exceptions)(target);\n };\n };\n };\n }\n}\n"],"names":[],"mappings":";;;;;;AAaA,MAAM,iBAAkB,GAAE,CAAC,aAAa,CAAC,CAAA;AACzC;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,yBAA0B,SAAQ,mBAAoB,CAAA;AACnE,GAAS,QAAgB,YAAA,GAAA,CAAA,IAAA,CAAA,SAAA,GAAY,iBAAgB,CAAA;AACrD,GAAS,QAAgB,aAAA,GAAA,CAAA,IAAA,CAAA,iBAAA,GAAoB;AAC7C,IAAI,SAAS,EAAE,yBAAyB,CAAC,SAAS;AAClD,IAAG,CAAA;AACH;AACA,GAAS,WAAW,CAAC,MAAM,GAA0B,EAAE,EAAE;AACzD,IAAI,KAAK,CAAC,eAAe,EAAE,WAAW,EAAE,MAAM,CAAC,CAAA;AAC/C,GAAE;AACF;AACA;AACA;AACA;AACA,GAAS,IAAI,GAAwC;AACrD,IAAI,MAAM,SAAU,GAAE,IAAI,mCAAmC,CAAC,yBAAyB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;AACrH;AACA,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI;AACxB,MAAM,IAAI,CAAC,iCAAiC,CAAC,iBAAiB,CAAC;AAC/D,MAAM,IAAI,CAAC,4BAA4B,CAAC,iBAAiB,CAAC;AAC1D,KAAK,CAAA;AACL,IAAI,OAAO,SAAS,CAAA;AACpB,GAAE;AACF;AACA;AACA;AACA;AACA,GAAU,iCAAiC,CAAC,QAAQ,EAA2C;AAC/F,IAAI,OAAO,IAAI,6BAA6B;AAC5C,MAAM,wDAAwD;AAC9D,MAAM,QAAQ;AACd,MAAM,CAAC,aAAa,KAAuC;AAC3D,QAAQ,IAAI,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE;AACjD,UAAU,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAA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K;AACjE,gBAAgB,OAAO,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM;AACzE,kBAAkB,OAAO,aAAa,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;AACrE,iBAAiB,CAAC,CAAA;AAClB,eAAe;AACf,aAAa,CAAC,CAAA;AACd,WAAU;AACV;AACA,UAAU,OAAO,QAAQ,CAAC,GAAG,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAChD,SAAS,CAAA;AACT,OAAO,CAAA;AACP,KAAK,CAAA;AACL,GAAE;AACF,CAAA,CAAA,yBAAA,CAAA,YAAA,EAAA,CAAA,CAAA,yBAAA,CAAA,aAAA,EAAA;;;;"}
@@ -36,6 +36,6 @@ export { cron } from './cron';
36
36
  export type { NodeOptions } from './types';
37
37
  export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils';
38
38
  export { addOpenTelemetryInstrumentation, continueTrace, setOpenTelemetryContextAsyncContextStrategy as setNodeAsyncContextStrategy, } from '@sentry/opentelemetry';
39
- export { addBreadcrumb, isInitialized, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentHub, getCurrentScope, getIsolationScope, getTraceData, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, metricsDefault as metrics, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, zodErrorsIntegration, } from '@sentry/core';
39
+ export { addBreadcrumb, isInitialized, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentHub, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, metricsDefault as metrics, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, zodErrorsIntegration, } from '@sentry/core';
40
40
  export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, User, Span, } from '@sentry/types';
41
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAA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gC,EAChC,qCAAqC,EACrC,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,SAAS,EAET,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,cAAc,IAAI,OAAO,EACzB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,IAAI,GACL,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,o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,EACxB,wBAAwB,EACxB,cAAc,IAAI,OAAO,EACzB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,IAAI,GACL,MAAM,eAAe,CAAC"}
@@ -1,5 +1,9 @@
1
1
  interface GraphqlOptions {
2
- /** Do not create spans for resolvers. */
2
+ /**
3
+ * Do not create spans for resolvers.
4
+ *
5
+ * Defaults to true.
6
+ */
3
7
  ignoreResolveSpans?: boolean;
4
8
  /**
5
9
  * Don't create spans for the execution of the default resolver on object properties.
@@ -8,8 +12,17 @@ interface GraphqlOptions {
8
12
  * use the default resolver which just looks for a property with that name on the object.
9
13
  * If the property is not a function, it's not very interesting to trace.
10
14
  * This option can reduce noise and number of spans created.
15
+ *
16
+ * Defaults to true.
17
+ */
18
+ ignoreTrivialResolveSpans?: boolean;
19
+ /**
20
+ * If this is enabled, a http.server root span containing this span will automatically be renamed to include the operation name.
21
+ * Set this to `false` if you do not want this behavior, and want to keep the default http.server span name.
22
+ *
23
+ * Defaults to true.
11
24
  */
12
- ignoreTrivalResolveSpans?: boolean;
25
+ useOperationNameForRootSpan?: boolean;
13
26
  }
14
27
  export declare const instrumentGraphql: ((options?: GraphqlOptions | undefined) => void) & {
15
28
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/graphql.ts"],"names":[],"mappings":"AAOA,UAAU,cAAc;IACtB,yCAAyC;IACzC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAID,eAAO,MAAM,iBAAiB;;CAgB7B,CAAC;AAWF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,+EAAyC,CAAC"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/graphql.ts"],"names":[],"mappings":"AAQA,UAAU,cAAc;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;;;OASG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;;OAKG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAID,eAAO,MAAM,iBAAiB;;CA8C7B,CAAC;AAWF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,+EAAyC,CAAC"}
@@ -1,15 +1,15 @@
1
- import type { InjectableTarget } from './types';
1
+ import type { CatchTarget, InjectableTarget } from './types';
2
2
  /**
3
3
  * Helper checking if a concrete target class is already patched.
4
4
  *
5
5
  * We already guard duplicate patching with isWrapped. However, isWrapped checks whether a file has been patched, whereas we use this check for concrete target classes.
6
6
  * This check might not be necessary, but better to play it safe.
7
7
  */
8
- export declare function isPatched(target: InjectableTarget): boolean;
8
+ export declare function isPatched(target: InjectableTarget | CatchTarget): boolean;
9
9
  /**
10
10
  * Returns span options for nest middleware spans.
11
11
  */
12
- export declare function getMiddlewareSpanOptions(target: InjectableTarget): {
12
+ export declare function getMiddlewareSpanOptions(target: InjectableTarget | CatchTarget): {
13
13
  name: string;
14
14
  attributes: {
15
15
  "sentry.op": string;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/nest/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAO3D;AAED;;GAEG;AAEH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB;;;;;;EAQhE"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/nest/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAI7D;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,GAAG,OAAO,CAOzE;AAED;;GAEG;AAEH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW;;;;;;EAQ9E"}
@@ -19,11 +19,17 @@ export declare class SentryNestInstrumentation extends InstrumentationBase {
19
19
  * Wraps the @Injectable decorator.
20
20
  */
21
21
  private _getInjectableFileInstrumentation;
22
+ /**
23
+ * Wraps the @Catch decorator.
24
+ */
25
+ private _getCatchFileInstrumentation;
22
26
  /**
23
27
  * Creates a wrapper function for the @Injectable decorator.
24
- *
25
- * Wraps the use method to instrument nest class middleware.
26
28
  */
27
29
  private _createWrapInjectable;
30
+ /**
31
+ * Creates a wrapper function for the @Catch decorator. Used to instrument exception filters.
32
+ */
33
+ private _createWrapCatch;
28
34
  }
29
35
  //# sourceMappingURL=sentry-nest-instrumentation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-nest-instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/nest/sentry-nest-instrumentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EACL,mBAAmB,EACnB,mCAAmC,EAEpC,MAAM,gCAAgC,CAAC;AASxC;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,mBAAmB;IAChE,gBAAuB,SAAS,oBAAoB;IACpD,gBAAuB,iBAAiB;;MAEtC;gBAEiB,MAAM,GAAE,qBAA0B;IAIrD;;OAEG;IACI,IAAI,IAAI,mCAAmC;IAOlD;;OAEG;IACH,OAAO,CAAC,iCAAiC;IAiBzC;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CAkH9B"}
1
+ {"version":3,"file":"sentry-nest-instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/nest/sentry-nest-instrumentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EACL,mBAAmB,EACnB,mCAAmC,EAEpC,MAAM,gCAAgC,CAAC;AASxC;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,mBAAmB;IAChE,gBAAuB,SAAS,oBAAoB;IACpD,gBAAuB,iBAAiB;;MAEtC;gBAEiB,MAAM,GAAE,qBAA0B;IAIrD;;OAEG;IACI,IAAI,IAAI,mCAAmC;IAUlD;;OAEG;IACH,OAAO,CAAC,iCAAiC;IAiBzC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAiBpC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAmH7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
@@ -46,5 +46,16 @@ export interface InjectableTarget {
46
46
  intercept?: (context: unknown, next: CallHandler, ...args: any[]) => Observable<any>;
47
47
  };
48
48
  }
49
+ /**
50
+ * Represents a target class in NestJS annotated with @Catch.
51
+ */
52
+ export interface CatchTarget {
53
+ name: string;
54
+ sentryPatched?: boolean;
55
+ __SENTRY_INTERNAL__?: boolean;
56
+ prototype: {
57
+ catch?: (...args: any[]) => any;
58
+ };
59
+ }
49
60
  export {};
50
61
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/nest/types.ts"],"names":[],"mappings":"AAEA,UAAU,6BAA6B;IACrC,OAAO,EAAE,MAAM,MAAM,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IAAI,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE;QACT,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QAC7E,WAAW,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACnF,SAAS,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;QACpC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC;KACtF,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE;QACT,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;KACjC,CAAC;CACH"}
@@ -36,6 +36,6 @@ export { cron } from './cron';
36
36
  export { NodeOptions } from './types';
37
37
  export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils';
38
38
  export { addOpenTelemetryInstrumentation, continueTrace, setOpenTelemetryContextAsyncContextStrategy as setNodeAsyncContextStrategy, } from '@sentry/opentelemetry';
39
- export { addBreadcrumb, isInitialized, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentHub, getCurrentScope, getIsolationScope, getTraceData, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, metricsDefault as metrics, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, zodErrorsIntegration, } from '@sentry/core';
39
+ export { addBreadcrumb, isInitialized, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentHub, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, metricsDefault as metrics, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, zodErrorsIntegration, } from '@sentry/core';
40
40
  export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, User, Span, } from '@sentry/types';
41
41
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,9 @@
1
1
  interface GraphqlOptions {
2
- /** Do not create spans for resolvers. */
2
+ /**
3
+ * Do not create spans for resolvers.
4
+ *
5
+ * Defaults to true.
6
+ */
3
7
  ignoreResolveSpans?: boolean;
4
8
  /**
5
9
  * Don't create spans for the execution of the default resolver on object properties.
@@ -8,8 +12,17 @@ interface GraphqlOptions {
8
12
  * use the default resolver which just looks for a property with that name on the object.
9
13
  * If the property is not a function, it's not very interesting to trace.
10
14
  * This option can reduce noise and number of spans created.
15
+ *
16
+ * Defaults to true.
17
+ */
18
+ ignoreTrivialResolveSpans?: boolean;
19
+ /**
20
+ * If this is enabled, a http.server root span containing this span will automatically be renamed to include the operation name.
21
+ * Set this to `false` if you do not want this behavior, and want to keep the default http.server span name.
22
+ *
23
+ * Defaults to true.
11
24
  */
12
- ignoreTrivalResolveSpans?: boolean;
25
+ useOperationNameForRootSpan?: boolean;
13
26
  }
14
27
  export declare const instrumentGraphql: ((options?: GraphqlOptions | undefined) => void) & {
15
28
  id: string;
@@ -1,15 +1,15 @@
1
- import { InjectableTarget } from './types';
1
+ import { CatchTarget, InjectableTarget } from './types';
2
2
  /**
3
3
  * Helper checking if a concrete target class is already patched.
4
4
  *
5
5
  * We already guard duplicate patching with isWrapped. However, isWrapped checks whether a file has been patched, whereas we use this check for concrete target classes.
6
6
  * This check might not be necessary, but better to play it safe.
7
7
  */
8
- export declare function isPatched(target: InjectableTarget): boolean;
8
+ export declare function isPatched(target: InjectableTarget | CatchTarget): boolean;
9
9
  /**
10
10
  * Returns span options for nest middleware spans.
11
11
  */
12
- export declare function getMiddlewareSpanOptions(target: InjectableTarget): {
12
+ export declare function getMiddlewareSpanOptions(target: InjectableTarget | CatchTarget): {
13
13
  name: string;
14
14
  attributes: {
15
15
  "sentry.op": string;
@@ -19,11 +19,17 @@ export declare class SentryNestInstrumentation extends InstrumentationBase {
19
19
  * Wraps the @Injectable decorator.
20
20
  */
21
21
  private _getInjectableFileInstrumentation;
22
+ /**
23
+ * Wraps the @Catch decorator.
24
+ */
25
+ private _getCatchFileInstrumentation;
22
26
  /**
23
27
  * Creates a wrapper function for the @Injectable decorator.
24
- *
25
- * Wraps the use method to instrument nest class middleware.
26
28
  */
27
29
  private _createWrapInjectable;
30
+ /**
31
+ * Creates a wrapper function for the @Catch decorator. Used to instrument exception filters.
32
+ */
33
+ private _createWrapCatch;
28
34
  }
29
35
  //# sourceMappingURL=sentry-nest-instrumentation.d.ts.map
@@ -46,5 +46,16 @@ export interface InjectableTarget {
46
46
  intercept?: (context: unknown, next: CallHandler, ...args: any[]) => Observable<any>;
47
47
  };
48
48
  }
49
+ /**
50
+ * Represents a target class in NestJS annotated with @Catch.
51
+ */
52
+ export interface CatchTarget {
53
+ name: string;
54
+ sentryPatched?: boolean;
55
+ __SENTRY_INTERNAL__?: boolean;
56
+ prototype: {
57
+ catch?: (...args: any[]) => any;
58
+ };
59
+ }
49
60
  export {};
50
61
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node",
3
- "version": "8.24.0",
3
+ "version": "8.25.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",
@@ -88,10 +88,10 @@
88
88
  "@opentelemetry/sdk-trace-base": "^1.25.1",
89
89
  "@opentelemetry/semantic-conventions": "^1.25.1",
90
90
  "@prisma/instrumentation": "5.17.0",
91
- "@sentry/core": "8.24.0",
92
- "@sentry/opentelemetry": "8.24.0",
93
- "@sentry/types": "8.24.0",
94
- "@sentry/utils": "8.24.0",
91
+ "@sentry/core": "8.25.0",
92
+ "@sentry/opentelemetry": "8.25.0",
93
+ "@sentry/types": "8.25.0",
94
+ "@sentry/utils": "8.25.0",
95
95
  "import-in-the-middle": "^1.11.0"
96
96
  },
97
97
  "devDependencies": {