@sentry/node 7.105.0 → 8.0.0-alpha.1
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/LICENSE +1 -1
- package/README.md +114 -38
- package/cjs/cron/index.js +15 -0
- package/cjs/cron/index.js.map +1 -0
- package/cjs/index.js +79 -99
- package/cjs/index.js.map +1 -1
- package/cjs/integrations/anr/index.js +4 -30
- package/cjs/integrations/anr/index.js.map +1 -1
- package/cjs/integrations/anr/worker-script.js +2 -2
- package/cjs/integrations/console.js +2 -13
- package/cjs/integrations/console.js.map +1 -1
- package/cjs/integrations/context.js +2 -16
- package/cjs/integrations/context.js.map +1 -1
- package/cjs/integrations/contextlines.js +6 -23
- package/cjs/integrations/contextlines.js.map +1 -1
- package/cjs/integrations/http.js +103 -354
- package/cjs/integrations/http.js.map +1 -1
- package/cjs/integrations/local-variables/index.js +0 -10
- package/cjs/integrations/local-variables/index.js.map +1 -1
- package/cjs/integrations/local-variables/local-variables-sync.js +29 -24
- package/cjs/integrations/local-variables/local-variables-sync.js.map +1 -1
- package/cjs/integrations/modules.js +19 -30
- package/cjs/integrations/modules.js.map +1 -1
- package/cjs/integrations/node-fetch.js +82 -0
- package/cjs/integrations/node-fetch.js.map +1 -0
- package/cjs/integrations/onuncaughtexception.js +15 -30
- package/cjs/integrations/onuncaughtexception.js.map +1 -1
- package/cjs/integrations/onunhandledrejection.js +3 -17
- package/cjs/integrations/onunhandledrejection.js.map +1 -1
- package/cjs/integrations/spotlight.js +4 -22
- package/cjs/integrations/spotlight.js.map +1 -1
- package/cjs/integrations/tracing/express.js +103 -0
- package/cjs/integrations/tracing/express.js.map +1 -0
- package/cjs/integrations/tracing/fastify.js +33 -0
- package/cjs/integrations/tracing/fastify.js.map +1 -0
- package/cjs/integrations/tracing/graphql.js +34 -0
- package/cjs/integrations/tracing/graphql.js.map +1 -0
- package/cjs/integrations/tracing/hapi/index.js +81 -0
- package/cjs/integrations/tracing/hapi/index.js.map +1 -0
- package/cjs/integrations/tracing/index.js +37 -0
- package/cjs/integrations/tracing/index.js.map +1 -0
- package/cjs/integrations/tracing/koa.js +21 -0
- package/cjs/integrations/tracing/koa.js.map +1 -0
- package/cjs/integrations/tracing/mongo.js +33 -0
- package/cjs/integrations/tracing/mongo.js.map +1 -0
- package/cjs/integrations/tracing/mongoose.js +33 -0
- package/cjs/integrations/tracing/mongoose.js.map +1 -0
- package/cjs/integrations/tracing/mysql.js +26 -0
- package/cjs/integrations/tracing/mysql.js.map +1 -0
- package/cjs/integrations/tracing/mysql2.js +33 -0
- package/cjs/integrations/tracing/mysql2.js.map +1 -0
- package/cjs/integrations/tracing/nest.js +26 -0
- package/cjs/integrations/tracing/nest.js.map +1 -0
- package/cjs/integrations/tracing/postgres.js +34 -0
- package/cjs/integrations/tracing/postgres.js.map +1 -0
- package/cjs/integrations/tracing/prisma.js +33 -0
- package/cjs/integrations/tracing/prisma.js.map +1 -0
- package/cjs/nodeVersion.js +5 -1
- package/cjs/nodeVersion.js.map +1 -1
- package/cjs/otel/contextManager.js +16 -0
- package/cjs/otel/contextManager.js.map +1 -0
- package/cjs/proxy/index.js +1 -2
- package/cjs/proxy/index.js.map +1 -1
- package/cjs/sdk/api.js +74 -0
- package/cjs/sdk/api.js.map +1 -0
- package/cjs/sdk/client.js +57 -0
- package/cjs/sdk/client.js.map +1 -0
- package/cjs/sdk/hub.js +104 -0
- package/cjs/sdk/hub.js.map +1 -0
- package/cjs/sdk/init.js +224 -0
- package/cjs/sdk/init.js.map +1 -0
- package/cjs/sdk/initOtel.js +70 -0
- package/cjs/sdk/initOtel.js.map +1 -0
- package/cjs/sdk/scope.js +18 -0
- package/cjs/sdk/scope.js.map +1 -0
- package/cjs/transports/http.js +2 -3
- package/cjs/transports/http.js.map +1 -1
- package/cjs/utils/addOriginToSpan.js +11 -0
- package/cjs/utils/addOriginToSpan.js.map +1 -0
- package/cjs/{integrations/utils → utils}/errorhandling.js +2 -1
- package/cjs/utils/errorhandling.js.map +1 -0
- package/cjs/utils/getRequestUrl.js +18 -0
- package/cjs/utils/getRequestUrl.js.map +1 -0
- package/cjs/utils/module.js.map +1 -0
- package/esm/cron/index.js +13 -0
- package/esm/cron/index.js.map +1 -0
- package/esm/index.js +28 -48
- package/esm/index.js.map +1 -1
- package/esm/integrations/anr/index.js +7 -32
- package/esm/integrations/anr/index.js.map +1 -1
- package/esm/integrations/anr/worker-script.js +2 -2
- package/esm/integrations/console.js +4 -14
- package/esm/integrations/console.js.map +1 -1
- package/esm/integrations/context.js +4 -17
- package/esm/integrations/context.js.map +1 -1
- package/esm/integrations/contextlines.js +8 -25
- package/esm/integrations/contextlines.js.map +1 -1
- package/esm/integrations/http.js +105 -353
- package/esm/integrations/http.js.map +1 -1
- package/esm/integrations/local-variables/index.js +2 -11
- package/esm/integrations/local-variables/index.js.map +1 -1
- package/esm/integrations/local-variables/local-variables-sync.js +31 -25
- package/esm/integrations/local-variables/local-variables-sync.js.map +1 -1
- package/esm/integrations/modules.js +21 -31
- package/esm/integrations/modules.js.map +1 -1
- package/esm/integrations/node-fetch.js +80 -0
- package/esm/integrations/node-fetch.js.map +1 -0
- package/esm/integrations/onuncaughtexception.js +17 -31
- package/esm/integrations/onuncaughtexception.js.map +1 -1
- package/esm/integrations/onunhandledrejection.js +5 -18
- package/esm/integrations/onunhandledrejection.js.map +1 -1
- package/esm/integrations/spotlight.js +3 -20
- package/esm/integrations/spotlight.js.map +1 -1
- package/esm/integrations/tracing/express.js +96 -0
- package/esm/integrations/tracing/express.js.map +1 -0
- package/esm/integrations/tracing/fastify.js +31 -0
- package/esm/integrations/tracing/fastify.js.map +1 -0
- package/esm/integrations/tracing/graphql.js +32 -0
- package/esm/integrations/tracing/graphql.js.map +1 -0
- package/esm/integrations/tracing/hapi/index.js +77 -0
- package/esm/integrations/tracing/hapi/index.js.map +1 -0
- package/esm/integrations/tracing/index.js +35 -0
- package/esm/integrations/tracing/index.js.map +1 -0
- package/esm/integrations/tracing/koa.js +19 -0
- package/esm/integrations/tracing/koa.js.map +1 -0
- package/esm/integrations/tracing/mongo.js +31 -0
- package/esm/integrations/tracing/mongo.js.map +1 -0
- package/esm/integrations/tracing/mongoose.js +31 -0
- package/esm/integrations/tracing/mongoose.js.map +1 -0
- package/esm/integrations/tracing/mysql.js +24 -0
- package/esm/integrations/tracing/mysql.js.map +1 -0
- package/esm/integrations/tracing/mysql2.js +31 -0
- package/esm/integrations/tracing/mysql2.js.map +1 -0
- package/esm/integrations/tracing/nest.js +24 -0
- package/esm/integrations/tracing/nest.js.map +1 -0
- package/esm/integrations/tracing/postgres.js +32 -0
- package/esm/integrations/tracing/postgres.js.map +1 -0
- package/esm/integrations/tracing/prisma.js +31 -0
- package/esm/integrations/tracing/prisma.js.map +1 -0
- package/esm/nodeVersion.js +5 -2
- package/esm/nodeVersion.js.map +1 -1
- package/esm/otel/contextManager.js +14 -0
- package/esm/otel/contextManager.js.map +1 -0
- package/esm/proxy/index.js +0 -1
- package/esm/proxy/index.js.map +1 -1
- package/esm/sdk/api.js +69 -0
- package/esm/sdk/api.js.map +1 -0
- package/esm/sdk/client.js +52 -0
- package/esm/sdk/client.js.map +1 -0
- package/esm/sdk/hub.js +102 -0
- package/esm/sdk/hub.js.map +1 -0
- package/esm/sdk/init.js +221 -0
- package/esm/sdk/init.js.map +1 -0
- package/esm/sdk/initOtel.js +67 -0
- package/esm/sdk/initOtel.js.map +1 -0
- package/esm/sdk/scope.js +16 -0
- package/esm/sdk/scope.js.map +1 -0
- package/esm/transports/http.js +0 -1
- package/esm/transports/http.js.map +1 -1
- package/esm/utils/addOriginToSpan.js +9 -0
- package/esm/utils/addOriginToSpan.js.map +1 -0
- package/esm/{integrations/utils → utils}/errorhandling.js +2 -1
- package/esm/utils/errorhandling.js.map +1 -0
- package/esm/utils/getRequestUrl.js +16 -0
- package/esm/utils/getRequestUrl.js.map +1 -0
- package/esm/utils/module.js.map +1 -0
- package/package.json +31 -23
- package/types/cron/index.d.ts +10 -0
- package/types/cron/index.d.ts.map +1 -0
- package/types/index.d.ts +30 -145
- package/types/index.d.ts.map +1 -1
- package/types/integrations/anr/index.d.ts +0 -15
- package/types/integrations/anr/index.d.ts.map +1 -1
- package/types/integrations/console.d.ts +2 -8
- package/types/integrations/console.d.ts.map +1 -1
- package/types/integrations/context.d.ts +3 -18
- package/types/integrations/context.d.ts.map +1 -1
- package/types/integrations/contextlines.d.ts +8 -10
- package/types/integrations/contextlines.d.ts.map +1 -1
- package/types/integrations/http.d.ts +8 -89
- package/types/integrations/http.d.ts.map +1 -1
- package/types/integrations/local-variables/index.d.ts +0 -11
- package/types/integrations/local-variables/index.d.ts.map +1 -1
- package/types/integrations/local-variables/local-variables-async.d.ts +1 -1
- package/types/integrations/local-variables/local-variables-async.d.ts.map +1 -1
- package/types/integrations/local-variables/local-variables-sync.d.ts +1 -1
- package/types/integrations/local-variables/local-variables-sync.d.ts.map +1 -1
- package/types/integrations/modules.d.ts +1 -7
- package/types/integrations/modules.d.ts.map +1 -1
- package/types/integrations/node-fetch.d.ts +15 -0
- package/types/integrations/node-fetch.d.ts.map +1 -0
- package/types/integrations/onuncaughtexception.d.ts +3 -12
- package/types/integrations/onuncaughtexception.d.ts.map +1 -1
- package/types/integrations/onunhandledrejection.d.ts +3 -10
- package/types/integrations/onunhandledrejection.d.ts.map +1 -1
- package/types/integrations/spotlight.d.ts +1 -10
- package/types/integrations/spotlight.d.ts.map +1 -1
- package/types/integrations/tracing/express.d.ts +37 -0
- package/types/integrations/tracing/express.d.ts.map +1 -0
- package/types/integrations/tracing/fastify.d.ts +7 -0
- package/types/integrations/tracing/fastify.d.ts.map +1 -0
- package/types/integrations/tracing/graphql.d.ts +7 -0
- package/types/integrations/tracing/graphql.d.ts.map +1 -0
- package/types/integrations/tracing/hapi/index.d.ts +18 -0
- package/types/integrations/tracing/hapi/index.d.ts.map +1 -0
- package/types/integrations/{hapi → tracing/hapi}/types.d.ts +1 -2
- package/types/integrations/tracing/hapi/types.d.ts.map +1 -0
- package/types/integrations/tracing/index.d.ts +6 -0
- package/types/integrations/tracing/index.d.ts.map +1 -0
- package/types/integrations/tracing/koa.d.ts +2 -0
- package/types/integrations/tracing/koa.d.ts.map +1 -0
- package/types/integrations/tracing/mongo.d.ts +7 -0
- package/types/integrations/tracing/mongo.d.ts.map +1 -0
- package/types/integrations/tracing/mongoose.d.ts +7 -0
- package/types/integrations/tracing/mongoose.d.ts.map +1 -0
- package/types/integrations/tracing/mysql.d.ts +7 -0
- package/types/integrations/tracing/mysql.d.ts.map +1 -0
- package/types/integrations/tracing/mysql2.d.ts +7 -0
- package/types/integrations/tracing/mysql2.d.ts.map +1 -0
- package/types/integrations/tracing/nest.d.ts +7 -0
- package/types/integrations/tracing/nest.d.ts.map +1 -0
- package/types/integrations/tracing/postgres.d.ts +7 -0
- package/types/integrations/tracing/postgres.d.ts.map +1 -0
- package/types/integrations/tracing/prisma.d.ts +11 -0
- package/types/integrations/tracing/prisma.d.ts.map +1 -0
- package/types/nodeVersion.d.ts +3 -3
- package/types/nodeVersion.d.ts.map +1 -1
- package/types/otel/contextManager.d.ts +10 -0
- package/types/otel/contextManager.d.ts.map +1 -0
- package/types/proxy/helpers.d.ts +0 -1
- package/types/proxy/helpers.d.ts.map +1 -1
- package/types/proxy/index.d.ts +0 -1
- package/types/proxy/index.d.ts.map +1 -1
- package/types/sdk/api.d.ts +18 -0
- package/types/sdk/api.d.ts.map +1 -0
- package/types/sdk/client.d.ts +17 -0
- package/types/sdk/client.d.ts.map +1 -0
- package/types/sdk/globals.d.ts +6 -0
- package/types/sdk/globals.d.ts.map +1 -0
- package/types/sdk/hub.d.ts +7 -0
- package/types/sdk/hub.d.ts.map +1 -0
- package/types/sdk/init.d.ts +9 -0
- package/types/sdk/init.d.ts.map +1 -0
- package/types/sdk/initOtel.d.ts +9 -0
- package/types/sdk/initOtel.d.ts.map +1 -0
- package/types/sdk/scope.d.ts +7 -0
- package/types/sdk/scope.d.ts.map +1 -0
- package/types/transports/http-module.d.ts +2 -5
- package/types/transports/http-module.d.ts.map +1 -1
- package/types/transports/http.d.ts.map +1 -1
- package/types/types.d.ts +18 -25
- package/types/types.d.ts.map +1 -1
- package/types/utils/addOriginToSpan.d.ts +5 -0
- package/types/utils/addOriginToSpan.d.ts.map +1 -0
- package/types/utils/errorhandling.d.ts.map +1 -0
- package/types/utils/getRequestUrl.d.ts +5 -0
- package/types/utils/getRequestUrl.d.ts.map +1 -0
- package/types/utils/module.d.ts.map +1 -0
- package/types/utils/prepareEvent.d.ts +17 -0
- package/types/utils/prepareEvent.d.ts.map +1 -0
- package/types-ts3.8/cron/index.d.ts +10 -0
- package/types-ts3.8/index.d.ts +30 -145
- package/types-ts3.8/integrations/anr/index.d.ts +0 -15
- package/types-ts3.8/integrations/console.d.ts +2 -8
- package/types-ts3.8/integrations/context.d.ts +3 -18
- package/types-ts3.8/integrations/contextlines.d.ts +8 -10
- package/types-ts3.8/integrations/http.d.ts +8 -89
- package/types-ts3.8/integrations/local-variables/index.d.ts +0 -11
- package/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +1 -1
- package/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +1 -1
- package/types-ts3.8/integrations/modules.d.ts +1 -7
- package/types-ts3.8/integrations/node-fetch.d.ts +15 -0
- package/types-ts3.8/integrations/onuncaughtexception.d.ts +3 -12
- package/types-ts3.8/integrations/onunhandledrejection.d.ts +3 -10
- package/types-ts3.8/integrations/spotlight.d.ts +1 -10
- package/types-ts3.8/integrations/tracing/express.d.ts +37 -0
- package/types-ts3.8/integrations/tracing/fastify.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/graphql.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/hapi/index.d.ts +18 -0
- package/types-ts3.8/integrations/{hapi → tracing/hapi}/types.d.ts +1 -2
- package/types-ts3.8/integrations/tracing/index.d.ts +6 -0
- package/types-ts3.8/integrations/tracing/koa.d.ts +2 -0
- package/types-ts3.8/integrations/tracing/mongo.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/mongoose.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/mysql.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/mysql2.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/nest.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/postgres.d.ts +7 -0
- package/types-ts3.8/integrations/tracing/prisma.d.ts +11 -0
- package/types-ts3.8/nodeVersion.d.ts +3 -3
- package/types-ts3.8/otel/contextManager.d.ts +10 -0
- package/types-ts3.8/proxy/helpers.d.ts +0 -1
- package/types-ts3.8/proxy/index.d.ts +0 -1
- package/types-ts3.8/sdk/api.d.ts +18 -0
- package/types-ts3.8/sdk/client.d.ts +17 -0
- package/types-ts3.8/sdk/globals.d.ts +6 -0
- package/types-ts3.8/sdk/hub.d.ts +7 -0
- package/types-ts3.8/sdk/init.d.ts +9 -0
- package/types-ts3.8/sdk/initOtel.d.ts +9 -0
- package/types-ts3.8/sdk/scope.d.ts +7 -0
- package/types-ts3.8/transports/http-module.d.ts +2 -4
- package/types-ts3.8/types.d.ts +18 -25
- package/types-ts3.8/utils/addOriginToSpan.d.ts +5 -0
- package/types-ts3.8/utils/getRequestUrl.d.ts +5 -0
- package/types-ts3.8/utils/prepareEvent.d.ts +17 -0
- package/cjs/async/domain.js +0 -61
- package/cjs/async/domain.js.map +0 -1
- package/cjs/async/hooks.js +0 -50
- package/cjs/async/hooks.js.map +0 -1
- package/cjs/async/index.js +0 -22
- package/cjs/async/index.js.map +0 -1
- package/cjs/client.js +0 -39
- package/cjs/client.js.map +0 -1
- package/cjs/handlers.js +0 -340
- package/cjs/handlers.js.map +0 -1
- package/cjs/integrations/anr/legacy.js +0 -29
- package/cjs/integrations/anr/legacy.js.map +0 -1
- package/cjs/integrations/hapi/index.js +0 -161
- package/cjs/integrations/hapi/index.js.map +0 -1
- package/cjs/integrations/index.js +0 -32
- package/cjs/integrations/index.js.map +0 -1
- package/cjs/integrations/undici/index.js +0 -307
- package/cjs/integrations/undici/index.js.map +0 -1
- package/cjs/integrations/utils/errorhandling.js.map +0 -1
- package/cjs/integrations/utils/http.js +0 -225
- package/cjs/integrations/utils/http.js.map +0 -1
- package/cjs/module.js.map +0 -1
- package/cjs/requestDataDeprecated.js +0 -45
- package/cjs/requestDataDeprecated.js.map +0 -1
- package/cjs/sdk.js +0 -284
- package/cjs/sdk.js.map +0 -1
- package/cjs/tracing/index.js +0 -29
- package/cjs/tracing/index.js.map +0 -1
- package/cjs/tracing/integrations.js +0 -14
- package/cjs/tracing/integrations.js.map +0 -1
- package/cjs/utils.js +0 -45
- package/cjs/utils.js.map +0 -1
- package/esm/async/domain.js +0 -56
- package/esm/async/domain.js.map +0 -1
- package/esm/async/hooks.js +0 -45
- package/esm/async/hooks.js.map +0 -1
- package/esm/async/index.js +0 -20
- package/esm/async/index.js.map +0 -1
- package/esm/client.js +0 -37
- package/esm/client.js.map +0 -1
- package/esm/handlers.js +0 -330
- package/esm/handlers.js.map +0 -1
- package/esm/integrations/anr/legacy.js +0 -27
- package/esm/integrations/anr/legacy.js.map +0 -1
- package/esm/integrations/hapi/index.js +0 -156
- package/esm/integrations/hapi/index.js.map +0 -1
- package/esm/integrations/index.js +0 -16
- package/esm/integrations/index.js.map +0 -1
- package/esm/integrations/undici/index.js +0 -301
- package/esm/integrations/undici/index.js.map +0 -1
- package/esm/integrations/utils/errorhandling.js.map +0 -1
- package/esm/integrations/utils/http.js +0 -216
- package/esm/integrations/utils/http.js.map +0 -1
- package/esm/module.js.map +0 -1
- package/esm/requestDataDeprecated.js +0 -42
- package/esm/requestDataDeprecated.js.map +0 -1
- package/esm/sdk.js +0 -274
- package/esm/sdk.js.map +0 -1
- package/esm/tracing/index.js +0 -27
- package/esm/tracing/index.js.map +0 -1
- package/esm/tracing/integrations.js +0 -2
- package/esm/tracing/integrations.js.map +0 -1
- package/esm/utils.js +0 -43
- package/esm/utils.js.map +0 -1
- package/types/async/domain.d.ts +0 -5
- package/types/async/domain.d.ts.map +0 -1
- package/types/async/hooks.d.ts +0 -5
- package/types/async/hooks.d.ts.map +0 -1
- package/types/async/index.d.ts +0 -8
- package/types/async/index.d.ts.map +0 -1
- package/types/client.d.ts +0 -16
- package/types/client.d.ts.map +0 -1
- package/types/handlers.d.ts +0 -57
- package/types/handlers.d.ts.map +0 -1
- package/types/integrations/anr/legacy.d.ts +0 -22
- package/types/integrations/anr/legacy.d.ts.map +0 -1
- package/types/integrations/hapi/index.d.ts +0 -22
- package/types/integrations/hapi/index.d.ts.map +0 -1
- package/types/integrations/hapi/types.d.ts.map +0 -1
- package/types/integrations/index.d.ts +0 -14
- package/types/integrations/index.d.ts.map +0 -1
- package/types/integrations/undici/index.d.ts +0 -58
- package/types/integrations/undici/index.d.ts.map +0 -1
- package/types/integrations/undici/types.d.ts +0 -224
- package/types/integrations/undici/types.d.ts.map +0 -1
- package/types/integrations/utils/errorhandling.d.ts.map +0 -1
- package/types/integrations/utils/http.d.ts +0 -70
- package/types/integrations/utils/http.d.ts.map +0 -1
- package/types/module.d.ts.map +0 -1
- package/types/requestDataDeprecated.d.ts +0 -45
- package/types/requestDataDeprecated.d.ts.map +0 -1
- package/types/sdk.d.ts +0 -74
- package/types/sdk.d.ts.map +0 -1
- package/types/tracing/index.d.ts +0 -6
- package/types/tracing/index.d.ts.map +0 -1
- package/types/tracing/integrations.d.ts +0 -2
- package/types/tracing/integrations.d.ts.map +0 -1
- package/types/utils.d.ts +0 -10
- package/types/utils.d.ts.map +0 -1
- package/types-ts3.8/async/domain.d.ts +0 -5
- package/types-ts3.8/async/hooks.d.ts +0 -5
- package/types-ts3.8/async/index.d.ts +0 -8
- package/types-ts3.8/client.d.ts +0 -16
- package/types-ts3.8/handlers.d.ts +0 -57
- package/types-ts3.8/integrations/anr/legacy.d.ts +0 -22
- package/types-ts3.8/integrations/hapi/index.d.ts +0 -22
- package/types-ts3.8/integrations/index.d.ts +0 -14
- package/types-ts3.8/integrations/undici/index.d.ts +0 -58
- package/types-ts3.8/integrations/undici/types.d.ts +0 -223
- package/types-ts3.8/integrations/utils/http.d.ts +0 -80
- package/types-ts3.8/requestDataDeprecated.d.ts +0 -45
- package/types-ts3.8/sdk.d.ts +0 -74
- package/types-ts3.8/tracing/index.d.ts +0 -6
- package/types-ts3.8/tracing/integrations.d.ts +0 -2
- package/types-ts3.8/utils.d.ts +0 -10
- /package/cjs/{module.js → utils/module.js} +0 -0
- /package/esm/{module.js → utils/module.js} +0 -0
- /package/types/{integrations/utils → utils}/errorhandling.d.ts +0 -0
- /package/types/{module.d.ts → utils/module.d.ts} +0 -0
- /package/types-ts3.8/{integrations/utils → utils}/errorhandling.d.ts +0 -0
- /package/types-ts3.8/{module.d.ts → utils/module.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineIntegration,
|
|
1
|
+
import { defineIntegration, getClient, captureException } from '@sentry/core';
|
|
2
2
|
import { consoleSandbox } from '@sentry/utils';
|
|
3
|
-
import { logAndExitProcess } from '
|
|
3
|
+
import { logAndExitProcess } from '../utils/errorhandling.js';
|
|
4
4
|
|
|
5
5
|
const INTEGRATION_NAME = 'OnUnhandledRejection';
|
|
6
6
|
|
|
@@ -9,29 +9,16 @@ const _onUnhandledRejectionIntegration = ((options = {}) => {
|
|
|
9
9
|
|
|
10
10
|
return {
|
|
11
11
|
name: INTEGRATION_NAME,
|
|
12
|
-
// TODO v8: Remove this
|
|
13
|
-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
|
14
12
|
setup(client) {
|
|
15
13
|
global.process.on('unhandledRejection', makeUnhandledPromiseHandler(client, { mode }));
|
|
16
14
|
},
|
|
17
15
|
};
|
|
18
16
|
}) ;
|
|
19
17
|
|
|
20
|
-
const onUnhandledRejectionIntegration = defineIntegration(_onUnhandledRejectionIntegration);
|
|
21
|
-
|
|
22
18
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @deprecated Use `onUnhandledRejectionIntegration()` instead.
|
|
19
|
+
* Add a global promise rejection handler.
|
|
25
20
|
*/
|
|
26
|
-
|
|
27
|
-
const OnUnhandledRejection = convertIntegrationFnToClass(
|
|
28
|
-
INTEGRATION_NAME,
|
|
29
|
-
onUnhandledRejectionIntegration,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
;
|
|
33
|
-
|
|
34
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
21
|
+
const onUnhandledRejectionIntegration = defineIntegration(_onUnhandledRejectionIntegration);
|
|
35
22
|
|
|
36
23
|
/**
|
|
37
24
|
* Send an exception with reason
|
|
@@ -96,5 +83,5 @@ function handleRejection(
|
|
|
96
83
|
/* eslint-enable no-console */
|
|
97
84
|
}
|
|
98
85
|
|
|
99
|
-
export {
|
|
86
|
+
export { makeUnhandledPromiseHandler, onUnhandledRejectionIntegration };
|
|
100
87
|
//# sourceMappingURL=onunhandledrejection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onunhandledrejection.js","sources":["../../../src/integrations/onunhandledrejection.ts"],"sourcesContent":["import { captureException,
|
|
1
|
+
{"version":3,"file":"onunhandledrejection.js","sources":["../../../src/integrations/onunhandledrejection.ts"],"sourcesContent":["import { captureException, defineIntegration, getClient } from '@sentry/core';\nimport type { Client, IntegrationFn } from '@sentry/types';\nimport { consoleSandbox } from '@sentry/utils';\nimport { logAndExitProcess } from '../utils/errorhandling';\n\ntype UnhandledRejectionMode = 'none' | 'warn' | 'strict';\n\ninterface OnUnhandledRejectionOptions {\n /**\n * Option deciding what to do after capturing unhandledRejection,\n * that mimicks behavior of node's --unhandled-rejection flag.\n */\n mode: UnhandledRejectionMode;\n}\n\nconst INTEGRATION_NAME = 'OnUnhandledRejection';\n\nconst _onUnhandledRejectionIntegration = ((options: Partial<OnUnhandledRejectionOptions> = {}) => {\n const mode = options.mode || 'warn';\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n global.process.on('unhandledRejection', makeUnhandledPromiseHandler(client, { mode }));\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Add a global promise rejection handler.\n */\nexport const onUnhandledRejectionIntegration = defineIntegration(_onUnhandledRejectionIntegration);\n\n/**\n * Send an exception with reason\n * @param reason string\n * @param promise promise\n *\n * Exported only for tests.\n */\nexport function makeUnhandledPromiseHandler(\n client: Client,\n options: OnUnhandledRejectionOptions,\n): (reason: unknown, promise: unknown) => void {\n return function sendUnhandledPromise(reason: unknown, promise: unknown): void {\n if (getClient() !== client) {\n return;\n }\n\n captureException(reason, {\n originalException: promise,\n captureContext: {\n extra: { unhandledPromiseRejection: true },\n },\n mechanism: {\n handled: false,\n type: 'onunhandledrejection',\n },\n });\n\n handleRejection(reason, options);\n };\n}\n\n/**\n * Handler for `mode` option\n\n */\nfunction handleRejection(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reason: any,\n options: OnUnhandledRejectionOptions,\n): void {\n // https://github.com/nodejs/node/blob/7cf6f9e964aa00772965391c23acda6d71972a9a/lib/internal/process/promises.js#L234-L240\n const rejectionWarning =\n 'This error originated either by ' +\n 'throwing inside of an async function without a catch block, ' +\n 'or by rejecting a promise which was not handled with .catch().' +\n ' The promise rejected with the reason:';\n\n /* eslint-disable no-console */\n if (options.mode === 'warn') {\n consoleSandbox(() => {\n console.warn(rejectionWarning);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.error(reason && reason.stack ? reason.stack : reason);\n });\n } else if (options.mode === 'strict') {\n consoleSandbox(() => {\n console.warn(rejectionWarning);\n });\n logAndExitProcess(reason);\n }\n /* eslint-enable no-console */\n}\n"],"names":[],"mappings":";;;;AAeA,MAAM,gBAAA,GAAmB,sBAAsB,CAAA;AAC/C;AACA,MAAM,gCAAA,IAAoC,CAAC,OAAO,GAAyC,EAAE,KAAK;AAClG,EAAE,MAAM,IAAK,GAAE,OAAO,CAAC,IAAA,IAAQ,MAAM,CAAA;AACrC;AACA,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,CAAC,O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AAC,KAAK,CAAC,UAAU,MAAM,CAAC,KAAA,GAAQ,MAAM,CAAC,KAAM,GAAE,MAAM,CAAC,CAAA;AACnE,KAAK,CAAC,CAAA;AACN,GAAE,MAAO,IAAI,OAAO,CAAC,IAAA,KAAS,QAAQ,EAAE;AACxC,IAAI,cAAc,CAAC,MAAM;AACzB,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;AACpC,KAAK,CAAC,CAAA;AACN,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AAC7B,GAAE;AACF;AACA;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as http from 'http';
|
|
2
|
-
import {
|
|
3
|
-
import { defineIntegration, convertIntegrationFnToClass } from '@sentry/core';
|
|
2
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
3
|
import { logger, serializeEnvelope } from '@sentry/utils';
|
|
5
4
|
|
|
6
5
|
const INTEGRATION_NAME = 'Spotlight';
|
|
@@ -12,8 +11,6 @@ const _spotlightIntegration = ((options = {}) => {
|
|
|
12
11
|
|
|
13
12
|
return {
|
|
14
13
|
name: INTEGRATION_NAME,
|
|
15
|
-
// TODO v8: Remove this
|
|
16
|
-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
|
17
14
|
setup(client) {
|
|
18
15
|
if (typeof process === 'object' && process.env && process.env.NODE_ENV !== 'development') {
|
|
19
16
|
logger.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?");
|
|
@@ -23,23 +20,14 @@ const _spotlightIntegration = ((options = {}) => {
|
|
|
23
20
|
};
|
|
24
21
|
}) ;
|
|
25
22
|
|
|
26
|
-
const spotlightIntegration = defineIntegration(_spotlightIntegration);
|
|
27
|
-
|
|
28
23
|
/**
|
|
29
24
|
* Use this integration to send errors and transactions to Spotlight.
|
|
30
25
|
*
|
|
31
26
|
* Learn more about spotlight at https://spotlightjs.com
|
|
32
27
|
*
|
|
33
28
|
* Important: This integration only works with Node 18 or newer.
|
|
34
|
-
*
|
|
35
|
-
* @deprecated Use `spotlightIntegration()` instead.
|
|
36
29
|
*/
|
|
37
|
-
|
|
38
|
-
const Spotlight = convertIntegrationFnToClass(INTEGRATION_NAME, spotlightIntegration)
|
|
39
|
-
|
|
40
|
-
;
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
30
|
+
const spotlightIntegration = defineIntegration(_spotlightIntegration);
|
|
43
31
|
|
|
44
32
|
function connectToSpotlight(client, options) {
|
|
45
33
|
const spotlightUrl = parseSidecarUrl(options.sidecarUrl);
|
|
@@ -49,11 +37,6 @@ function connectToSpotlight(client, options) {
|
|
|
49
37
|
|
|
50
38
|
let failedRequests = 0;
|
|
51
39
|
|
|
52
|
-
if (typeof client.on !== 'function') {
|
|
53
|
-
logger.warn('[Spotlight] Cannot connect to spotlight due to missing method on SDK client (`client.on`)');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
40
|
client.on('beforeEnvelope', (envelope) => {
|
|
58
41
|
if (failedRequests > 3) {
|
|
59
42
|
logger.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests');
|
|
@@ -119,5 +102,5 @@ function isWrapped(impl) {
|
|
|
119
102
|
return '__sentry_original__' in impl;
|
|
120
103
|
}
|
|
121
104
|
|
|
122
|
-
export {
|
|
105
|
+
export { getNativeHttpRequest, spotlightIntegration };
|
|
123
106
|
//# sourceMappingURL=spotlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","sources":["../../../src/integrations/spotlight.ts"],"sourcesContent":["import * as http from 'http';\nimport {
|
|
1
|
+
{"version":3,"file":"spotlight.js","sources":["../../../src/integrations/spotlight.ts"],"sourcesContent":["import * as http from 'http';\nimport { defineIntegration } from '@sentry/core';\nimport type { Client, Envelope, IntegrationFn } from '@sentry/types';\nimport { logger, serializeEnvelope } from '@sentry/utils';\n\ntype SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nconst INTEGRATION_NAME = 'Spotlight';\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const _options = {\n sidecarUrl: options.sidecarUrl || 'http://localhost:8969/stream',\n };\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n if (typeof process === 'object' && process.env && process.env.NODE_ENV !== 'development') {\n logger.warn(\"[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?\");\n }\n connectToSpotlight(client, _options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n *\n * Important: This integration only works with Node 18 or newer.\n */\nexport const spotlightIntegration = defineIntegration(_spotlightIntegration);\n\nfunction connectToSpotlight(client: Client, options: Required<SpotlightConnectionOptions>): void {\n const spotlightUrl = parseSidecarUrl(options.sidecarUrl);\n if (!spotlightUrl) {\n return;\n }\n\n let failedRequests = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failedRequests > 3) {\n logger.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests');\n return;\n }\n\n const serializedEnvelope = serializeEnvelope(envelope);\n\n const request = getNativeHttpRequest();\n const req = request(\n {\n method: 'POST',\n path: spotlightUrl.pathname,\n hostname: spotlightUrl.hostname,\n port: spotlightUrl.port,\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n },\n res => {\n res.on('data', () => {\n // Drain socket\n });\n\n res.on('end', () => {\n // Drain socket\n });\n res.setEncoding('utf8');\n },\n );\n\n req.on('error', () => {\n failedRequests++;\n logger.warn('[Spotlight] Failed to send envelope to Spotlight Sidecar');\n });\n req.write(serializedEnvelope);\n req.end();\n });\n}\n\nfunction parseSidecarUrl(url: string): URL | undefined {\n try {\n return new URL(`${url}`);\n } catch {\n logger.warn(`[Spotlight] Invalid sidecar URL: ${url}`);\n return undefined;\n }\n}\n\ntype HttpRequestImpl = typeof http.request;\ntype WrappedHttpRequest = HttpRequestImpl & { __sentry_original__: HttpRequestImpl };\n\n/**\n * We want to get an unpatched http request implementation to avoid capturing our own calls.\n */\nexport function getNativeHttpRequest(): HttpRequestImpl {\n const { request } = http;\n if (isWrapped(request)) {\n return request.__sentry_original__;\n }\n\n return request;\n}\n\nfunction isWrapped(impl: HttpRequestImpl): impl is WrappedHttpRequest {\n return '__sentry_original__' in impl;\n}\n"],"names":[],"mappings":";;;;AAaA,MAAM,gBAAA,GAAmB,WAAW,CAAA;AACpC;AACA,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAwC,EAAE,KAAK;AACtF,EAAE,MAAM,WAAW;AACnB,IAAI,UAAU,EAAE,OAAO,CAAC,UAAA,IAAc,8BAA8B;AACpE,GAAG,CAAA;AACH;AACA,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,OAAO,YAAY,QAAA,IAAY,OAAO,CAAC,GAAI,IAAG,OAAO,CAAC,GAAG,CAAC,QAAS,KAAI,aAAa,EAAE;AAChG,QAAQ,MAAM,CAAC,IAAI,CAAC,4FAA4F,CAAC,CAAA;AACjH,OAAM;AACN,MAAM,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC1C,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,oBAAqB,GAAE,iBAAiB,CAAC,qBAAqB,EAAC;AAC5E;AACA,SAAS,kBAAkB,CAAC,MAAM,EAAU,OAAO,EAA8C;AACjG,EAAE,MAAM,eAAe,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAC1D,EAAE,IAAI,CAAC,YAAY,EAAE;AACrB,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,IAAI,cAAe,GAAE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,eAAe,CAAC,GAAG,EAA2B;AACvD,EAAE,IAAI;AACN,IAAI,OAAO,IAAI,GAAG,CAAC,CAAC,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AACA,GAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,MAAA,CAAA,IAAA,CAAA,CAAA,iCAAA,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,OAAA,SAAA,CAAA;AACA,GAAA;AACA,CAAA;;AAKA;AACA;AACA;AACA,SAAA,oBAAA,GAAA;AACA,EAAA,MAAA,EAAA,OAAA,EAAA,GAAA,IAAA,CAAA;AACA,EAAA,IAAA,SAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,OAAA,CAAA,mBAAA,CAAA;AACA,GAAA;AACA;AACA,EAAA,OAAA,OAAA,CAAA;AACA,CAAA;AACA;AACA,SAAA,SAAA,CAAA,IAAA,EAAA;AACA,EAAA,OAAA,qBAAA,IAAA,IAAA,CAAA;AACA;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { _optionalChain } from '@sentry/utils';
|
|
2
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
3
|
+
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
|
|
4
|
+
import { defineIntegration, getClient, getIsolationScope, captureException } from '@sentry/core';
|
|
5
|
+
import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
|
|
6
|
+
|
|
7
|
+
const _expressIntegration = (() => {
|
|
8
|
+
return {
|
|
9
|
+
name: 'Express',
|
|
10
|
+
setupOnce() {
|
|
11
|
+
registerInstrumentations({
|
|
12
|
+
instrumentations: [
|
|
13
|
+
new ExpressInstrumentation({
|
|
14
|
+
requestHook(span) {
|
|
15
|
+
addOriginToSpan(span, 'auto.http.otel.express');
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}) ;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Express integration
|
|
26
|
+
*
|
|
27
|
+
* Capture tracing data for express.
|
|
28
|
+
* In order to capture exceptions, you have to call `setupExpressErrorHandler(app)` before any other middleware and after all controllers.
|
|
29
|
+
*/
|
|
30
|
+
const expressIntegration = defineIntegration(_expressIntegration);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* An Express-compatible error handler.
|
|
34
|
+
*/
|
|
35
|
+
function expressErrorHandler(options
|
|
36
|
+
|
|
37
|
+
) {
|
|
38
|
+
return function sentryErrorMiddleware(
|
|
39
|
+
error,
|
|
40
|
+
_req,
|
|
41
|
+
res,
|
|
42
|
+
next,
|
|
43
|
+
) {
|
|
44
|
+
const shouldHandleError = _optionalChain([options, 'optionalAccess', _ => _.shouldHandleError]) || defaultShouldHandleError;
|
|
45
|
+
|
|
46
|
+
if (shouldHandleError(error)) {
|
|
47
|
+
const client = getClient();
|
|
48
|
+
if (client && client.getOptions().autoSessionTracking) {
|
|
49
|
+
// Check if the `SessionFlusher` is instantiated on the client to go into this branch that marks the
|
|
50
|
+
// `requestSession.status` as `Crashed`, and this check is necessary because the `SessionFlusher` is only
|
|
51
|
+
// instantiated when the the`requestHandler` middleware is initialised, which indicates that we should be
|
|
52
|
+
// running in SessionAggregates mode
|
|
53
|
+
const isSessionAggregatesMode = client['_sessionFlusher'] !== undefined;
|
|
54
|
+
if (isSessionAggregatesMode) {
|
|
55
|
+
const requestSession = getIsolationScope().getRequestSession();
|
|
56
|
+
// If an error bubbles to the `errorHandler`, then this is an unhandled error, and should be reported as a
|
|
57
|
+
// Crashed session. The `_requestSession.status` is checked to ensure that this error is happening within
|
|
58
|
+
// the bounds of a request, and if so the status is updated
|
|
59
|
+
if (requestSession && requestSession.status !== undefined) {
|
|
60
|
+
requestSession.status = 'crashed';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const eventId = captureException(error, { mechanism: { type: 'middleware', handled: false } });
|
|
66
|
+
(res ).sentry = eventId;
|
|
67
|
+
next(error);
|
|
68
|
+
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
next(error);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Setup an error handler for Express.
|
|
78
|
+
* The error handler must be before any other middleware and after all controllers.
|
|
79
|
+
*/
|
|
80
|
+
function setupExpressErrorHandler(app) {
|
|
81
|
+
app.use(expressErrorHandler());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getStatusCodeFromResponse(error) {
|
|
85
|
+
const statusCode = error.status || error.statusCode || error.status_code || (error.output && error.output.statusCode);
|
|
86
|
+
return statusCode ? parseInt(statusCode , 10) : 500;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Returns true if response code is internal server error */
|
|
90
|
+
function defaultShouldHandleError(error) {
|
|
91
|
+
const status = getStatusCodeFromResponse(error);
|
|
92
|
+
return status >= 500;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { expressErrorHandler, expressIntegration, setupExpressErrorHandler };
|
|
96
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["import type * as http from 'http';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';\nimport { defineIntegration } from '@sentry/core';\nimport { captureException, getClient, getIsolationScope } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nimport type { NodeClient } from '../../sdk/client';\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst _expressIntegration = (() => {\n return {\n name: 'Express',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [\n new ExpressInstrumentation({\n requestHook(span) {\n addOriginToSpan(span, 'auto.http.otel.express');\n },\n }),\n ],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Express integration\n *\n * Capture tracing data for express.\n * In order to capture exceptions, you have to call `setupExpressErrorHandler(app)` before any other middleware and after all controllers.\n */\nexport const expressIntegration = defineIntegration(_expressIntegration);\n\ninterface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\ntype ExpressMiddleware = (\n error: MiddlewareError,\n req: http.IncomingMessage,\n res: http.ServerResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\n/**\n * An Express-compatible error handler.\n */\nexport function expressErrorHandler(options?: {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured middleware error\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}): ExpressMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n _req: http.IncomingMessage,\n res: http.ServerResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n\n if (shouldHandleError(error)) {\n const client = getClient<NodeClient>();\n if (client && client.getOptions().autoSessionTracking) {\n // Check if the `SessionFlusher` is instantiated on the client to go into this branch that marks the\n // `requestSession.status` as `Crashed`, and this check is necessary because the `SessionFlusher` is only\n // instantiated when the the`requestHandler` middleware is initialised, which indicates that we should be\n // running in SessionAggregates mode\n const isSessionAggregatesMode = client['_sessionFlusher'] !== undefined;\n if (isSessionAggregatesMode) {\n const requestSession = getIsolationScope().getRequestSession();\n // If an error bubbles to the `errorHandler`, then this is an unhandled error, and should be reported as a\n // Crashed session. The `_requestSession.status` is checked to ensure that this error is happening within\n // the bounds of a request, and if so the status is updated\n if (requestSession && requestSession.status !== undefined) {\n requestSession.status = 'crashed';\n }\n }\n }\n\n const eventId = captureException(error, { mechanism: { type: 'middleware', handled: false } });\n (res as { sentry?: string }).sentry = eventId;\n next(error);\n\n return;\n }\n\n next(error);\n };\n}\n\n/**\n * Setup an error handler for Express.\n * The error handler must be before any other middleware and after all controllers.\n */\nexport function setupExpressErrorHandler(app: { use: (middleware: ExpressMiddleware) => unknown }): void {\n app.use(expressErrorHandler());\n}\n\nfunction getStatusCodeFromResponse(error: MiddlewareError): number {\n const statusCode = error.status || error.statusCode || error.status_code || (error.output && error.output.statusCode);\n return statusCode ? parseInt(statusCode as string, 10) : 500;\n}\n\n/** Returns true if response code is internal server error */\nfunction defaultShouldHandleError(error: MiddlewareError): boolean {\n const status = getStatusCodeFromResponse(error);\n return status >= 500;\n}\n"],"names":[],"mappings":";;;;;;AAUA,CAAM,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAuB,CAAM,EAAA,CAAA,EAAA;EACjC,CAAO,CAAA,CAAA,CAAA,CAAA,EAAA;IACL,CAAA,CAAA,CAAA,CAAI,EAAE,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;IACf,SAAS,CAAG,EAAA;MACV,wBAAwB,CAAC;QACvB,gBAAgB,EAAE;UAChB,CAAA,CAAA,EAAI,sBAAsB,CAAC;YACzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAC,CAAA,CAAA,CAAA,CAAI,EAAE;cAChB,eAAe,CAAC,CAAA,CAAA,CAAA,CAAI,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC;YAChD,CAAA;UACb,CAAW,CAAC;QACH,CAAA;MACT,CAAO,CAAC;IACH,CAAA;EACL,CAAG;AACH,CAAC,EAAE;;AAEH,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,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AAE,CAAA,EAAI,EAAA,CAAA,CAAA,CAAG;AAC9D;;AAEA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA;AACA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,EAA4B;EACjE,MAAM,CAAO,CAAA,CAAA,CAAA,CAAA,EAAA,EAAE,yBAAyB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC;EAC/C,CAAO,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,EAAA,CAAA,CAAA,CAAG;AACtB;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { FastifyInstrumentation } from '@opentelemetry/instrumentation-fastify';
|
|
3
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
|
+
import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
|
|
5
|
+
|
|
6
|
+
const _fastifyIntegration = (() => {
|
|
7
|
+
return {
|
|
8
|
+
name: 'Fastify',
|
|
9
|
+
setupOnce() {
|
|
10
|
+
registerInstrumentations({
|
|
11
|
+
instrumentations: [
|
|
12
|
+
new FastifyInstrumentation({
|
|
13
|
+
requestHook(span) {
|
|
14
|
+
addOriginToSpan(span, 'auto.http.otel.fastify');
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}) ;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Express integration
|
|
25
|
+
*
|
|
26
|
+
* Capture tracing data for fastify.
|
|
27
|
+
*/
|
|
28
|
+
const fastifyIntegration = defineIntegration(_fastifyIntegration);
|
|
29
|
+
|
|
30
|
+
export { fastifyIntegration };
|
|
31
|
+
//# sourceMappingURL=fastify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.js","sources":["../../../../src/integrations/tracing/fastify.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { FastifyInstrumentation } from '@opentelemetry/instrumentation-fastify';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst _fastifyIntegration = (() => {\n return {\n name: 'Fastify',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [\n new FastifyInstrumentation({\n requestHook(span) {\n addOriginToSpan(span, 'auto.http.otel.fastify');\n },\n }),\n ],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Express integration\n *\n * Capture tracing data for fastify.\n */\nexport const fastifyIntegration = defineIntegration(_fastifyIntegration);\n"],"names":[],"mappings":";;;;;AAOA,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,SAAS;AACnB,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE;AAC1B,UAAU,IAAI,sBAAsB,CAAC;AACrC,YAAY,WAAW,CAAC,IAAI,EAAE;AAC9B,cAAc,eAAe,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAA;AAC7D,aAAa;AACb,WAAW,CAAC;AACZ,SAAS;AACT,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;MACa,kBAAmB,GAAE,iBAAiB,CAAC,mBAAmB;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';
|
|
3
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
|
+
import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
|
|
5
|
+
|
|
6
|
+
const _graphqlIntegration = (() => {
|
|
7
|
+
return {
|
|
8
|
+
name: 'Graphql',
|
|
9
|
+
setupOnce() {
|
|
10
|
+
registerInstrumentations({
|
|
11
|
+
instrumentations: [
|
|
12
|
+
new GraphQLInstrumentation({
|
|
13
|
+
ignoreTrivialResolveSpans: true,
|
|
14
|
+
responseHook(span) {
|
|
15
|
+
addOriginToSpan(span, 'auto.graphql.otel.graphql');
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}) ;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* GraphQL integration
|
|
26
|
+
*
|
|
27
|
+
* Capture tracing data for GraphQL.
|
|
28
|
+
*/
|
|
29
|
+
const graphqlIntegration = defineIntegration(_graphqlIntegration);
|
|
30
|
+
|
|
31
|
+
export { graphqlIntegration };
|
|
32
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","sources":["../../../../src/integrations/tracing/graphql.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst _graphqlIntegration = (() => {\n return {\n name: 'Graphql',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [\n new GraphQLInstrumentation({\n ignoreTrivialResolveSpans: true,\n responseHook(span) {\n addOriginToSpan(span, 'auto.graphql.otel.graphql');\n },\n }),\n ],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * GraphQL integration\n *\n * Capture tracing data for GraphQL.\n */\nexport const graphqlIntegration = defineIntegration(_graphqlIntegration);\n"],"names":[],"mappings":";;;;;AAOA,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,SAAS;AACnB,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE;AAC1B,UAAU,IAAI,sBAAsB,CAAC;AACrC,YAAY,yBAAyB,EAAE,IAAI;AAC3C,YAAY,YAAY,CAAC,IAAI,EAAE;AAC/B,cAAc,eAAe,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAA;AAChE,aAAa;AACb,WAAW,CAAC;AACZ,SAAS;AACT,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;MACa,kBAAmB,GAAE,iBAAiB,CAAC,mBAAmB;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi';
|
|
3
|
+
import { defineIntegration, SDK_VERSION, getActiveSpan, getRootSpan, captureException } from '@sentry/core';
|
|
4
|
+
|
|
5
|
+
const _hapiIntegration = (() => {
|
|
6
|
+
return {
|
|
7
|
+
name: 'Hapi',
|
|
8
|
+
setupOnce() {
|
|
9
|
+
registerInstrumentations({
|
|
10
|
+
instrumentations: [new HapiInstrumentation()],
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}) ;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hapi integration
|
|
18
|
+
*
|
|
19
|
+
* Capture tracing data for Hapi.
|
|
20
|
+
* If you also want to capture errors, you need to call `setupHapiErrorHandler(server)` after you set up your server.
|
|
21
|
+
*/
|
|
22
|
+
const hapiIntegration = defineIntegration(_hapiIntegration);
|
|
23
|
+
|
|
24
|
+
function isBoomObject(response) {
|
|
25
|
+
return response && (response ).isBoom !== undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isErrorEvent(event) {
|
|
29
|
+
return event && (event ).error !== undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function sendErrorToSentry(errorData) {
|
|
33
|
+
captureException(errorData, {
|
|
34
|
+
mechanism: {
|
|
35
|
+
type: 'hapi',
|
|
36
|
+
handled: false,
|
|
37
|
+
data: {
|
|
38
|
+
function: 'hapiErrorPlugin',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const hapiErrorPlugin = {
|
|
45
|
+
name: 'SentryHapiErrorPlugin',
|
|
46
|
+
version: SDK_VERSION,
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
register: async function (serverArg) {
|
|
49
|
+
const server = serverArg ;
|
|
50
|
+
|
|
51
|
+
server.events.on('request', (request, event) => {
|
|
52
|
+
const activeSpan = getActiveSpan();
|
|
53
|
+
const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;
|
|
54
|
+
|
|
55
|
+
if (request.response && isBoomObject(request.response)) {
|
|
56
|
+
sendErrorToSentry(request.response);
|
|
57
|
+
} else if (isErrorEvent(event)) {
|
|
58
|
+
sendErrorToSentry(event.error);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (rootSpan) {
|
|
62
|
+
rootSpan.setStatus('internal_error');
|
|
63
|
+
rootSpan.end();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Add a Hapi plugin to capture errors to Sentry.
|
|
71
|
+
*/
|
|
72
|
+
async function setupHapiErrorHandler(server) {
|
|
73
|
+
await server.register(hapiErrorPlugin);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { hapiErrorPlugin, hapiIntegration, setupHapiErrorHandler };
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/hapi/index.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi';\nimport { SDK_VERSION, captureException, defineIntegration, getActiveSpan, getRootSpan } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\nimport type { Boom, RequestEvent, ResponseObject, Server } from './types';\n\nconst _hapiIntegration = (() => {\n return {\n name: 'Hapi',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [new HapiInstrumentation()],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Hapi integration\n *\n * Capture tracing data for Hapi.\n * If you also want to capture errors, you need to call `setupHapiErrorHandler(server)` after you set up your server.\n */\nexport const hapiIntegration = defineIntegration(_hapiIntegration);\n\nfunction isBoomObject(response: ResponseObject | Boom): response is Boom {\n return response && (response as Boom).isBoom !== undefined;\n}\n\nfunction isErrorEvent(event: RequestEvent): event is RequestEvent {\n return event && (event as RequestEvent).error !== undefined;\n}\n\nfunction sendErrorToSentry(errorData: object): void {\n captureException(errorData, {\n mechanism: {\n type: 'hapi',\n handled: false,\n data: {\n function: 'hapiErrorPlugin',\n },\n },\n });\n}\n\nexport const hapiErrorPlugin = {\n name: 'SentryHapiErrorPlugin',\n version: SDK_VERSION,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register: async function (serverArg: Record<any, any>) {\n const server = serverArg as unknown as Server;\n\n server.events.on('request', (request, event) => {\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;\n\n if (request.response && isBoomObject(request.response)) {\n sendErrorToSentry(request.response);\n } else if (isErrorEvent(event)) {\n sendErrorToSentry(event.error);\n }\n\n if (rootSpan) {\n rootSpan.setStatus('internal_error');\n rootSpan.end();\n }\n });\n },\n};\n\n/**\n * Add a Hapi plugin to capture errors to Sentry.\n */\nexport async function setupHapiErrorHandler(server: Server): Promise<void> {\n await server.register(hapiErrorPlugin);\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,gBAAiB,IAAG,MAAM;AAChC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE,CAAC,IAAI,mBAAmB,EAAE,CAAC;AACrD,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;AACA;MACa,eAAgB,GAAE,iBAAiB,CAAC,gBAAgB,EAAC;AAClE;AACA,SAAS,YAAY,CAAC,QAAQ,EAA2C;AACzE,EAAE,OAAO,YAAY,CAAC,WAAkB,MAAO,KAAI,SAAS,CAAA;AAC5D,CAAA;AACA;AACA,SAAS,YAAY,CAAC,KAAK,EAAuC;AAClE,EAAE,OAAO,SAAS,CAAC,QAAuB,KAAM,KAAI,SAAS,CAAA;AAC7D,CAAA;AACA;AACA,SAAS,iBAAiB,CAAC,SAAS,EAAgB;AACpD,EAAE,gBAAgB,CAAC,SAAS,EAAE;AAC9B,IAAI,SAAS,EAAE;AACf,MAAM,IAAI,EAAE,MAAM;AAClB,MAAM,OAAO,EAAE,KAAK;AACpB,MAAM,IAAI,EAAE;AACZ,QAAQ,QAAQ,EAAE,iBAAiB;AACnC,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACO,MAAM,kBAAkB;AAC/B,EAAE,IAAI,EAAE,uBAAuB;AAC/B,EAAE,OAAO,EAAE,WAAW;AACtB;AACA,EAAE,QAAQ,EAAE,gBAAgB,SAAS,EAAoB;AACzD,IAAI,MAAM,MAAO,GAAE,SAAU,EAAA;AAC7B;AACA,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK;AACpD,MAAM,MAAM,UAAA,GAAa,aAAa,EAAE,CAAA;AACxC,MAAM,MAAM,QAAS,GAAE,UAAW,GAAE,WAAW,CAAC,UAAU,CAAE,GAAE,SAAS,CAAA;AACvE;AACA,MAAM,IAAI,OAAO,CAAC,QAAS,IAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC9D,QAAQ,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC3C,OAAM,MAAO,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;AACtC,QAAQ,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACtC,OAAM;AACN;AACA,MAAM,IAAI,QAAQ,EAAE;AACpB,QAAQ,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAC5C,QAAQ,QAAQ,CAAC,GAAG,EAAE,CAAA;AACtB,OAAM;AACN,KAAK,CAAC,CAAA;AACN,GAAG;AACH,EAAC;AACD;AACA;AACA;AACA;AACO,eAAe,qBAAqB,CAAC,MAAM,EAAyB;AAC3E,EAAE,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;AACxC;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { expressIntegration } from './express.js';
|
|
2
|
+
import { fastifyIntegration } from './fastify.js';
|
|
3
|
+
import { graphqlIntegration } from './graphql.js';
|
|
4
|
+
import { hapiIntegration } from './hapi/index.js';
|
|
5
|
+
import { koaIntegration } from './koa.js';
|
|
6
|
+
import { mongoIntegration } from './mongo.js';
|
|
7
|
+
import { mongooseIntegration } from './mongoose.js';
|
|
8
|
+
import { mysqlIntegration } from './mysql.js';
|
|
9
|
+
import { mysql2Integration } from './mysql2.js';
|
|
10
|
+
import { nestIntegration } from './nest.js';
|
|
11
|
+
import { postgresIntegration } from './postgres.js';
|
|
12
|
+
import { prismaIntegration } from './prisma.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.
|
|
16
|
+
*/
|
|
17
|
+
function getAutoPerformanceIntegrations() {
|
|
18
|
+
return [
|
|
19
|
+
expressIntegration(),
|
|
20
|
+
fastifyIntegration(),
|
|
21
|
+
graphqlIntegration(),
|
|
22
|
+
mongoIntegration(),
|
|
23
|
+
mongooseIntegration(),
|
|
24
|
+
mysqlIntegration(),
|
|
25
|
+
mysql2Integration(),
|
|
26
|
+
postgresIntegration(),
|
|
27
|
+
prismaIntegration(),
|
|
28
|
+
nestIntegration(),
|
|
29
|
+
hapiIntegration(),
|
|
30
|
+
koaIntegration(),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { getAutoPerformanceIntegrations };
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/types';\n\nimport { expressIntegration } from './express';\nimport { fastifyIntegration } from './fastify';\nimport { graphqlIntegration } from './graphql';\nimport { hapiIntegration } from './hapi';\nimport { koaIntegration } from './koa';\nimport { mongoIntegration } from './mongo';\nimport { mongooseIntegration } from './mongoose';\nimport { mysqlIntegration } from './mysql';\nimport { mysql2Integration } from './mysql2';\nimport { nestIntegration } from './nest';\nimport { postgresIntegration } from './postgres';\nimport { prismaIntegration } from './prisma';\n\n/**\n * With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.\n */\nexport function getAutoPerformanceIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n postgresIntegration(),\n prismaIntegration(),\n nestIntegration(),\n hapiIntegration(),\n koaIntegration(),\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAeA;AACA;AACA;AACO,SAAS,8BAA8B,GAAkB;AAChE,EAAE,OAAO;AACT,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,gBAAgB,EAAE;AACtB,IAAI,mBAAmB,EAAE;AACzB,IAAI,gBAAgB,EAAE;AACtB,IAAI,iBAAiB,EAAE;AACvB,IAAI,mBAAmB,EAAE;AACzB,IAAI,iBAAiB,EAAE;AACvB,IAAI,eAAe,EAAE;AACrB,IAAI,eAAe,EAAE;AACrB,IAAI,cAAc,EAAE;AACpB,GAAG,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';
|
|
3
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
|
+
|
|
5
|
+
const _koaIntegration = (() => {
|
|
6
|
+
return {
|
|
7
|
+
name: 'Koa',
|
|
8
|
+
setupOnce() {
|
|
9
|
+
registerInstrumentations({
|
|
10
|
+
instrumentations: [new KoaInstrumentation()],
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}) ;
|
|
15
|
+
|
|
16
|
+
const koaIntegration = defineIntegration(_koaIntegration);
|
|
17
|
+
|
|
18
|
+
export { koaIntegration };
|
|
19
|
+
//# sourceMappingURL=koa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"koa.js","sources":["../../../../src/integrations/tracing/koa.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nconst _koaIntegration = (() => {\n return {\n name: 'Koa',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [new KoaInstrumentation()],\n });\n },\n };\n}) satisfies IntegrationFn;\n\nexport const koaIntegration = defineIntegration(_koaIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,eAAgB,IAAG,MAAM;AAC/B,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE,CAAC,IAAI,kBAAkB,EAAE,CAAC;AACpD,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;MACa,cAAe,GAAE,iBAAiB,CAAC,eAAe;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
|
|
3
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
|
+
import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
|
|
5
|
+
|
|
6
|
+
const _mongoIntegration = (() => {
|
|
7
|
+
return {
|
|
8
|
+
name: 'Mongo',
|
|
9
|
+
setupOnce() {
|
|
10
|
+
registerInstrumentations({
|
|
11
|
+
instrumentations: [
|
|
12
|
+
new MongoDBInstrumentation({
|
|
13
|
+
responseHook(span) {
|
|
14
|
+
addOriginToSpan(span, 'auto.db.otel.mongo');
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}) ;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* MongoDB integration
|
|
25
|
+
*
|
|
26
|
+
* Capture tracing data for MongoDB.
|
|
27
|
+
*/
|
|
28
|
+
const mongoIntegration = defineIntegration(_mongoIntegration);
|
|
29
|
+
|
|
30
|
+
export { mongoIntegration };
|
|
31
|
+
//# sourceMappingURL=mongo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo.js","sources":["../../../../src/integrations/tracing/mongo.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst _mongoIntegration = (() => {\n return {\n name: 'Mongo',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [\n new MongoDBInstrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongo');\n },\n }),\n ],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * MongoDB integration\n *\n * Capture tracing data for MongoDB.\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":[],"mappings":";;;;;AAOA,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE;AAC1B,UAAU,IAAI,sBAAsB,CAAC;AACrC,YAAY,YAAY,CAAC,IAAI,EAAE;AAC/B,cAAc,eAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAA;AACzD,aAAa;AACb,WAAW,CAAC;AACZ,SAAS;AACT,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAE,iBAAiB,CAAC,iBAAiB;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';
|
|
3
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
|
+
import { addOriginToSpan } from '../../utils/addOriginToSpan.js';
|
|
5
|
+
|
|
6
|
+
const _mongooseIntegration = (() => {
|
|
7
|
+
return {
|
|
8
|
+
name: 'Mongoose',
|
|
9
|
+
setupOnce() {
|
|
10
|
+
registerInstrumentations({
|
|
11
|
+
instrumentations: [
|
|
12
|
+
new MongooseInstrumentation({
|
|
13
|
+
responseHook(span) {
|
|
14
|
+
addOriginToSpan(span, 'auto.db.otel.mongoose');
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}) ;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Mongoose integration
|
|
25
|
+
*
|
|
26
|
+
* Capture tracing data for Mongoose.
|
|
27
|
+
*/
|
|
28
|
+
const mongooseIntegration = defineIntegration(_mongooseIntegration);
|
|
29
|
+
|
|
30
|
+
export { mongooseIntegration };
|
|
31
|
+
//# sourceMappingURL=mongoose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongoose.js","sources":["../../../../src/integrations/tracing/mongoose.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nimport { addOriginToSpan } from '../../utils/addOriginToSpan';\n\nconst _mongooseIntegration = (() => {\n return {\n name: 'Mongoose',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [\n new MongooseInstrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongoose');\n },\n }),\n ],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Mongoose integration\n *\n * Capture tracing data for Mongoose.\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":[],"mappings":";;;;;AAOA,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,UAAU;AACpB,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE;AAC1B,UAAU,IAAI,uBAAuB,CAAC;AACtC,YAAY,YAAY,CAAC,IAAI,EAAE;AAC/B,cAAc,eAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAA;AAC5D,aAAa;AACb,WAAW,CAAC;AACZ,SAAS;AACT,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;MACa,mBAAoB,GAAE,iBAAiB,CAAC,oBAAoB;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';
|
|
3
|
+
import { defineIntegration } from '@sentry/core';
|
|
4
|
+
|
|
5
|
+
const _mysqlIntegration = (() => {
|
|
6
|
+
return {
|
|
7
|
+
name: 'Mysql',
|
|
8
|
+
setupOnce() {
|
|
9
|
+
registerInstrumentations({
|
|
10
|
+
instrumentations: [new MySQLInstrumentation({})],
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}) ;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* MySQL integration
|
|
18
|
+
*
|
|
19
|
+
* Capture tracing data for mysql.
|
|
20
|
+
*/
|
|
21
|
+
const mysqlIntegration = defineIntegration(_mysqlIntegration);
|
|
22
|
+
|
|
23
|
+
export { mysqlIntegration };
|
|
24
|
+
//# sourceMappingURL=mysql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql.js","sources":["../../../../src/integrations/tracing/mysql.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';\nimport { defineIntegration } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\n\nconst _mysqlIntegration = (() => {\n return {\n name: 'Mysql',\n setupOnce() {\n registerInstrumentations({\n instrumentations: [new MySQLInstrumentation({})],\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * MySQL integration\n *\n * Capture tracing data for mysql.\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,iBAAkB,IAAG,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,SAAS,GAAG;AAChB,MAAM,wBAAwB,CAAC;AAC/B,QAAQ,gBAAgB,EAAE,CAAC,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAC;AACxD,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;MACa,gBAAiB,GAAE,iBAAiB,CAAC,iBAAiB;;;;"}
|