@sentry/node 9.35.0 → 9.36.0-alpha.2
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/build/cjs/index.js +38 -56
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/fs.js +2 -2
- package/build/cjs/integrations/fs.js.map +1 -1
- package/build/cjs/integrations/http/index.js +7 -11
- package/build/cjs/integrations/http/index.js.map +1 -1
- package/build/cjs/integrations/node-fetch/index.js +4 -5
- package/build/cjs/integrations/node-fetch/index.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib.js +4 -5
- package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
- package/build/cjs/integrations/tracing/connect.js +3 -4
- package/build/cjs/integrations/tracing/connect.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader.js +3 -3
- package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
- package/build/cjs/integrations/tracing/express.js +5 -7
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js +3 -3
- package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +6 -6
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool.js +3 -3
- package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql.js +3 -4
- package/build/cjs/integrations/tracing/graphql.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js +3 -4
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka.js +4 -5
- package/build/cjs/integrations/tracing/kafka.js.map +1 -1
- package/build/cjs/integrations/tracing/knex.js +3 -3
- package/build/cjs/integrations/tracing/knex.js.map +1 -1
- package/build/cjs/integrations/tracing/koa.js +4 -6
- package/build/cjs/integrations/tracing/koa.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer.js +2 -2
- package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo.js +3 -4
- package/build/cjs/integrations/tracing/mongo.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose.js +3 -4
- package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql.js +2 -2
- package/build/cjs/integrations/tracing/mysql.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2.js +3 -4
- package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres.js +3 -4
- package/build/cjs/integrations/tracing/postgres.js.map +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js +3 -4
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma.js +2 -2
- package/build/cjs/integrations/tracing/prisma.js.map +1 -1
- package/build/cjs/integrations/tracing/redis.js +3 -3
- package/build/cjs/integrations/tracing/redis.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious.js +3 -3
- package/build/cjs/integrations/tracing/tedious.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/index.js +2 -2
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/cjs/preload.js +2 -2
- package/build/cjs/preload.js.map +1 -1
- package/build/cjs/sdk/index.js +22 -203
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/cjs/sdk/initOtel.js +4 -22
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/esm/index.js +2 -21
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/fs.js +1 -1
- package/build/esm/integrations/fs.js.map +1 -1
- package/build/esm/integrations/http/index.js +1 -5
- package/build/esm/integrations/http/index.js.map +1 -1
- package/build/esm/integrations/node-fetch/index.js +2 -3
- package/build/esm/integrations/node-fetch/index.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib.js +1 -2
- package/build/esm/integrations/tracing/amqplib.js.map +1 -1
- package/build/esm/integrations/tracing/connect.js +1 -2
- package/build/esm/integrations/tracing/connect.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader.js +1 -1
- package/build/esm/integrations/tracing/dataloader.js.map +1 -1
- package/build/esm/integrations/tracing/express.js +2 -4
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/fastify-otel/index.js +3 -3
- package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js +5 -5
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool.js +1 -1
- package/build/esm/integrations/tracing/genericPool.js.map +1 -1
- package/build/esm/integrations/tracing/graphql.js +2 -3
- package/build/esm/integrations/tracing/graphql.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js +1 -2
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka.js +1 -2
- package/build/esm/integrations/tracing/kafka.js.map +1 -1
- package/build/esm/integrations/tracing/knex.js +1 -1
- package/build/esm/integrations/tracing/knex.js.map +1 -1
- package/build/esm/integrations/tracing/koa.js +2 -4
- package/build/esm/integrations/tracing/koa.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer.js +1 -1
- package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
- package/build/esm/integrations/tracing/mongo.js +1 -2
- package/build/esm/integrations/tracing/mongo.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose.js +1 -2
- package/build/esm/integrations/tracing/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mysql.js +1 -1
- package/build/esm/integrations/tracing/mysql.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2.js +1 -2
- package/build/esm/integrations/tracing/mysql2.js.map +1 -1
- package/build/esm/integrations/tracing/postgres.js +1 -2
- package/build/esm/integrations/tracing/postgres.js.map +1 -1
- package/build/esm/integrations/tracing/postgresjs.js +2 -3
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/prisma.js +1 -1
- package/build/esm/integrations/tracing/prisma.js.map +1 -1
- package/build/esm/integrations/tracing/redis.js +1 -1
- package/build/esm/integrations/tracing/redis.js.map +1 -1
- package/build/esm/integrations/tracing/tedious.js +1 -1
- package/build/esm/integrations/tracing/tedious.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/preload.js +1 -1
- package/build/esm/preload.js.map +1 -1
- package/build/esm/sdk/index.js +22 -202
- package/build/esm/sdk/index.js.map +1 -1
- package/build/esm/sdk/initOtel.js +3 -21
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/types/index.d.ts +2 -21
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/http/index.d.ts +1 -1
- package/build/types/integrations/http/index.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect.d.ts.map +1 -1
- package/build/types/integrations/tracing/express.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
- package/build/types/sdk/index.d.ts +2 -6
- package/build/types/sdk/index.d.ts.map +1 -1
- package/build/types/sdk/initOtel.d.ts +1 -1
- package/build/types/sdk/initOtel.d.ts.map +1 -1
- package/build/types/types.d.ts +1 -1
- package/build/types/types.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -21
- package/build/types-ts3.8/integrations/http/index.d.ts +1 -1
- package/build/types-ts3.8/sdk/index.d.ts +2 -6
- package/build/types-ts3.8/sdk/initOtel.d.ts +1 -1
- package/build/types-ts3.8/types.d.ts +1 -1
- package/package.json +4 -3
- package/build/cjs/cron/common.js +0 -56
- package/build/cjs/cron/common.js.map +0 -1
- package/build/cjs/cron/cron.js +0 -112
- package/build/cjs/cron/cron.js.map +0 -1
- package/build/cjs/cron/index.js +0 -15
- package/build/cjs/cron/index.js.map +0 -1
- package/build/cjs/cron/node-cron.js +0 -71
- package/build/cjs/cron/node-cron.js.map +0 -1
- package/build/cjs/cron/node-schedule.js +0 -65
- package/build/cjs/cron/node-schedule.js.map +0 -1
- package/build/cjs/integrations/anr/index.js +0 -238
- package/build/cjs/integrations/anr/index.js.map +0 -1
- package/build/cjs/integrations/childProcess.js +0 -100
- package/build/cjs/integrations/childProcess.js.map +0 -1
- package/build/cjs/integrations/context.js +0 -457
- package/build/cjs/integrations/context.js.map +0 -1
- package/build/cjs/integrations/contextlines.js +0 -405
- package/build/cjs/integrations/contextlines.js.map +0 -1
- package/build/cjs/integrations/http/SentryHttpInstrumentation.js +0 -558
- package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +0 -1
- package/build/cjs/integrations/local-variables/common.js +0 -69
- package/build/cjs/integrations/local-variables/common.js.map +0 -1
- package/build/cjs/integrations/local-variables/index.js +0 -12
- package/build/cjs/integrations/local-variables/index.js.map +0 -1
- package/build/cjs/integrations/local-variables/local-variables-async.js +0 -143
- package/build/cjs/integrations/local-variables/local-variables-async.js.map +0 -1
- package/build/cjs/integrations/local-variables/local-variables-sync.js +0 -410
- package/build/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
- package/build/cjs/integrations/modules.js +0 -135
- package/build/cjs/integrations/modules.js.map +0 -1
- package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -291
- package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
- package/build/cjs/integrations/onuncaughtexception.js +0 -134
- package/build/cjs/integrations/onuncaughtexception.js.map +0 -1
- package/build/cjs/integrations/onunhandledrejection.js +0 -89
- package/build/cjs/integrations/onunhandledrejection.js.map +0 -1
- package/build/cjs/integrations/processSession.js +0 -36
- package/build/cjs/integrations/processSession.js.map +0 -1
- package/build/cjs/integrations/spotlight.js +0 -101
- package/build/cjs/integrations/spotlight.js.map +0 -1
- package/build/cjs/integrations/winston.js +0 -151
- package/build/cjs/integrations/winston.js.map +0 -1
- package/build/cjs/logs/capture.js +0 -29
- package/build/cjs/logs/capture.js.map +0 -1
- package/build/cjs/logs/exports.js +0 -178
- package/build/cjs/logs/exports.js.map +0 -1
- package/build/cjs/nodeVersion.js +0 -12
- package/build/cjs/nodeVersion.js.map +0 -1
- package/build/cjs/otel/contextManager.js +0 -16
- package/build/cjs/otel/contextManager.js.map +0 -1
- package/build/cjs/otel/instrument.js +0 -139
- package/build/cjs/otel/instrument.js.map +0 -1
- package/build/cjs/proxy/base.js +0 -122
- package/build/cjs/proxy/base.js.map +0 -1
- package/build/cjs/proxy/index.js +0 -173
- package/build/cjs/proxy/index.js.map +0 -1
- package/build/cjs/proxy/parse-proxy-response.js +0 -104
- package/build/cjs/proxy/parse-proxy-response.js.map +0 -1
- package/build/cjs/sdk/api.js +0 -117
- package/build/cjs/sdk/api.js.map +0 -1
- package/build/cjs/sdk/client.js +0 -156
- package/build/cjs/sdk/client.js.map +0 -1
- package/build/cjs/transports/http.js +0 -158
- package/build/cjs/transports/http.js.map +0 -1
- package/build/cjs/utils/addOriginToSpan.js +0 -11
- package/build/cjs/utils/addOriginToSpan.js.map +0 -1
- package/build/cjs/utils/baggage.js +0 -36
- package/build/cjs/utils/baggage.js.map +0 -1
- package/build/cjs/utils/commonjs.js +0 -13
- package/build/cjs/utils/commonjs.js.map +0 -1
- package/build/cjs/utils/createMissingInstrumentationContext.js +0 -11
- package/build/cjs/utils/createMissingInstrumentationContext.js.map +0 -1
- package/build/cjs/utils/debug.js +0 -23
- package/build/cjs/utils/debug.js.map +0 -1
- package/build/cjs/utils/ensureIsWrapped.js +0 -41
- package/build/cjs/utils/ensureIsWrapped.js.map +0 -1
- package/build/cjs/utils/envToBool.js +0 -32
- package/build/cjs/utils/envToBool.js.map +0 -1
- package/build/cjs/utils/errorhandling.js +0 -42
- package/build/cjs/utils/errorhandling.js.map +0 -1
- package/build/cjs/utils/getRequestUrl.js +0 -18
- package/build/cjs/utils/getRequestUrl.js.map +0 -1
- package/build/cjs/utils/module.js +0 -60
- package/build/cjs/utils/module.js.map +0 -1
- package/build/esm/cron/common.js +0 -54
- package/build/esm/cron/common.js.map +0 -1
- package/build/esm/cron/cron.js +0 -110
- package/build/esm/cron/cron.js.map +0 -1
- package/build/esm/cron/index.js +0 -13
- package/build/esm/cron/index.js.map +0 -1
- package/build/esm/cron/node-cron.js +0 -69
- package/build/esm/cron/node-cron.js.map +0 -1
- package/build/esm/cron/node-schedule.js +0 -63
- package/build/esm/cron/node-schedule.js.map +0 -1
- package/build/esm/integrations/anr/index.js +0 -234
- package/build/esm/integrations/anr/index.js.map +0 -1
- package/build/esm/integrations/anr/worker-script.js +0 -2
- package/build/esm/integrations/childProcess.js +0 -98
- package/build/esm/integrations/childProcess.js.map +0 -1
- package/build/esm/integrations/context.js +0 -451
- package/build/esm/integrations/context.js.map +0 -1
- package/build/esm/integrations/contextlines.js +0 -399
- package/build/esm/integrations/contextlines.js.map +0 -1
- package/build/esm/integrations/http/SentryHttpInstrumentation.js +0 -555
- package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +0 -1
- package/build/esm/integrations/local-variables/common.js +0 -64
- package/build/esm/integrations/local-variables/common.js.map +0 -1
- package/build/esm/integrations/local-variables/index.js +0 -10
- package/build/esm/integrations/local-variables/index.js.map +0 -1
- package/build/esm/integrations/local-variables/local-variables-async.js +0 -140
- package/build/esm/integrations/local-variables/local-variables-async.js.map +0 -1
- package/build/esm/integrations/local-variables/local-variables-sync.js +0 -405
- package/build/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
- package/build/esm/integrations/local-variables/worker-script.js +0 -2
- package/build/esm/integrations/modules.js +0 -133
- package/build/esm/integrations/modules.js.map +0 -1
- package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -289
- package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
- package/build/esm/integrations/onuncaughtexception.js +0 -131
- package/build/esm/integrations/onuncaughtexception.js.map +0 -1
- package/build/esm/integrations/onunhandledrejection.js +0 -86
- package/build/esm/integrations/onunhandledrejection.js.map +0 -1
- package/build/esm/integrations/processSession.js +0 -34
- package/build/esm/integrations/processSession.js.map +0 -1
- package/build/esm/integrations/spotlight.js +0 -98
- package/build/esm/integrations/spotlight.js.map +0 -1
- package/build/esm/integrations/winston.js +0 -149
- package/build/esm/integrations/winston.js.map +0 -1
- package/build/esm/logs/capture.js +0 -27
- package/build/esm/logs/capture.js.map +0 -1
- package/build/esm/logs/exports.js +0 -170
- package/build/esm/logs/exports.js.map +0 -1
- package/build/esm/nodeVersion.js +0 -8
- package/build/esm/nodeVersion.js.map +0 -1
- package/build/esm/otel/contextManager.js +0 -14
- package/build/esm/otel/contextManager.js.map +0 -1
- package/build/esm/otel/instrument.js +0 -135
- package/build/esm/otel/instrument.js.map +0 -1
- package/build/esm/proxy/base.js +0 -120
- package/build/esm/proxy/base.js.map +0 -1
- package/build/esm/proxy/index.js +0 -171
- package/build/esm/proxy/index.js.map +0 -1
- package/build/esm/proxy/parse-proxy-response.js +0 -102
- package/build/esm/proxy/parse-proxy-response.js.map +0 -1
- package/build/esm/sdk/api.js +0 -114
- package/build/esm/sdk/api.js.map +0 -1
- package/build/esm/sdk/client.js +0 -154
- package/build/esm/sdk/client.js.map +0 -1
- package/build/esm/transports/http.js +0 -156
- package/build/esm/transports/http.js.map +0 -1
- package/build/esm/utils/addOriginToSpan.js +0 -9
- package/build/esm/utils/addOriginToSpan.js.map +0 -1
- package/build/esm/utils/baggage.js +0 -34
- package/build/esm/utils/baggage.js.map +0 -1
- package/build/esm/utils/commonjs.js +0 -11
- package/build/esm/utils/commonjs.js.map +0 -1
- package/build/esm/utils/createMissingInstrumentationContext.js +0 -9
- package/build/esm/utils/createMissingInstrumentationContext.js.map +0 -1
- package/build/esm/utils/debug.js +0 -21
- package/build/esm/utils/debug.js.map +0 -1
- package/build/esm/utils/ensureIsWrapped.js +0 -39
- package/build/esm/utils/ensureIsWrapped.js.map +0 -1
- package/build/esm/utils/envToBool.js +0 -28
- package/build/esm/utils/envToBool.js.map +0 -1
- package/build/esm/utils/errorhandling.js +0 -40
- package/build/esm/utils/errorhandling.js.map +0 -1
- package/build/esm/utils/getRequestUrl.js +0 -16
- package/build/esm/utils/getRequestUrl.js.map +0 -1
- package/build/esm/utils/module.js +0 -58
- package/build/esm/utils/module.js.map +0 -1
- package/build/types/cron/common.d.ts +0 -5
- package/build/types/cron/common.d.ts.map +0 -1
- package/build/types/cron/cron.d.ts +0 -43
- package/build/types/cron/cron.d.ts.map +0 -1
- package/build/types/cron/index.d.ts +0 -10
- package/build/types/cron/index.d.ts.map +0 -1
- package/build/types/cron/node-cron.d.ts +0 -27
- package/build/types/cron/node-cron.d.ts.map +0 -1
- package/build/types/cron/node-schedule.d.ts +0 -19
- package/build/types/cron/node-schedule.d.ts.map +0 -1
- package/build/types/integrations/anr/common.d.ts +0 -52
- package/build/types/integrations/anr/common.d.ts.map +0 -1
- package/build/types/integrations/anr/index.d.ts +0 -13
- package/build/types/integrations/anr/index.d.ts.map +0 -1
- package/build/types/integrations/anr/worker.d.ts +0 -2
- package/build/types/integrations/anr/worker.d.ts.map +0 -1
- package/build/types/integrations/childProcess.d.ts +0 -20
- package/build/types/integrations/childProcess.d.ts.map +0 -1
- package/build/types/integrations/context.d.ts +0 -30
- package/build/types/integrations/context.d.ts.map +0 -1
- package/build/types/integrations/contextlines.d.ts +0 -31
- package/build/types/integrations/contextlines.d.ts.map +0 -1
- package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +0 -131
- package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +0 -1
- package/build/types/integrations/local-variables/common.d.ts +0 -66
- package/build/types/integrations/local-variables/common.d.ts.map +0 -1
- package/build/types/integrations/local-variables/index.d.ts +0 -4
- package/build/types/integrations/local-variables/index.d.ts.map +0 -1
- package/build/types/integrations/local-variables/local-variables-async.d.ts +0 -7
- package/build/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
- package/build/types/integrations/local-variables/local-variables-sync.d.ts +0 -34
- package/build/types/integrations/local-variables/local-variables-sync.d.ts.map +0 -1
- package/build/types/integrations/local-variables/worker.d.ts +0 -2
- package/build/types/integrations/local-variables/worker.d.ts.map +0 -1
- package/build/types/integrations/modules.d.ts +0 -17
- package/build/types/integrations/modules.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
- package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts.map +0 -1
- package/build/types/integrations/onuncaughtexception.d.ts +0 -31
- package/build/types/integrations/onuncaughtexception.d.ts.map +0 -1
- package/build/types/integrations/onunhandledrejection.d.ts +0 -23
- package/build/types/integrations/onunhandledrejection.d.ts.map +0 -1
- package/build/types/integrations/processSession.d.ts +0 -5
- package/build/types/integrations/processSession.d.ts.map +0 -1
- package/build/types/integrations/spotlight.d.ts +0 -18
- package/build/types/integrations/spotlight.d.ts.map +0 -1
- package/build/types/integrations/winston.d.ts +0 -44
- package/build/types/integrations/winston.d.ts.map +0 -1
- package/build/types/logs/capture.d.ts +0 -11
- package/build/types/logs/capture.d.ts.map +0 -1
- package/build/types/logs/exports.d.ts +0 -150
- package/build/types/logs/exports.d.ts.map +0 -1
- package/build/types/nodeVersion.d.ts +0 -8
- package/build/types/nodeVersion.d.ts.map +0 -1
- package/build/types/otel/contextManager.d.ts +0 -10
- package/build/types/otel/contextManager.d.ts.map +0 -1
- package/build/types/otel/instrument.d.ts +0 -23
- package/build/types/otel/instrument.d.ts.map +0 -1
- package/build/types/proxy/base.d.ts +0 -65
- package/build/types/proxy/base.d.ts.map +0 -1
- package/build/types/proxy/helpers.d.ts +0 -42
- package/build/types/proxy/helpers.d.ts.map +0 -1
- package/build/types/proxy/index.d.ts +0 -73
- package/build/types/proxy/index.d.ts.map +0 -1
- package/build/types/proxy/parse-proxy-response.d.ts +0 -43
- package/build/types/proxy/parse-proxy-response.d.ts.map +0 -1
- package/build/types/sdk/api.d.ts +0 -8
- package/build/types/sdk/api.d.ts.map +0 -1
- package/build/types/sdk/client.d.ts +0 -29
- package/build/types/sdk/client.d.ts.map +0 -1
- package/build/types/sdk/scope.d.ts +0 -7
- package/build/types/sdk/scope.d.ts.map +0 -1
- package/build/types/transports/http-module.d.ts +0 -31
- package/build/types/transports/http-module.d.ts.map +0 -1
- package/build/types/transports/http.d.ts +0 -21
- package/build/types/transports/http.d.ts.map +0 -1
- package/build/types/transports/index.d.ts +0 -3
- package/build/types/transports/index.d.ts.map +0 -1
- package/build/types/utils/addOriginToSpan.d.ts +0 -5
- package/build/types/utils/addOriginToSpan.d.ts.map +0 -1
- package/build/types/utils/baggage.d.ts +0 -6
- package/build/types/utils/baggage.d.ts.map +0 -1
- package/build/types/utils/commonjs.d.ts +0 -3
- package/build/types/utils/commonjs.d.ts.map +0 -1
- package/build/types/utils/createMissingInstrumentationContext.d.ts +0 -3
- package/build/types/utils/createMissingInstrumentationContext.d.ts.map +0 -1
- package/build/types/utils/debug.d.ts +0 -5
- package/build/types/utils/debug.d.ts.map +0 -1
- package/build/types/utils/ensureIsWrapped.d.ts +0 -5
- package/build/types/utils/ensureIsWrapped.d.ts.map +0 -1
- package/build/types/utils/entry-point.d.ts +0 -24
- package/build/types/utils/entry-point.d.ts.map +0 -1
- package/build/types/utils/envToBool.d.ts +0 -13
- package/build/types/utils/envToBool.d.ts.map +0 -1
- package/build/types/utils/errorhandling.d.ts +0 -5
- package/build/types/utils/errorhandling.d.ts.map +0 -1
- package/build/types/utils/getRequestUrl.d.ts +0 -5
- package/build/types/utils/getRequestUrl.d.ts.map +0 -1
- package/build/types/utils/module.d.ts +0 -3
- package/build/types/utils/module.d.ts.map +0 -1
- package/build/types/utils/prepareEvent.d.ts +0 -17
- package/build/types/utils/prepareEvent.d.ts.map +0 -1
- package/build/types-ts3.8/cron/common.d.ts +0 -5
- package/build/types-ts3.8/cron/cron.d.ts +0 -43
- package/build/types-ts3.8/cron/index.d.ts +0 -10
- package/build/types-ts3.8/cron/node-cron.d.ts +0 -27
- package/build/types-ts3.8/cron/node-schedule.d.ts +0 -19
- package/build/types-ts3.8/integrations/anr/common.d.ts +0 -52
- package/build/types-ts3.8/integrations/anr/index.d.ts +0 -13
- package/build/types-ts3.8/integrations/anr/worker.d.ts +0 -2
- package/build/types-ts3.8/integrations/childProcess.d.ts +0 -20
- package/build/types-ts3.8/integrations/context.d.ts +0 -30
- package/build/types-ts3.8/integrations/contextlines.d.ts +0 -31
- package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +0 -133
- package/build/types-ts3.8/integrations/local-variables/common.d.ts +0 -66
- package/build/types-ts3.8/integrations/local-variables/index.d.ts +0 -4
- package/build/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -7
- package/build/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +0 -34
- package/build/types-ts3.8/integrations/local-variables/worker.d.ts +0 -2
- package/build/types-ts3.8/integrations/modules.d.ts +0 -17
- package/build/types-ts3.8/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
- package/build/types-ts3.8/integrations/onuncaughtexception.d.ts +0 -31
- package/build/types-ts3.8/integrations/onunhandledrejection.d.ts +0 -23
- package/build/types-ts3.8/integrations/processSession.d.ts +0 -5
- package/build/types-ts3.8/integrations/spotlight.d.ts +0 -18
- package/build/types-ts3.8/integrations/winston.d.ts +0 -44
- package/build/types-ts3.8/logs/capture.d.ts +0 -18
- package/build/types-ts3.8/logs/exports.d.ts +0 -150
- package/build/types-ts3.8/nodeVersion.d.ts +0 -8
- package/build/types-ts3.8/otel/contextManager.d.ts +0 -10
- package/build/types-ts3.8/otel/instrument.d.ts +0 -23
- package/build/types-ts3.8/proxy/base.d.ts +0 -60
- package/build/types-ts3.8/proxy/helpers.d.ts +0 -38
- package/build/types-ts3.8/proxy/index.d.ts +0 -74
- package/build/types-ts3.8/proxy/parse-proxy-response.d.ts +0 -40
- package/build/types-ts3.8/sdk/api.d.ts +0 -8
- package/build/types-ts3.8/sdk/client.d.ts +0 -32
- package/build/types-ts3.8/sdk/scope.d.ts +0 -7
- package/build/types-ts3.8/transports/http-module.d.ts +0 -28
- package/build/types-ts3.8/transports/http.d.ts +0 -20
- package/build/types-ts3.8/transports/index.d.ts +0 -3
- package/build/types-ts3.8/utils/addOriginToSpan.d.ts +0 -5
- package/build/types-ts3.8/utils/baggage.d.ts +0 -6
- package/build/types-ts3.8/utils/commonjs.d.ts +0 -3
- package/build/types-ts3.8/utils/createMissingInstrumentationContext.d.ts +0 -3
- package/build/types-ts3.8/utils/debug.d.ts +0 -5
- package/build/types-ts3.8/utils/ensureIsWrapped.d.ts +0 -5
- package/build/types-ts3.8/utils/entry-point.d.ts +0 -24
- package/build/types-ts3.8/utils/envToBool.d.ts +0 -13
- package/build/types-ts3.8/utils/errorhandling.d.ts +0 -5
- package/build/types-ts3.8/utils/getRequestUrl.d.ts +0 -5
- package/build/types-ts3.8/utils/module.d.ts +0 -3
- package/build/types-ts3.8/utils/prepareEvent.d.ts +0 -17
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, getClient, captureException, logger } from '@sentry/core';
|
|
2
|
-
import { DEBUG_BUILD } from '../debug-build.js';
|
|
3
|
-
import { logAndExitProcess } from '../utils/errorhandling.js';
|
|
4
|
-
|
|
5
|
-
const INTEGRATION_NAME = 'OnUncaughtException';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Add a global exception handler.
|
|
9
|
-
*/
|
|
10
|
-
const onUncaughtExceptionIntegration = defineIntegration((options = {}) => {
|
|
11
|
-
const optionsWithDefaults = {
|
|
12
|
-
exitEvenIfOtherHandlersAreRegistered: false,
|
|
13
|
-
...options,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
name: INTEGRATION_NAME,
|
|
18
|
-
setup(client) {
|
|
19
|
-
global.process.on('uncaughtException', makeErrorHandler(client, optionsWithDefaults));
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
/** Exported only for tests */
|
|
25
|
-
function makeErrorHandler(client, options) {
|
|
26
|
-
const timeout = 2000;
|
|
27
|
-
let caughtFirstError = false;
|
|
28
|
-
let caughtSecondError = false;
|
|
29
|
-
let calledFatalError = false;
|
|
30
|
-
let firstError;
|
|
31
|
-
|
|
32
|
-
const clientOptions = client.getOptions();
|
|
33
|
-
|
|
34
|
-
return Object.assign(
|
|
35
|
-
(error) => {
|
|
36
|
-
let onFatalError = logAndExitProcess;
|
|
37
|
-
|
|
38
|
-
if (options.onFatalError) {
|
|
39
|
-
onFatalError = options.onFatalError;
|
|
40
|
-
} else if (clientOptions.onFatalError) {
|
|
41
|
-
onFatalError = clientOptions.onFatalError ;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Attaching a listener to `uncaughtException` will prevent the node process from exiting. We generally do not
|
|
45
|
-
// want to alter this behaviour so we check for other listeners that users may have attached themselves and adjust
|
|
46
|
-
// exit behaviour of the SDK accordingly:
|
|
47
|
-
// - If other listeners are attached, do not exit.
|
|
48
|
-
// - If the only listener attached is ours, exit.
|
|
49
|
-
const userProvidedListenersCount = (global.process.listeners('uncaughtException') ).filter(
|
|
50
|
-
listener => {
|
|
51
|
-
// There are 3 listeners we ignore:
|
|
52
|
-
return (
|
|
53
|
-
// as soon as we're using domains this listener is attached by node itself
|
|
54
|
-
listener.name !== 'domainUncaughtExceptionClear' &&
|
|
55
|
-
// the handler we register for tracing
|
|
56
|
-
listener.tag !== 'sentry_tracingErrorCallback' &&
|
|
57
|
-
// the handler we register in this integration
|
|
58
|
-
(listener )._errorHandler !== true
|
|
59
|
-
);
|
|
60
|
-
},
|
|
61
|
-
).length;
|
|
62
|
-
|
|
63
|
-
const processWouldExit = userProvidedListenersCount === 0;
|
|
64
|
-
const shouldApplyFatalHandlingLogic = options.exitEvenIfOtherHandlersAreRegistered || processWouldExit;
|
|
65
|
-
|
|
66
|
-
if (!caughtFirstError) {
|
|
67
|
-
// this is the first uncaught error and the ultimate reason for shutting down
|
|
68
|
-
// we want to do absolutely everything possible to ensure it gets captured
|
|
69
|
-
// also we want to make sure we don't go recursion crazy if more errors happen after this one
|
|
70
|
-
firstError = error;
|
|
71
|
-
caughtFirstError = true;
|
|
72
|
-
|
|
73
|
-
if (getClient() === client) {
|
|
74
|
-
captureException(error, {
|
|
75
|
-
originalException: error,
|
|
76
|
-
captureContext: {
|
|
77
|
-
level: 'fatal',
|
|
78
|
-
},
|
|
79
|
-
mechanism: {
|
|
80
|
-
handled: false,
|
|
81
|
-
type: 'onuncaughtexception',
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!calledFatalError && shouldApplyFatalHandlingLogic) {
|
|
87
|
-
calledFatalError = true;
|
|
88
|
-
onFatalError(error);
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
if (shouldApplyFatalHandlingLogic) {
|
|
92
|
-
if (calledFatalError) {
|
|
93
|
-
// we hit an error *after* calling onFatalError - pretty boned at this point, just shut it down
|
|
94
|
-
DEBUG_BUILD &&
|
|
95
|
-
logger.warn(
|
|
96
|
-
'uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown',
|
|
97
|
-
);
|
|
98
|
-
logAndExitProcess(error);
|
|
99
|
-
} else if (!caughtSecondError) {
|
|
100
|
-
// two cases for how we can hit this branch:
|
|
101
|
-
// - capturing of first error blew up and we just caught the exception from that
|
|
102
|
-
// - quit trying to capture, proceed with shutdown
|
|
103
|
-
// - a second independent error happened while waiting for first error to capture
|
|
104
|
-
// - want to avoid causing premature shutdown before first error capture finishes
|
|
105
|
-
// it's hard to immediately tell case 1 from case 2 without doing some fancy/questionable domain stuff
|
|
106
|
-
// so let's instead just delay a bit before we proceed with our action here
|
|
107
|
-
// in case 1, we just wait a bit unnecessarily but ultimately do the same thing
|
|
108
|
-
// in case 2, the delay hopefully made us wait long enough for the capture to finish
|
|
109
|
-
// two potential nonideal outcomes:
|
|
110
|
-
// nonideal case 1: capturing fails fast, we sit around for a few seconds unnecessarily before proceeding correctly by calling onFatalError
|
|
111
|
-
// nonideal case 2: case 2 happens, 1st error is captured but slowly, timeout completes before capture and we treat second error as the sendErr of (nonexistent) failure from trying to capture first error
|
|
112
|
-
// note that after hitting this branch, we might catch more errors where (caughtSecondError && !calledFatalError)
|
|
113
|
-
// we ignore them - they don't matter to us, we're just waiting for the second error timeout to finish
|
|
114
|
-
caughtSecondError = true;
|
|
115
|
-
setTimeout(() => {
|
|
116
|
-
if (!calledFatalError) {
|
|
117
|
-
// it was probably case 1, let's treat err as the sendErr and call onFatalError
|
|
118
|
-
calledFatalError = true;
|
|
119
|
-
onFatalError(firstError, error);
|
|
120
|
-
}
|
|
121
|
-
}, timeout); // capturing could take at least sendTimeout to fail, plus an arbitrary second for how long it takes to collect surrounding source etc
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{ _errorHandler: true },
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export { makeErrorHandler, onUncaughtExceptionIntegration };
|
|
131
|
-
//# sourceMappingURL=onuncaughtexception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onuncaughtexception.js","sources":["../../../src/integrations/onuncaughtexception.ts"],"sourcesContent":["import { captureException, defineIntegration, getClient, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { NodeClient } from '../sdk/client';\nimport { logAndExitProcess } from '../utils/errorhandling';\n\ntype OnFatalErrorHandler = (firstError: Error, secondError?: Error) => void;\n\ntype TaggedListener = NodeJS.UncaughtExceptionListener & {\n tag?: string;\n};\n\ninterface OnUncaughtExceptionOptions {\n /**\n * Controls if the SDK should register a handler to exit the process on uncaught errors:\n * - `true`: The SDK will exit the process on all uncaught errors.\n * - `false`: The SDK will only exit the process when there are no other `uncaughtException` handlers attached.\n *\n * Default: `false`\n */\n exitEvenIfOtherHandlersAreRegistered: boolean;\n\n /**\n * This is called when an uncaught error would cause the process to exit.\n *\n * @param firstError Uncaught error causing the process to exit\n * @param secondError Will be set if the handler was called multiple times. This can happen either because\n * `onFatalError` itself threw, or because an independent error happened somewhere else while `onFatalError`\n * was running.\n */\n onFatalError?(this: void, firstError: Error, secondError?: Error): void;\n}\n\nconst INTEGRATION_NAME = 'OnUncaughtException';\n\n/**\n * Add a global exception handler.\n */\nexport const onUncaughtExceptionIntegration = defineIntegration((options: Partial<OnUncaughtExceptionOptions> = {}) => {\n const optionsWithDefaults = {\n exitEvenIfOtherHandlersAreRegistered: false,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setup(client: NodeClient) {\n global.process.on('uncaughtException', makeErrorHandler(client, optionsWithDefaults));\n },\n };\n});\n\ntype ErrorHandler = { _errorHandler: boolean } & ((error: Error) => void);\n\n/** Exported only for tests */\nexport function makeErrorHandler(client: NodeClient, options: OnUncaughtExceptionOptions): ErrorHandler {\n const timeout = 2000;\n let caughtFirstError: boolean = false;\n let caughtSecondError: boolean = false;\n let calledFatalError: boolean = false;\n let firstError: Error;\n\n const clientOptions = client.getOptions();\n\n return Object.assign(\n (error: Error): void => {\n let onFatalError: OnFatalErrorHandler = logAndExitProcess;\n\n if (options.onFatalError) {\n onFatalError = options.onFatalError;\n } else if (clientOptions.onFatalError) {\n onFatalError = clientOptions.onFatalError as OnFatalErrorHandler;\n }\n\n // Attaching a listener to `uncaughtException` will prevent the node process from exiting. We generally do not\n // want to alter this behaviour so we check for other listeners that users may have attached themselves and adjust\n // exit behaviour of the SDK accordingly:\n // - If other listeners are attached, do not exit.\n // - If the only listener attached is ours, exit.\n const userProvidedListenersCount = (global.process.listeners('uncaughtException') as TaggedListener[]).filter(\n listener => {\n // There are 3 listeners we ignore:\n return (\n // as soon as we're using domains this listener is attached by node itself\n listener.name !== 'domainUncaughtExceptionClear' &&\n // the handler we register for tracing\n listener.tag !== 'sentry_tracingErrorCallback' &&\n // the handler we register in this integration\n (listener as ErrorHandler)._errorHandler !== true\n );\n },\n ).length;\n\n const processWouldExit = userProvidedListenersCount === 0;\n const shouldApplyFatalHandlingLogic = options.exitEvenIfOtherHandlersAreRegistered || processWouldExit;\n\n if (!caughtFirstError) {\n // this is the first uncaught error and the ultimate reason for shutting down\n // we want to do absolutely everything possible to ensure it gets captured\n // also we want to make sure we don't go recursion crazy if more errors happen after this one\n firstError = error;\n caughtFirstError = true;\n\n if (getClient() === client) {\n captureException(error, {\n originalException: error,\n captureContext: {\n level: 'fatal',\n },\n mechanism: {\n handled: false,\n type: 'onuncaughtexception',\n },\n });\n }\n\n if (!calledFatalError && shouldApplyFatalHandlingLogic) {\n calledFatalError = true;\n onFatalError(error);\n }\n } else {\n if (shouldApplyFatalHandlingLogic) {\n if (calledFatalError) {\n // we hit an error *after* calling onFatalError - pretty boned at this point, just shut it down\n DEBUG_BUILD &&\n logger.warn(\n 'uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown',\n );\n logAndExitProcess(error);\n } else if (!caughtSecondError) {\n // two cases for how we can hit this branch:\n // - capturing of first error blew up and we just caught the exception from that\n // - quit trying to capture, proceed with shutdown\n // - a second independent error happened while waiting for first error to capture\n // - want to avoid causing premature shutdown before first error capture finishes\n // it's hard to immediately tell case 1 from case 2 without doing some fancy/questionable domain stuff\n // so let's instead just delay a bit before we proceed with our action here\n // in case 1, we just wait a bit unnecessarily but ultimately do the same thing\n // in case 2, the delay hopefully made us wait long enough for the capture to finish\n // two potential nonideal outcomes:\n // nonideal case 1: capturing fails fast, we sit around for a few seconds unnecessarily before proceeding correctly by calling onFatalError\n // nonideal case 2: case 2 happens, 1st error is captured but slowly, timeout completes before capture and we treat second error as the sendErr of (nonexistent) failure from trying to capture first error\n // note that after hitting this branch, we might catch more errors where (caughtSecondError && !calledFatalError)\n // we ignore them - they don't matter to us, we're just waiting for the second error timeout to finish\n caughtSecondError = true;\n setTimeout(() => {\n if (!calledFatalError) {\n // it was probably case 1, let's treat err as the sendErr and call onFatalError\n calledFatalError = true;\n onFatalError(firstError, error);\n } else {\n // it was probably case 2, our first error finished capturing while we waited, cool, do nothing\n }\n }, timeout); // capturing could take at least sendTimeout to fail, plus an arbitrary second for how long it takes to collect surrounding source etc\n }\n }\n }\n },\n { _errorHandler: true },\n );\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, getClient, captureException, consoleSandbox } from '@sentry/core';
|
|
2
|
-
import { logAndExitProcess } from '../utils/errorhandling.js';
|
|
3
|
-
|
|
4
|
-
const INTEGRATION_NAME = 'OnUnhandledRejection';
|
|
5
|
-
|
|
6
|
-
const _onUnhandledRejectionIntegration = ((options = {}) => {
|
|
7
|
-
const opts = {
|
|
8
|
-
mode: 'warn',
|
|
9
|
-
...options,
|
|
10
|
-
} ;
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
name: INTEGRATION_NAME,
|
|
14
|
-
setup(client) {
|
|
15
|
-
global.process.on('unhandledRejection', makeUnhandledPromiseHandler(client, opts));
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}) ;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Add a global promise rejection handler.
|
|
22
|
-
*/
|
|
23
|
-
const onUnhandledRejectionIntegration = defineIntegration(_onUnhandledRejectionIntegration);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Send an exception with reason
|
|
27
|
-
* @param reason string
|
|
28
|
-
* @param promise promise
|
|
29
|
-
*
|
|
30
|
-
* Exported only for tests.
|
|
31
|
-
*/
|
|
32
|
-
function makeUnhandledPromiseHandler(
|
|
33
|
-
client,
|
|
34
|
-
options,
|
|
35
|
-
) {
|
|
36
|
-
return function sendUnhandledPromise(reason, promise) {
|
|
37
|
-
if (getClient() !== client) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const level = options.mode === 'strict' ? 'fatal' : 'error';
|
|
42
|
-
|
|
43
|
-
captureException(reason, {
|
|
44
|
-
originalException: promise,
|
|
45
|
-
captureContext: {
|
|
46
|
-
extra: { unhandledPromiseRejection: true },
|
|
47
|
-
level,
|
|
48
|
-
},
|
|
49
|
-
mechanism: {
|
|
50
|
-
handled: false,
|
|
51
|
-
type: 'onunhandledrejection',
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
handleRejection(reason, options.mode);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Handler for `mode` option
|
|
61
|
-
*/
|
|
62
|
-
function handleRejection(reason, mode) {
|
|
63
|
-
// https://github.com/nodejs/node/blob/7cf6f9e964aa00772965391c23acda6d71972a9a/lib/internal/process/promises.js#L234-L240
|
|
64
|
-
const rejectionWarning =
|
|
65
|
-
'This error originated either by ' +
|
|
66
|
-
'throwing inside of an async function without a catch block, ' +
|
|
67
|
-
'or by rejecting a promise which was not handled with .catch().' +
|
|
68
|
-
' The promise rejected with the reason:';
|
|
69
|
-
|
|
70
|
-
/* eslint-disable no-console */
|
|
71
|
-
if (mode === 'warn') {
|
|
72
|
-
consoleSandbox(() => {
|
|
73
|
-
console.warn(rejectionWarning);
|
|
74
|
-
console.error(reason && typeof reason === 'object' && 'stack' in reason ? reason.stack : reason);
|
|
75
|
-
});
|
|
76
|
-
} else if (mode === 'strict') {
|
|
77
|
-
consoleSandbox(() => {
|
|
78
|
-
console.warn(rejectionWarning);
|
|
79
|
-
});
|
|
80
|
-
logAndExitProcess(reason);
|
|
81
|
-
}
|
|
82
|
-
/* eslint-enable no-console */
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { makeUnhandledPromiseHandler, onUnhandledRejectionIntegration };
|
|
86
|
-
//# sourceMappingURL=onunhandledrejection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onunhandledrejection.js","sources":["../../../src/integrations/onunhandledrejection.ts"],"sourcesContent":["import type { Client, IntegrationFn, SeverityLevel } from '@sentry/core';\nimport { captureException, consoleSandbox, defineIntegration, getClient } from '@sentry/core';\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 opts = {\n mode: 'warn',\n ...options,\n } satisfies OnUnhandledRejectionOptions;\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n global.process.on('unhandledRejection', makeUnhandledPromiseHandler(client, opts));\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 const level: SeverityLevel = options.mode === 'strict' ? 'fatal' : 'error';\n\n captureException(reason, {\n originalException: promise,\n captureContext: {\n extra: { unhandledPromiseRejection: true },\n level,\n },\n mechanism: {\n handled: false,\n type: 'onunhandledrejection',\n },\n });\n\n handleRejection(reason, options.mode);\n };\n}\n\n/**\n * Handler for `mode` option\n */\nfunction handleRejection(reason: unknown, mode: UnhandledRejectionMode): 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 (mode === 'warn') {\n consoleSandbox(() => {\n console.warn(rejectionWarning);\n console.error(reason && typeof reason === 'object' && 'stack' in reason ? reason.stack : reason);\n });\n } else if (mode === 'strict') {\n consoleSandbox(() => {\n console.warn(rejectionWarning);\n });\n logAndExitProcess(reason);\n }\n /* eslint-enable no-console */\n}\n"],"names":[],"mappings":";;;AAcA,MAAM,gBAAA,GAAmB,sBAAsB;;AAE/C,MAAM,gCAAA,IAAoC,CAAC,OAAO,GAAyC,EAAE,KAAK;AAClG,EAAE,MAAM,OAAO;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,GAAG,OAAO;AACd,GAAI;;AAEJ,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,2BAA2B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACxF,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;MACa,+BAAgC,GAAE,iBAAiB,CAAC,gCAAgC;;AAEjG;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,2BAA2B;AAC3C,EAAE,MAAM;AACR,EAAE,OAAO;AACT,EAA+C;AAC/C,EAAE,OAAO,SAAS,oBAAoB,CAAC,MAAM,EAAW,OAAO,EAAiB;AAChF,IAAI,IAAI,SAAS,EAAG,KAAI,MAAM,EAAE;AAChC,MAAM;AACN;;AAEA,IAAI,MAAM,KAAK,GAAkB,OAAO,CAAC,IAAK,KAAI,QAAS,GAAE,OAAQ,GAAE,OAAO;;AAE9E,IAAI,gBAAgB,CAAC,MAAM,EAAE;AAC7B,MAAM,iBAAiB,EAAE,OAAO;AAChC,MAAM,cAAc,EAAE;AACtB,QAAQ,KAAK,EAAE,EAAE,yBAAyB,EAAE,MAAM;AAClD,QAAQ,KAAK;AACb,OAAO;AACP,MAAM,SAAS,EAAE;AACjB,QAAQ,OAAO,EAAE,KAAK;AACtB,QAAQ,IAAI,EAAE,sBAAsB;AACpC,OAAO;AACP,KAAK,CAAC;;AAEN,IAAI,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;AACzC,GAAG;AACH;;AAEA;AACA;AACA;AACA,SAAS,eAAe,CAAC,MAAM,EAAW,IAAI,EAAgC;AAC9E;AACA,EAAE,MAAM,gBAAiB;AACzB,IAAI,kCAAmC;AACvC,IAAI,8DAA+D;AACnE,IAAI,gEAAiE;AACrE,IAAI,wCAAwC;;AAE5C;AACA,EAAE,IAAI,IAAK,KAAI,MAAM,EAAE;AACvB,IAAI,cAAc,CAAC,MAAM;AACzB,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;AACpC,MAAM,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,WAAW,QAAA,IAAY,OAAQ,IAAG,SAAS,MAAM,CAAC,KAAM,GAAE,MAAM,CAAC;AACtG,KAAK,CAAC;AACN,SAAS,IAAI,IAAK,KAAI,QAAQ,EAAE;AAChC,IAAI,cAAc,CAAC,MAAM;AACzB,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;AACpC,KAAK,CAAC;AACN,IAAI,iBAAiB,CAAC,MAAM,CAAC;AAC7B;AACA;AACA;;;;"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, startSession, getIsolationScope, endSession } from '@sentry/core';
|
|
2
|
-
|
|
3
|
-
const INTEGRATION_NAME = 'ProcessSession';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Records a Session for the current process to track release health.
|
|
7
|
-
*/
|
|
8
|
-
const processSessionIntegration = defineIntegration(() => {
|
|
9
|
-
return {
|
|
10
|
-
name: INTEGRATION_NAME,
|
|
11
|
-
setupOnce() {
|
|
12
|
-
startSession();
|
|
13
|
-
|
|
14
|
-
// Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because
|
|
15
|
-
// The 'beforeExit' event is not emitted for conditions causing explicit termination,
|
|
16
|
-
// such as calling process.exit() or uncaught exceptions.
|
|
17
|
-
// Ref: https://nodejs.org/api/process.html#process_event_beforeexit
|
|
18
|
-
process.on('beforeExit', () => {
|
|
19
|
-
const session = getIsolationScope().getSession();
|
|
20
|
-
|
|
21
|
-
// Only call endSession, if the Session exists on Scope and SessionStatus is not a
|
|
22
|
-
// Terminal Status i.e. Exited or Crashed because
|
|
23
|
-
// "When a session is moved away from ok it must not be updated anymore."
|
|
24
|
-
// Ref: https://develop.sentry.dev/sdk/sessions/
|
|
25
|
-
if (session?.status !== 'ok') {
|
|
26
|
-
endSession();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export { processSessionIntegration };
|
|
34
|
-
//# sourceMappingURL=processSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processSession.js","sources":["../../../src/integrations/processSession.ts"],"sourcesContent":["import { defineIntegration, endSession, getIsolationScope, startSession } from '@sentry/core';\n\nconst INTEGRATION_NAME = 'ProcessSession';\n\n/**\n * Records a Session for the current process to track release health.\n */\nexport const processSessionIntegration = defineIntegration(() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n startSession();\n\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // such as calling process.exit() or uncaught exceptions.\n // Ref: https://nodejs.org/api/process.html#process_event_beforeexit\n process.on('beforeExit', () => {\n const session = getIsolationScope().getSession();\n\n // Only call endSession, if the Session exists on Scope and SessionStatus is not a\n // Terminal Status i.e. Exited or Crashed because\n // \"When a session is moved away from ok it must not be updated anymore.\"\n // Ref: https://develop.sentry.dev/sdk/sessions/\n if (session?.status !== 'ok') {\n endSession();\n }\n });\n },\n };\n});\n"],"names":[],"mappings":";;AAEA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC;AACA;AACA;MACa,yBAA0B,GAAE,iBAAiB,CAAC,MAAM;AACjE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,YAAY,EAAE;;AAEpB;AACA;AACA;AACA;AACA,MAAM,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM;AACrC,QAAQ,MAAM,UAAU,iBAAiB,EAAE,CAAC,UAAU,EAAE;;AAExD;AACA;AACA;AACA;AACA,QAAQ,IAAI,OAAO,EAAE,MAAO,KAAI,IAAI,EAAE;AACtC,UAAU,UAAU,EAAE;AACtB;AACA,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import * as http from 'node:http';
|
|
2
|
-
import { defineIntegration, logger, serializeEnvelope, suppressTracing } from '@sentry/core';
|
|
3
|
-
|
|
4
|
-
const INTEGRATION_NAME = 'Spotlight';
|
|
5
|
-
|
|
6
|
-
const _spotlightIntegration = ((options = {}) => {
|
|
7
|
-
const _options = {
|
|
8
|
-
sidecarUrl: options.sidecarUrl || 'http://localhost:8969/stream',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
name: INTEGRATION_NAME,
|
|
13
|
-
setup(client) {
|
|
14
|
-
if (
|
|
15
|
-
typeof process === 'object' &&
|
|
16
|
-
process.env &&
|
|
17
|
-
process.env.NODE_ENV &&
|
|
18
|
-
process.env.NODE_ENV !== 'development'
|
|
19
|
-
) {
|
|
20
|
-
logger.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?");
|
|
21
|
-
}
|
|
22
|
-
connectToSpotlight(client, _options);
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
}) ;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Use this integration to send errors and transactions to Spotlight.
|
|
29
|
-
*
|
|
30
|
-
* Learn more about spotlight at https://spotlightjs.com
|
|
31
|
-
*
|
|
32
|
-
* Important: This integration only works with Node 18 or newer.
|
|
33
|
-
*/
|
|
34
|
-
const spotlightIntegration = defineIntegration(_spotlightIntegration);
|
|
35
|
-
|
|
36
|
-
function connectToSpotlight(client, options) {
|
|
37
|
-
const spotlightUrl = parseSidecarUrl(options.sidecarUrl);
|
|
38
|
-
if (!spotlightUrl) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let failedRequests = 0;
|
|
43
|
-
|
|
44
|
-
client.on('beforeEnvelope', (envelope) => {
|
|
45
|
-
if (failedRequests > 3) {
|
|
46
|
-
logger.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const serializedEnvelope = serializeEnvelope(envelope);
|
|
51
|
-
suppressTracing(() => {
|
|
52
|
-
const req = http.request(
|
|
53
|
-
{
|
|
54
|
-
method: 'POST',
|
|
55
|
-
path: spotlightUrl.pathname,
|
|
56
|
-
hostname: spotlightUrl.hostname,
|
|
57
|
-
port: spotlightUrl.port,
|
|
58
|
-
headers: {
|
|
59
|
-
'Content-Type': 'application/x-sentry-envelope',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
res => {
|
|
63
|
-
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {
|
|
64
|
-
// Reset failed requests counter on success
|
|
65
|
-
failedRequests = 0;
|
|
66
|
-
}
|
|
67
|
-
res.on('data', () => {
|
|
68
|
-
// Drain socket
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
res.on('end', () => {
|
|
72
|
-
// Drain socket
|
|
73
|
-
});
|
|
74
|
-
res.setEncoding('utf8');
|
|
75
|
-
},
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
req.on('error', () => {
|
|
79
|
-
failedRequests++;
|
|
80
|
-
logger.warn('[Spotlight] Failed to send envelope to Spotlight Sidecar');
|
|
81
|
-
});
|
|
82
|
-
req.write(serializedEnvelope);
|
|
83
|
-
req.end();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function parseSidecarUrl(url) {
|
|
89
|
-
try {
|
|
90
|
-
return new URL(`${url}`);
|
|
91
|
-
} catch {
|
|
92
|
-
logger.warn(`[Spotlight] Invalid sidecar URL: ${url}`);
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { INTEGRATION_NAME, spotlightIntegration };
|
|
98
|
-
//# sourceMappingURL=spotlight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","sources":["../../../src/integrations/spotlight.ts"],"sourcesContent":["import * as http from 'node:http';\nimport type { Client, Envelope, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, logger, serializeEnvelope, suppressTracing } from '@sentry/core';\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\nexport const 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 (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_ENV &&\n process.env.NODE_ENV !== 'development'\n ) {\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 suppressTracing(() => {\n const req = http.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 if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {\n // Reset failed requests counter on success\n failedRequests = 0;\n }\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}\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"],"names":[],"mappings":"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"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { captureLog } from '../logs/capture.js';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_CAPTURED_LEVELS = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];
|
|
4
|
-
|
|
5
|
-
// See: https://github.com/winstonjs/triple-beam
|
|
6
|
-
const LEVEL_SYMBOL = Symbol.for('level');
|
|
7
|
-
const MESSAGE_SYMBOL = Symbol.for('message');
|
|
8
|
-
const SPLAT_SYMBOL = Symbol.for('splat');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Options for the Sentry Winston transport.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new Sentry Winston transport that fowards logs to Sentry. Requires `_experiments.enableLogs` to be enabled.
|
|
16
|
-
*
|
|
17
|
-
* Supports Winston 3.x.x.
|
|
18
|
-
*
|
|
19
|
-
* @param TransportClass - The Winston transport class to extend.
|
|
20
|
-
* @returns The extended transport class.
|
|
21
|
-
*
|
|
22
|
-
* @experimental This method will experience breaking changes. This is not yet part of
|
|
23
|
-
* the stable Sentry SDK API and can be changed or removed without warning.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const winston = require('winston');
|
|
28
|
-
* const Transport = require('winston-transport');
|
|
29
|
-
*
|
|
30
|
-
* const SentryWinstonTransport = Sentry.createSentryWinstonTransport(Transport);
|
|
31
|
-
*
|
|
32
|
-
* const logger = winston.createLogger({
|
|
33
|
-
* transports: [new SentryWinstonTransport()],
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
function createSentryWinstonTransport(
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
TransportClass,
|
|
40
|
-
sentryWinstonOptions,
|
|
41
|
-
) {
|
|
42
|
-
// @ts-ignore - We know this is safe because SentryWinstonTransport extends TransportClass
|
|
43
|
-
class SentryWinstonTransport extends TransportClass {
|
|
44
|
-
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
constructor(options) {
|
|
47
|
-
super(options);
|
|
48
|
-
this._levels = new Set(sentryWinstonOptions?.levels ?? DEFAULT_CAPTURED_LEVELS);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Forwards a winston log to the Sentry SDK.
|
|
53
|
-
*/
|
|
54
|
-
log(info, callback) {
|
|
55
|
-
try {
|
|
56
|
-
setImmediate(() => {
|
|
57
|
-
// @ts-ignore - We know this is safe because SentryWinstonTransport extends TransportClass
|
|
58
|
-
this.emit('logged', info);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (!isObject(info)) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const levelFromSymbol = info[LEVEL_SYMBOL];
|
|
66
|
-
|
|
67
|
-
// See: https://github.com/winstonjs/winston?tab=readme-ov-file#streams-objectmode-and-info-objects
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
-
const { level, message, timestamp, ...attributes } = info;
|
|
70
|
-
// Remove all symbols from the remaining attributes
|
|
71
|
-
attributes[LEVEL_SYMBOL] = undefined;
|
|
72
|
-
attributes[MESSAGE_SYMBOL] = undefined;
|
|
73
|
-
attributes[SPLAT_SYMBOL] = undefined;
|
|
74
|
-
|
|
75
|
-
const logSeverityLevel = WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP[levelFromSymbol ] ?? 'info';
|
|
76
|
-
if (this._levels.has(logSeverityLevel)) {
|
|
77
|
-
captureLog(logSeverityLevel, message , {
|
|
78
|
-
...attributes,
|
|
79
|
-
'sentry.origin': 'auto.logging.winston',
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
} catch {
|
|
83
|
-
// do nothing
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (callback) {
|
|
87
|
-
callback();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return SentryWinstonTransport ;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function isObject(anything) {
|
|
96
|
-
return typeof anything === 'object' && anything != null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// npm
|
|
100
|
-
// {
|
|
101
|
-
// error: 0,
|
|
102
|
-
// warn: 1,
|
|
103
|
-
// info: 2,
|
|
104
|
-
// http: 3,
|
|
105
|
-
// verbose: 4,
|
|
106
|
-
// debug: 5,
|
|
107
|
-
// silly: 6
|
|
108
|
-
// }
|
|
109
|
-
//
|
|
110
|
-
// syslog
|
|
111
|
-
// {
|
|
112
|
-
// emerg: 0,
|
|
113
|
-
// alert: 1,
|
|
114
|
-
// crit: 2,
|
|
115
|
-
// error: 3,
|
|
116
|
-
// warning: 4,
|
|
117
|
-
// notice: 5,
|
|
118
|
-
// info: 6,
|
|
119
|
-
// debug: 7,
|
|
120
|
-
// }
|
|
121
|
-
const WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP = {
|
|
122
|
-
// npm
|
|
123
|
-
silly: 'trace',
|
|
124
|
-
// npm and syslog
|
|
125
|
-
debug: 'debug',
|
|
126
|
-
// npm
|
|
127
|
-
verbose: 'debug',
|
|
128
|
-
// npm
|
|
129
|
-
http: 'debug',
|
|
130
|
-
// npm and syslog
|
|
131
|
-
info: 'info',
|
|
132
|
-
// syslog
|
|
133
|
-
notice: 'info',
|
|
134
|
-
// npm
|
|
135
|
-
warn: 'warn',
|
|
136
|
-
// syslog
|
|
137
|
-
warning: 'warn',
|
|
138
|
-
// npm and syslog
|
|
139
|
-
error: 'error',
|
|
140
|
-
// syslog
|
|
141
|
-
emerg: 'fatal',
|
|
142
|
-
// syslog
|
|
143
|
-
alert: 'fatal',
|
|
144
|
-
// syslog
|
|
145
|
-
crit: 'fatal',
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export { createSentryWinstonTransport };
|
|
149
|
-
//# sourceMappingURL=winston.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"winston.js","sources":["../../../src/integrations/winston.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport type { LogSeverityLevel } from '@sentry/core';\nimport { captureLog } from '../logs/capture';\n\nconst DEFAULT_CAPTURED_LEVELS: Array<LogSeverityLevel> = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];\n\n// See: https://github.com/winstonjs/triple-beam\nconst LEVEL_SYMBOL = Symbol.for('level');\nconst MESSAGE_SYMBOL = Symbol.for('message');\nconst SPLAT_SYMBOL = Symbol.for('splat');\n\n/**\n * Options for the Sentry Winston transport.\n */\ninterface WinstonTransportOptions {\n /**\n * Use this option to filter which levels should be captured. By default, all levels are captured.\n *\n * @example\n * ```ts\n * const SentryWinstonTransport = Sentry.createSentryWinstonTransport(Transport, {\n * // Only capture error and warn logs\n * levels: ['error', 'warn'],\n * });\n * ```\n */\n levels?: Array<LogSeverityLevel>;\n}\n\n/**\n * Creates a new Sentry Winston transport that fowards logs to Sentry. Requires `_experiments.enableLogs` to be enabled.\n *\n * Supports Winston 3.x.x.\n *\n * @param TransportClass - The Winston transport class to extend.\n * @returns The extended transport class.\n *\n * @experimental This method will experience breaking changes. This is not yet part of\n * the stable Sentry SDK API and can be changed or removed without warning.\n *\n * @example\n * ```ts\n * const winston = require('winston');\n * const Transport = require('winston-transport');\n *\n * const SentryWinstonTransport = Sentry.createSentryWinstonTransport(Transport);\n *\n * const logger = winston.createLogger({\n * transports: [new SentryWinstonTransport()],\n * });\n * ```\n */\nexport function createSentryWinstonTransport<TransportStreamInstance extends object>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TransportClass: new (options?: any) => TransportStreamInstance,\n sentryWinstonOptions?: WinstonTransportOptions,\n): typeof TransportClass {\n // @ts-ignore - We know this is safe because SentryWinstonTransport extends TransportClass\n class SentryWinstonTransport extends TransportClass {\n private _levels: Set<LogSeverityLevel>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(options?: any) {\n super(options);\n this._levels = new Set(sentryWinstonOptions?.levels ?? DEFAULT_CAPTURED_LEVELS);\n }\n\n /**\n * Forwards a winston log to the Sentry SDK.\n */\n public log(info: unknown, callback: () => void): void {\n try {\n setImmediate(() => {\n // @ts-ignore - We know this is safe because SentryWinstonTransport extends TransportClass\n this.emit('logged', info);\n });\n\n if (!isObject(info)) {\n return;\n }\n\n const levelFromSymbol = info[LEVEL_SYMBOL];\n\n // See: https://github.com/winstonjs/winston?tab=readme-ov-file#streams-objectmode-and-info-objects\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { level, message, timestamp, ...attributes } = info;\n // Remove all symbols from the remaining attributes\n attributes[LEVEL_SYMBOL] = undefined;\n attributes[MESSAGE_SYMBOL] = undefined;\n attributes[SPLAT_SYMBOL] = undefined;\n\n const logSeverityLevel = WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP[levelFromSymbol as string] ?? 'info';\n if (this._levels.has(logSeverityLevel)) {\n captureLog(logSeverityLevel, message as string, {\n ...attributes,\n 'sentry.origin': 'auto.logging.winston',\n });\n }\n } catch {\n // do nothing\n }\n\n if (callback) {\n callback();\n }\n }\n }\n\n return SentryWinstonTransport as typeof TransportClass;\n}\n\nfunction isObject(anything: unknown): anything is Record<string | symbol, unknown> {\n return typeof anything === 'object' && anything != null;\n}\n\n// npm\n// {\n// error: 0,\n// warn: 1,\n// info: 2,\n// http: 3,\n// verbose: 4,\n// debug: 5,\n// silly: 6\n// }\n//\n// syslog\n// {\n// emerg: 0,\n// alert: 1,\n// crit: 2,\n// error: 3,\n// warning: 4,\n// notice: 5,\n// info: 6,\n// debug: 7,\n// }\nconst WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP: Record<string, LogSeverityLevel> = {\n // npm\n silly: 'trace',\n // npm and syslog\n debug: 'debug',\n // npm\n verbose: 'debug',\n // npm\n http: 'debug',\n // npm and syslog\n info: 'info',\n // syslog\n notice: 'info',\n // npm\n warn: 'warn',\n // syslog\n warning: 'warn',\n // npm and syslog\n error: 'error',\n // syslog\n emerg: 'fatal',\n // syslog\n alert: 'fatal',\n // syslog\n crit: 'fatal',\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { format } from 'node:util';
|
|
2
|
-
import { _INTERNAL_captureLog } from '@sentry/core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Capture a log with the given level.
|
|
6
|
-
*
|
|
7
|
-
* @param level - The level of the log.
|
|
8
|
-
* @param message - The message to log.
|
|
9
|
-
* @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.
|
|
10
|
-
*/
|
|
11
|
-
function captureLog(level, ...args) {
|
|
12
|
-
const [messageOrMessageTemplate, paramsOrAttributes, maybeAttributes] = args;
|
|
13
|
-
if (Array.isArray(paramsOrAttributes)) {
|
|
14
|
-
const attributes = { ...maybeAttributes };
|
|
15
|
-
attributes['sentry.message.template'] = messageOrMessageTemplate;
|
|
16
|
-
paramsOrAttributes.forEach((param, index) => {
|
|
17
|
-
attributes[`sentry.message.parameter.${index}`] = param;
|
|
18
|
-
});
|
|
19
|
-
const message = format(messageOrMessageTemplate, ...paramsOrAttributes);
|
|
20
|
-
_INTERNAL_captureLog({ level, message, attributes });
|
|
21
|
-
} else {
|
|
22
|
-
_INTERNAL_captureLog({ level, message: messageOrMessageTemplate, attributes: paramsOrAttributes });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { captureLog };
|
|
27
|
-
//# sourceMappingURL=capture.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capture.js","sources":["../../../src/logs/capture.ts"],"sourcesContent":["import { format } from 'node:util';\nimport type { Log, LogSeverityLevel, ParameterizedString } from '@sentry/core';\nimport { _INTERNAL_captureLog } from '@sentry/core';\n\nexport type CaptureLogArgs =\n | [message: ParameterizedString, attributes?: Log['attributes']]\n | [messageTemplate: string, messageParams: Array<unknown>, attributes?: Log['attributes']];\n\n/**\n * Capture a log with the given level.\n *\n * @param level - The level of the log.\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.\n */\nexport function captureLog(level: LogSeverityLevel, ...args: CaptureLogArgs): void {\n const [messageOrMessageTemplate, paramsOrAttributes, maybeAttributes] = args;\n if (Array.isArray(paramsOrAttributes)) {\n const attributes = { ...maybeAttributes };\n attributes['sentry.message.template'] = messageOrMessageTemplate;\n paramsOrAttributes.forEach((param, index) => {\n attributes[`sentry.message.parameter.${index}`] = param;\n });\n const message = format(messageOrMessageTemplate, ...paramsOrAttributes);\n _INTERNAL_captureLog({ level, message, attributes });\n } else {\n _INTERNAL_captureLog({ level, message: messageOrMessageTemplate, attributes: paramsOrAttributes });\n }\n}\n"],"names":[],"mappings":";;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAoB,GAAG,IAAI,EAAwB;AACnF,EAAE,MAAM,CAAC,wBAAwB,EAAE,kBAAkB,EAAE,eAAe,CAAE,GAAE,IAAI;AAC9E,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;AACzC,IAAI,MAAM,UAAW,GAAE,EAAE,GAAG,iBAAiB;AAC7C,IAAI,UAAU,CAAC,yBAAyB,CAAA,GAAI,wBAAwB;AACpE,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK;AACjD,MAAM,UAAU,CAAC,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAA,CAAA,GAAA,KAAA;AACA,KAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAA,MAAA,CAAA,wBAAA,EAAA,GAAA,kBAAA,CAAA;AACA,IAAA,oBAAA,CAAA,EAAA,KAAA,EAAA,OAAA,EAAA,UAAA,EAAA,CAAA;AACA,GAAA,MAAA;AACA,IAAA,oBAAA,CAAA,EAAA,KAAA,EAAA,OAAA,EAAA,wBAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,CAAA;AACA;AACA;;;;"}
|