@sentry/node 10.62.0 → 10.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +15 -14
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/cjs/integrations/fs/index.js.map +1 -1
- package/build/cjs/integrations/http.js.map +1 -1
- package/build/cjs/integrations/node-fetch.js +24 -0
- package/build/cjs/integrations/node-fetch.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js +0 -6
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js +11 -10
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +2 -2
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/index.js.map +1 -1
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +7 -103
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +4 -5
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +9 -9
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js +8 -9
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/index.js +7 -7
- package/build/cjs/integrations/tracing/hono/index.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +0 -1
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js +2 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js +12 -11
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +11 -10
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js +0 -16
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +2 -2
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/utils.js +2 -2
- package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/index.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js +4 -2
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js +12 -11
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/index.js +3 -2
- package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +11 -8
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +9 -9
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js +36 -129
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js +0 -14
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js +2 -27
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +7 -4
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +7 -4
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js +12 -11
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js +8 -7
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/index.js +48 -62
- package/build/cjs/integrations/tracing/prisma/index.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/global.js +2 -2
- package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/cache.js +41 -0
- package/build/cjs/integrations/tracing/redis/cache.js.map +1 -0
- package/build/cjs/integrations/tracing/redis/index.js +16 -38
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +22 -13
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +21 -15
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -8
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +9 -8
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/index.js +2 -4
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -1
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +18 -6
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
- package/build/cjs/sdk/index.js +2 -2
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/cjs/sdk/initOtel.js +36 -0
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/esm/integrations/fs/index.js.map +1 -1
- package/build/esm/integrations/http.js.map +1 -1
- package/build/esm/integrations/node-fetch.js +22 -0
- package/build/esm/integrations/node-fetch.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/index.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js +1 -4
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js +7 -6
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/connect/index.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +2 -2
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/index.js.map +1 -1
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js +8 -103
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +5 -6
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +7 -7
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/utils.js +3 -4
- package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/hono/index.js +3 -3
- package/build/esm/integrations/tracing/hono/index.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +1 -2
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js +3 -2
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/utils.js +11 -10
- package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/knex/index.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +10 -9
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js +1 -9
- package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/koa/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +2 -2
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/utils.js +2 -2
- package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/index.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js +5 -3
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/utils.js +9 -8
- package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/index.js +4 -3
- package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +9 -6
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js +10 -10
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js +38 -131
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js +1 -8
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/utils.js +3 -25
- package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +6 -3
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js +8 -5
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/utils.js +13 -12
- package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/postgresjs.js +7 -6
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/index.js +49 -63
- package/build/esm/integrations/tracing/prisma/index.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/global.js +2 -2
- package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/cache.js +38 -0
- package/build/esm/integrations/tracing/redis/cache.js.map +1 -0
- package/build/esm/integrations/tracing/redis/index.js +12 -37
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +19 -10
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +16 -10
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -5
- package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +8 -7
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js +3 -5
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -1
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +19 -8
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
- package/build/esm/sdk/index.js +1 -1
- package/build/esm/sdk/initOtel.js +38 -2
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/openFeature.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/statsig.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/unleash.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -1
- package/build/types/integrations/fs/index.d.ts +3 -1
- package/build/types/integrations/fs/index.d.ts.map +1 -1
- package/build/types/integrations/http.d.ts +3 -1
- package/build/types/integrations/http.d.ts.map +1 -1
- package/build/types/integrations/node-fetch.d.ts +9 -0
- package/build/types/integrations/node-fetch.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/index.d.ts +3 -1
- package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts +0 -6
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts +3 -1
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/index.d.ts +3 -1
- package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/index.d.ts +3 -1
- package/build/types/integrations/tracing/dataloader/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/express.d.ts +3 -1
- package/build/types/integrations/tracing/express.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/index.d.ts +6 -6
- package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/firebase.d.ts +3 -1
- package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/index.d.ts +3 -1
- package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/google-genai/index.d.ts +3 -1
- package/build/types/integrations/tracing/google-genai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/index.d.ts +3 -1
- package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/index.d.ts +3 -1
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/hono/index.d.ts +3 -1
- package/build/types/integrations/tracing/hono/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/index.d.ts +3 -1
- package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts +5 -63
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/index.d.ts +3 -1
- package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +0 -32
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/index.d.ts +3 -1
- package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langchain/index.d.ts +3 -1
- package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts +3 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/index.d.ts +3 -1
- package/build/types/integrations/tracing/lrumemoizer/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/index.d.ts +3 -1
- package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts +1 -37
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/index.d.ts +3 -1
- package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -48
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/index.d.ts +3 -1
- package/build/types/integrations/tracing/mysql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts +1 -70
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts +3 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts +0 -6
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/openai/index.d.ts +3 -1
- package/build/types/integrations/tracing/openai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/index.d.ts +3 -1
- package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +1 -50
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgresjs.d.ts +3 -1
- package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/index.d.ts +5 -21
- package/build/types/integrations/tracing/prisma/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts +5 -23
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/cache.d.ts +22 -0
- package/build/types/integrations/tracing/redis/cache.d.ts.map +1 -0
- package/build/types/integrations/tracing/redis/index.d.ts +6 -22
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts +0 -4
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/index.d.ts +3 -1
- package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts +1 -62
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/constants.d.ts +1 -1
- package/build/types/integrations/tracing/vercelai/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/index.d.ts +3 -1
- package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -1
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +2 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -1
- package/build/types/sdk/initOtel.d.ts +2 -3
- package/build/types/sdk/initOtel.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -1
- package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
- package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +3 -1
- package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +3 -1
- package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +3 -1
- package/build/types-ts3.8/integrations/fs/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/http.d.ts +3 -1
- package/build/types-ts3.8/integrations/node-fetch.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv.d.ts +0 -6
- package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/connect/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/dataloader/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/express.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +6 -6
- package/build/types-ts3.8/integrations/tracing/firebase/firebase.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/genericPool/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/google-genai/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/graphql/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/hapi/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/kafka/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/semconv.d.ts +5 -63
- package/build/types-ts3.8/integrations/tracing/knex/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +0 -32
- package/build/types-ts3.8/integrations/tracing/koa/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/lrumemoizer/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +1 -37
- package/build/types-ts3.8/integrations/tracing/mongoose/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -48
- package/build/types-ts3.8/integrations/tracing/mysql/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/semconv.d.ts +1 -70
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
- package/build/types-ts3.8/integrations/tracing/mysql2/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/semconv.d.ts +0 -6
- package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/postgres/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +1 -50
- package/build/types-ts3.8/integrations/tracing/postgresjs.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/prisma/index.d.ts +5 -21
- package/build/types-ts3.8/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
- package/build/types-ts3.8/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
- package/build/types-ts3.8/integrations/tracing/prisma/vendored/types.d.ts +5 -23
- package/build/types-ts3.8/integrations/tracing/redis/cache.d.ts +22 -0
- package/build/types-ts3.8/integrations/tracing/redis/index.d.ts +6 -22
- package/build/types-ts3.8/integrations/tracing/redis/vendored/semconv.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/tedious/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/semconv.d.ts +1 -62
- package/build/types-ts3.8/integrations/tracing/vercelai/constants.d.ts +1 -1
- package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +3 -1
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +1 -1
- package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +2 -0
- package/build/types-ts3.8/sdk/initOtel.d.ts +3 -4
- package/package.json +8 -8
- package/build/cjs/integrations/node-fetch/index.js +0 -80
- package/build/cjs/integrations/node-fetch/index.js.map +0 -1
- package/build/cjs/integrations/node-fetch/vendored/semconv.js +0 -28
- package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +0 -1
- package/build/cjs/integrations/node-fetch/vendored/undici.js +0 -302
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +0 -1
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js +0 -387
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
- package/build/cjs/integrations/tracing/hapi/vendored/semconv.js +0 -6
- package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +0 -1
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js +0 -9
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-common.js +0 -34
- package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +0 -1
- package/build/esm/integrations/node-fetch/index.js +0 -77
- package/build/esm/integrations/node-fetch/index.js.map +0 -1
- package/build/esm/integrations/node-fetch/vendored/semconv.js +0 -15
- package/build/esm/integrations/node-fetch/vendored/semconv.js.map +0 -1
- package/build/esm/integrations/node-fetch/vendored/undici.js +0 -300
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +0 -1
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js +0 -385
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
- package/build/esm/integrations/tracing/hapi/vendored/semconv.js +0 -4
- package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +0 -1
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js +0 -7
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-common.js +0 -32
- package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +0 -1
- package/build/types/integrations/node-fetch/index.d.ts +0 -36
- package/build/types/integrations/node-fetch/index.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts +0 -13
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/types.d.ts +0 -60
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts +0 -21
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +0 -1
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +0 -1
- package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts +0 -13
- package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts +0 -9
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts +0 -6
- package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/node-fetch/index.d.ts +0 -36
- package/build/types-ts3.8/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
- package/build/types-ts3.8/integrations/node-fetch/vendored/semconv.d.ts +0 -13
- package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +0 -60
- package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +0 -21
- package/build/types-ts3.8/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/semconv.d.ts +0 -13
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/types.d.ts +0 -9
- package/build/types-ts3.8/integrations/tracing/redis/vendored/redis-common.d.ts +0 -6
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const api = require('@opentelemetry/api');
|
|
4
3
|
const instrumentation = require('@opentelemetry/instrumentation');
|
|
5
|
-
const global = require('./global.js');
|
|
6
4
|
const activeTracingHelper = require('./active-tracing-helper.js');
|
|
7
5
|
const constants = require('./constants.js');
|
|
6
|
+
const global = require('./global.js');
|
|
8
7
|
|
|
9
8
|
class PrismaInstrumentation extends instrumentation.InstrumentationBase {
|
|
10
9
|
constructor(config = {}) {
|
|
11
10
|
super(constants.NAME, constants.VERSION, config);
|
|
12
11
|
}
|
|
13
|
-
setTracerProvider(tracerProvider) {
|
|
14
|
-
this.tracerProvider = tracerProvider;
|
|
15
|
-
}
|
|
16
12
|
init() {
|
|
17
13
|
const module = new instrumentation.InstrumentationNodeModuleDefinition(constants.MODULE_NAME, constants.SUPPORTED_MODULE_VERSIONS);
|
|
18
14
|
return [module];
|
|
@@ -21,7 +17,6 @@ class PrismaInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
21
17
|
const config = this._config;
|
|
22
18
|
global.setGlobalTracingHelper(
|
|
23
19
|
new activeTracingHelper.ActiveTracingHelper({
|
|
24
|
-
tracerProvider: this.tracerProvider ?? api.trace.getTracerProvider(),
|
|
25
20
|
ignoreSpanTypes: config.ignoreSpanTypes ?? []
|
|
26
21
|
})
|
|
27
22
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/prisma/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright Prisma\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/prisma/prisma/tree/b6feea5565ec577545a79547d24273ccdd11b4c7/packages/instrumentation\n * - Upstream version: @prisma/instrumentation@7.8.0\n * - Replaced `@prisma/instrumentation-contract` imports with local vendored equivalents\n * - Replaced `import { VERSION, NAME, MODULE_NAME } from './constants'` with local vendored constants\n
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/prisma/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright Prisma\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/prisma/prisma/tree/b6feea5565ec577545a79547d24273ccdd11b4c7/packages/instrumentation\n * - Upstream version: @prisma/instrumentation@7.8.0\n * - Replaced `@prisma/instrumentation-contract` imports with local vendored equivalents\n * - Replaced `import { VERSION, NAME, MODULE_NAME } from './constants'` with local vendored constants\n * - Removed the unused `setTracerProvider`/`tracerProvider` members; spans are created through Sentry's\n * span APIs, which resolve the active client themselves\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { ActiveTracingHelper } from './active-tracing-helper';\nimport { MODULE_NAME, NAME, SUPPORTED_MODULE_VERSIONS, VERSION } from './constants';\nimport { clearGlobalTracingHelper, getGlobalTracingHelper, setGlobalTracingHelper } from './global';\n\nexport interface PrismaInstrumentationConfig {\n ignoreSpanTypes?: (string | RegExp)[];\n}\n\ntype Config = PrismaInstrumentationConfig & InstrumentationConfig;\n\nexport class PrismaInstrumentation extends InstrumentationBase {\n public constructor(config: Config = {}) {\n super(NAME, VERSION, config);\n }\n\n public init(): InstrumentationNodeModuleDefinition[] {\n const module = new InstrumentationNodeModuleDefinition(MODULE_NAME, SUPPORTED_MODULE_VERSIONS);\n\n return [module];\n }\n\n public enable(): void {\n const config = this._config as Config;\n\n setGlobalTracingHelper(\n new ActiveTracingHelper({\n ignoreSpanTypes: config.ignoreSpanTypes ?? [],\n }),\n );\n }\n\n public disable(): void {\n clearGlobalTracingHelper();\n }\n\n public isEnabled(): boolean {\n return getGlobalTracingHelper() !== undefined;\n }\n}\n"],"names":["InstrumentationBase","NAME","VERSION","InstrumentationNodeModuleDefinition","MODULE_NAME","SUPPORTED_MODULE_VERSIONS","setGlobalTracingHelper","ActiveTracingHelper","clearGlobalTracingHelper","getGlobalTracingHelper"],"mappings":";;;;;;;AAyBO,MAAM,8BAA8BA,mCAAA,CAAoB;AAAA,EACtD,WAAA,CAAY,MAAA,GAAiB,EAAC,EAAG;AACtC,IAAA,KAAA,CAAMC,cAAA,EAAMC,mBAAS,MAAM,CAAA;AAAA,EAC7B;AAAA,EAEO,IAAA,GAA8C;AACnD,IAAA,MAAM,MAAA,GAAS,IAAIC,mDAAA,CAAoCC,qBAAA,EAAaC,mCAAyB,CAAA;AAE7F,IAAA,OAAO,CAAC,MAAM,CAAA;AAAA,EAChB;AAAA,EAEO,MAAA,GAAe;AACpB,IAAA,MAAM,SAAS,IAAA,CAAK,OAAA;AAEpB,IAAAC,6BAAA;AAAA,MACE,IAAIC,uCAAA,CAAoB;AAAA,QACtB,eAAA,EAAiB,MAAA,CAAO,eAAA,IAAmB;AAAC,OAC7C;AAAA,KACH;AAAA,EACF;AAAA,EAEO,OAAA,GAAgB;AACrB,IAAAC,+BAAA,EAAyB;AAAA,EAC3B;AAAA,EAEO,SAAA,GAAqB;AAC1B,IAAA,OAAOC,+BAAuB,KAAM,MAAA;AAAA,EACtC;AACF;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const redisCache = require('../../../utils/redisCache.js');
|
|
5
|
+
|
|
6
|
+
exports._redisOptions = {};
|
|
7
|
+
function setRedisOptions(options) {
|
|
8
|
+
exports._redisOptions = options;
|
|
9
|
+
}
|
|
10
|
+
const cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
|
|
11
|
+
const safeKey = redisCache.getCacheKeySafely(redisCommand, cmdArgs);
|
|
12
|
+
const cacheOperation = redisCache.getCacheOperation(redisCommand);
|
|
13
|
+
if (!safeKey || !cacheOperation || !exports._redisOptions.cachePrefixes || !redisCache.shouldConsiderForCache(redisCommand, safeKey, exports._redisOptions.cachePrefixes)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const spanData = core.spanToJSON(span).data;
|
|
17
|
+
const networkPeerAddress = spanData["net.peer.name"] ?? spanData["server.address"];
|
|
18
|
+
const networkPeerPort = spanData["net.peer.port"] ?? spanData["server.port"];
|
|
19
|
+
if (networkPeerPort && networkPeerAddress) {
|
|
20
|
+
span.setAttributes({ "network.peer.address": networkPeerAddress, "network.peer.port": networkPeerPort });
|
|
21
|
+
}
|
|
22
|
+
const cacheItemSize = redisCache.calculateCacheItemSize(response);
|
|
23
|
+
if (cacheItemSize) {
|
|
24
|
+
span.setAttribute(core.SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);
|
|
25
|
+
}
|
|
26
|
+
if (redisCache.isInCommands(redisCache.GET_COMMANDS, redisCommand) && cacheItemSize !== void 0) {
|
|
27
|
+
span.setAttribute(core.SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);
|
|
28
|
+
}
|
|
29
|
+
span.setAttributes({
|
|
30
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,
|
|
31
|
+
[core.SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey
|
|
32
|
+
});
|
|
33
|
+
const spanDescription = safeKey.join(", ");
|
|
34
|
+
span.updateName(
|
|
35
|
+
exports._redisOptions.maxCacheKeyLength ? core.truncate(spanDescription, exports._redisOptions.maxCacheKeyLength) : spanDescription
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.cacheResponseHook = cacheResponseHook;
|
|
40
|
+
exports.setRedisOptions = setRedisOptions;
|
|
41
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sources":["../../../../../src/integrations/tracing/redis/cache.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_CACHE_HIT,\n SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE,\n SEMANTIC_ATTRIBUTE_CACHE_KEY,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n spanToJSON,\n truncate,\n} from '@sentry/core';\nimport type { IORedisCommandArgs } from '../../../utils/redisCache';\nimport {\n calculateCacheItemSize,\n GET_COMMANDS,\n getCacheKeySafely,\n getCacheOperation,\n isInCommands,\n shouldConsiderForCache,\n} from '../../../utils/redisCache';\nimport type { IORedisResponseCustomAttributeFunction } from './vendored/types';\n\n// This module deliberately does NOT import the vendored OTel `IORedisInstrumentation`/\n// `RedisInstrumentation`, so the orchestrion opt-in can pull `cacheResponseHook`\n// without dragging the OTel redis instrumentation into its module graph.\n\nexport interface RedisOptions {\n /**\n * Define cache prefixes for cache keys that should be captured as a cache span.\n *\n * Setting this to, for example, `['user:']` will capture cache keys that start with `user:`.\n */\n cachePrefixes?: string[];\n /**\n * Maximum length of the cache key added to the span description. If the key exceeds this length, it will be truncated.\n *\n * Passing `0` will use the full cache key without truncation.\n *\n * By default, the full cache key is used.\n */\n maxCacheKeyLength?: number;\n}\n\n/* Only exported for testing purposes */\nexport let _redisOptions: RedisOptions = {};\n\n/** Set the options consumed by {@link cacheResponseHook}. */\nexport function setRedisOptions(options: RedisOptions): void {\n _redisOptions = options;\n}\n\n/* Only exported for testing purposes */\nexport const cacheResponseHook: IORedisResponseCustomAttributeFunction = (\n span: Span,\n redisCommand: string,\n cmdArgs: IORedisCommandArgs,\n response: unknown,\n) => {\n const safeKey = getCacheKeySafely(redisCommand, cmdArgs);\n const cacheOperation = getCacheOperation(redisCommand);\n\n if (\n !safeKey ||\n !cacheOperation ||\n !_redisOptions.cachePrefixes ||\n !shouldConsiderForCache(redisCommand, safeKey, _redisOptions.cachePrefixes)\n ) {\n // not relevant for cache\n return;\n }\n\n // otel/ioredis seems to be using the old standard, as there was a change to those params: https://github.com/open-telemetry/opentelemetry-specification/issues/3199\n // We are using params based on the docs: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/\n // Fall back to stable semconv attributes (server.address/server.port) when\n // old-semconv ones are absent, eg OTEL_SEMCONV_STABILITY_OPT_IN=database\n // set for node-redis v4/v5.\n const spanData = spanToJSON(span).data;\n const networkPeerAddress = spanData['net.peer.name'] ?? spanData['server.address'];\n const networkPeerPort = spanData['net.peer.port'] ?? spanData['server.port'];\n if (networkPeerPort && networkPeerAddress) {\n span.setAttributes({ 'network.peer.address': networkPeerAddress, 'network.peer.port': networkPeerPort });\n }\n\n const cacheItemSize = calculateCacheItemSize(response);\n\n if (cacheItemSize) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);\n }\n\n if (isInCommands(GET_COMMANDS, redisCommand) && cacheItemSize !== undefined) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,\n [SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey,\n });\n\n // todo: change to string[] once EAP supports it\n const spanDescription = safeKey.join(', ');\n\n span.updateName(\n _redisOptions.maxCacheKeyLength ? truncate(spanDescription, _redisOptions.maxCacheKeyLength) : spanDescription,\n );\n};\n"],"names":["_redisOptions","getCacheKeySafely","getCacheOperation","shouldConsiderForCache","spanToJSON","calculateCacheItemSize","SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE","isInCommands","GET_COMMANDS","SEMANTIC_ATTRIBUTE_CACHE_HIT","SEMANTIC_ATTRIBUTE_SENTRY_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EAAA,IAAA,CAAK,aAAA,CAAc;AAAA,IACjB,CAACC,iCAA4B,GAAG,cAAA;AAAA,IAChC,CAACC,iCAA4B,GAAG;AAAA,GACjC,CAAA;AAGD,EAAA,MAAM,eAAA,GAAkB,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA;AAEzC,EAAA,IAAA,CAAK,UAAA;AAAA,IACHX,sBAAc,iBAAA,GAAoBY,aAAA,CAAS,eAAA,EAAiBZ,qBAAA,CAAc,iBAAiB,CAAA,GAAI;AAAA,GACjG;AACF;;;;;"}
|
|
@@ -4,58 +4,32 @@ const core = require('@sentry/core');
|
|
|
4
4
|
const dc = require('node:diagnostics_channel');
|
|
5
5
|
const serverUtils = require('@sentry/server-utils');
|
|
6
6
|
const nodeCore = require('@sentry/node-core');
|
|
7
|
-
const
|
|
7
|
+
const diagnosticsChannelInjection = require('../../../sdk/diagnosticsChannelInjection.js');
|
|
8
|
+
const cache = require('./cache.js');
|
|
8
9
|
const ioredisInstrumentation = require('./vendored/ioredis-instrumentation.js');
|
|
9
10
|
const redisInstrumentation = require('./vendored/redis-instrumentation.js');
|
|
10
11
|
|
|
11
12
|
const INTEGRATION_NAME = "Redis";
|
|
12
|
-
exports._redisOptions = {};
|
|
13
|
-
const cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
|
|
14
|
-
const safeKey = redisCache.getCacheKeySafely(redisCommand, cmdArgs);
|
|
15
|
-
const cacheOperation = redisCache.getCacheOperation(redisCommand);
|
|
16
|
-
if (!safeKey || !cacheOperation || !exports._redisOptions.cachePrefixes || !redisCache.shouldConsiderForCache(redisCommand, safeKey, exports._redisOptions.cachePrefixes)) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const spanData = core.spanToJSON(span).data;
|
|
20
|
-
const networkPeerAddress = spanData["net.peer.name"] ?? spanData["server.address"];
|
|
21
|
-
const networkPeerPort = spanData["net.peer.port"] ?? spanData["server.port"];
|
|
22
|
-
if (networkPeerPort && networkPeerAddress) {
|
|
23
|
-
span.setAttributes({ "network.peer.address": networkPeerAddress, "network.peer.port": networkPeerPort });
|
|
24
|
-
}
|
|
25
|
-
const cacheItemSize = redisCache.calculateCacheItemSize(response);
|
|
26
|
-
if (cacheItemSize) {
|
|
27
|
-
span.setAttribute(core.SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);
|
|
28
|
-
}
|
|
29
|
-
if (redisCache.isInCommands(redisCache.GET_COMMANDS, redisCommand) && cacheItemSize !== void 0) {
|
|
30
|
-
span.setAttribute(core.SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);
|
|
31
|
-
}
|
|
32
|
-
span.setAttributes({
|
|
33
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,
|
|
34
|
-
[core.SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey
|
|
35
|
-
});
|
|
36
|
-
const spanDescription = safeKey.join(", ");
|
|
37
|
-
span.updateName(
|
|
38
|
-
exports._redisOptions.maxCacheKeyLength ? core.truncate(spanDescription, exports._redisOptions.maxCacheKeyLength) : spanDescription
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
13
|
const instrumentIORedis = nodeCore.generateInstrumentOnce(`${INTEGRATION_NAME}.IORedis`, () => {
|
|
42
14
|
return new ioredisInstrumentation.IORedisInstrumentation({
|
|
43
|
-
responseHook: cacheResponseHook
|
|
15
|
+
responseHook: cache.cacheResponseHook
|
|
44
16
|
});
|
|
45
17
|
});
|
|
46
18
|
const instrumentRedisModule = nodeCore.generateInstrumentOnce(`${INTEGRATION_NAME}.Redis`, () => {
|
|
47
19
|
return new redisInstrumentation.RedisInstrumentation({
|
|
48
|
-
responseHook: cacheResponseHook
|
|
20
|
+
responseHook: cache.cacheResponseHook
|
|
49
21
|
});
|
|
50
22
|
});
|
|
51
23
|
const instrumentRedis = Object.assign(
|
|
52
24
|
() => {
|
|
53
|
-
|
|
25
|
+
if (!diagnosticsChannelInjection.isDiagnosticsChannelInjectionEnabled() || !dc.tracingChannel) {
|
|
26
|
+
instrumentIORedis();
|
|
27
|
+
}
|
|
54
28
|
instrumentRedisModule();
|
|
55
29
|
if (dc.tracingChannel) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
30
|
+
core.waitForTracingChannelBinding(() => {
|
|
31
|
+
serverUtils.subscribeRedisDiagnosticChannels(dc.tracingChannel, cache.cacheResponseHook);
|
|
32
|
+
});
|
|
59
33
|
}
|
|
60
34
|
},
|
|
61
35
|
{ id: INTEGRATION_NAME }
|
|
@@ -64,14 +38,18 @@ const _redisIntegration = ((options = {}) => {
|
|
|
64
38
|
return {
|
|
65
39
|
name: INTEGRATION_NAME,
|
|
66
40
|
setupOnce() {
|
|
67
|
-
|
|
41
|
+
cache.setRedisOptions(options);
|
|
68
42
|
instrumentRedis();
|
|
69
43
|
}
|
|
70
44
|
};
|
|
71
45
|
});
|
|
72
46
|
const redisIntegration = core.defineIntegration(_redisIntegration);
|
|
73
47
|
|
|
74
|
-
exports
|
|
48
|
+
Object.defineProperty(exports, "_redisOptions", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: () => cache._redisOptions
|
|
51
|
+
});
|
|
52
|
+
exports.cacheResponseHook = cache.cacheResponseHook;
|
|
75
53
|
exports.instrumentRedis = instrumentRedis;
|
|
76
54
|
exports.redisIntegration = redisIntegration;
|
|
77
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/redis/index.ts"],"sourcesContent":["import type { IntegrationFn
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/redis/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';\nimport * as dc from 'node:diagnostics_channel';\nimport { subscribeRedisDiagnosticChannels, type RedisTracingChannelFactory } from '@sentry/server-utils';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { isDiagnosticsChannelInjectionEnabled } from '../../../sdk/diagnosticsChannelInjection';\nimport { cacheResponseHook, type RedisOptions, setRedisOptions } from './cache';\nimport { IORedisInstrumentation } from './vendored/ioredis-instrumentation';\nimport { RedisInstrumentation } from './vendored/redis-instrumentation';\n\n// `cacheResponseHook`/`_redisOptions` live in `./cache` (which has no OTel\n// instrumentation imports) so the orchestrion opt-in can pull the hook without\n// dragging the OTel redis instrumentation in. Re-exported here for tests.\nexport { _redisOptions, cacheResponseHook } from './cache';\n\nconst INTEGRATION_NAME = 'Redis' as const;\n\nconst instrumentIORedis = generateInstrumentOnce(`${INTEGRATION_NAME}.IORedis`, () => {\n return new IORedisInstrumentation({\n responseHook: cacheResponseHook,\n });\n});\n\nconst instrumentRedisModule = generateInstrumentOnce(`${INTEGRATION_NAME}.Redis`, () => {\n return new RedisInstrumentation({\n responseHook: cacheResponseHook,\n });\n});\n\n/**\n * To be able to preload all Redis OTel instrumentations with just one ID\n * (\"Redis\"), all the instrumentations are generated in this one function\n */\nexport const instrumentRedis = Object.assign(\n (): void => {\n // When diagnostics-channel injection is opted in, orchestrion owns ioredis\n // `<5.11.0`, so skip the OTel ioredis monkey-patch to avoid double instrumentation.\n // On Node without `tracingChannel` (<18.19) orchestrion can't run, so keep the\n // OTel patch there — otherwise ioredis `<5.11.0` would not be traced at all.\n if (!isDiagnosticsChannelInjectionEnabled() || !dc.tracingChannel) {\n instrumentIORedis();\n }\n instrumentRedisModule();\n // node-redis >= 5.12.0 and ioredis >= 5.11.0 publish via diagnostics_channel.\n // `bindTracingChannelToSpan` (inside the subscriber) makes the span the active\n // OTel context via `bindStore`, which needs the Sentry OTel context manager to\n // be registered — `initOpenTelemetry()` does that after integration `setupOnce`,\n // so defer to the next tick.\n // Check this here to ensure this does not fail at runtime for Node <= 18.18.0\n if (dc.tracingChannel) {\n waitForTracingChannelBinding(() => {\n subscribeRedisDiagnosticChannels(dc.tracingChannel as RedisTracingChannelFactory, cacheResponseHook);\n });\n }\n\n // todo: implement them gradually\n // new LegacyRedisInstrumentation({}),\n },\n { id: INTEGRATION_NAME },\n);\n\nconst _redisIntegration = ((options: RedisOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n setRedisOptions(options);\n instrumentRedis();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [redis](https://www.npmjs.com/package/redis) and\n * [ioredis](https://www.npmjs.com/package/ioredis) libraries.\n *\n * For more information, see the [`redisIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/redis/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.redisIntegration()],\n * });\n * ```\n */\nexport const redisIntegration = defineIntegration(_redisIntegration);\n"],"names":["generateInstrumentOnce","IORedisInstrumentation","cacheResponseHook","RedisInstrumentation","isDiagnosticsChannelInjectionEnabled","waitForTracingChannelBinding","subscribeRedisDiagnosticChannels","setRedisOptions","defineIntegration"],"mappings":";;;;;;;;;;;AAeA,MAAM,gBAAA,GAAmB,OAAA;AAEzB,MAAM,iBAAA,GAAoBA,+BAAA,CAAuB,CAAA,EAAG,gBAAgB,YAAY,MAAM;AACpF,EAAA,OAAO,IAAIC,6CAAA,CAAuB;AAAA,IAChC,YAAA,EAAcC;AAAA,GACf,CAAA;AACH,CAAC,CAAA;AAED,MAAM,qBAAA,GAAwBF,+BAAA,CAAuB,CAAA,EAAG,gBAAgB,UAAU,MAAM;AACtF,EAAA,OAAO,IAAIG,yCAAA,CAAqB;AAAA,IAC9B,YAAA,EAAcD;AAAA,GACf,CAAA;AACH,CAAC,CAAA;AAMM,MAAM,kBAAkB,MAAA,CAAO,MAAA;AAAA,EACpC,MAAY;AAKV,IAAA,IAAI,CAACE,gEAAA,EAAqC,IAAK,CAAC,GAAG,cAAA,EAAgB;AACjE,MAAA,iBAAA,EAAkB;AAAA,IACpB;AACA,IAAA,qBAAA,EAAsB;AAOtB,IAAA,IAAI,GAAG,cAAA,EAAgB;AACrB,MAAAC,iCAAA,CAA6B,MAAM;AACjC,QAAAC,4CAAA,CAAiC,EAAA,CAAG,gBAA8CJ,uBAAiB,CAAA;AAAA,MACrG,CAAC,CAAA;AAAA,IACH;AAAA,EAIF,CAAA;AAAA,EACA,EAAE,IAAI,gBAAA;AACR;AAEA,MAAM,iBAAA,IAAqB,CAAC,OAAA,GAAwB,EAAC,KAAM;AACzD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAAK,qBAAA,CAAgB,OAAO,CAAA;AACvB,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,gBAAA,GAAmBC,uBAAkB,iBAAiB;;;;;;;;;;"}
|
|
@@ -2,7 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const instrumentation = require('@opentelemetry/instrumentation');
|
|
4
4
|
const core = require('@sentry/core');
|
|
5
|
-
const
|
|
5
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
6
|
+
const serverUtils = require('@sentry/server-utils');
|
|
6
7
|
const semconv = require('./semconv.js');
|
|
7
8
|
|
|
8
9
|
const PACKAGE_NAME = "@sentry/instrumentation-ioredis";
|
|
@@ -53,15 +54,19 @@ class IORedisInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
53
54
|
return original.apply(this, args);
|
|
54
55
|
}
|
|
55
56
|
const { host, port } = this.options;
|
|
56
|
-
const attributes = {
|
|
57
|
-
|
|
58
|
-
[
|
|
57
|
+
const attributes$1 = {
|
|
58
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
59
|
+
[attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
60
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
61
|
+
[attributes.DB_STATEMENT]: serverUtils.defaultDbStatementSerializer(cmd.name, cmd.args),
|
|
59
62
|
[semconv.ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,
|
|
60
|
-
|
|
61
|
-
[
|
|
63
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
64
|
+
[attributes.NET_PEER_NAME]: host,
|
|
65
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
66
|
+
[attributes.NET_PEER_PORT]: port,
|
|
62
67
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
63
68
|
};
|
|
64
|
-
const span = core.startInactiveSpan({ name: cmd.name, kind: core.SPAN_KIND.CLIENT, attributes });
|
|
69
|
+
const span = core.startInactiveSpan({ name: cmd.name, kind: core.SPAN_KIND.CLIENT, attributes: attributes$1 });
|
|
65
70
|
try {
|
|
66
71
|
const result = original.apply(this, args);
|
|
67
72
|
const origResolve = cmd.resolve;
|
|
@@ -90,15 +95,19 @@ class IORedisInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
90
95
|
return original.apply(this, args);
|
|
91
96
|
}
|
|
92
97
|
const { host, port } = this.options;
|
|
93
|
-
const attributes = {
|
|
94
|
-
|
|
95
|
-
[
|
|
98
|
+
const attributes$1 = {
|
|
99
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
100
|
+
[attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
101
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
102
|
+
[attributes.DB_STATEMENT]: "connect",
|
|
96
103
|
[semconv.ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,
|
|
97
|
-
|
|
98
|
-
[
|
|
104
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
105
|
+
[attributes.NET_PEER_NAME]: host,
|
|
106
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
107
|
+
[attributes.NET_PEER_PORT]: port,
|
|
99
108
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
100
109
|
};
|
|
101
|
-
const span = core.startInactiveSpan({ name: "connect", kind: core.SPAN_KIND.CLIENT, attributes });
|
|
110
|
+
const span = core.startInactiveSpan({ name: "connect", kind: core.SPAN_KIND.CLIENT, attributes: attributes$1 });
|
|
102
111
|
try {
|
|
103
112
|
const result = original.apply(this, args);
|
|
104
113
|
if (result instanceof Promise) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ioredis-instrumentation.js","sources":["../../../../../../src/integrations/tracing/redis/vendored/ioredis-instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/instrumentation-ioredis-v0.62.0/packages/instrumentation-ioredis\n * - Upstream version: @opentelemetry/instrumentation-ioredis@0.62.0\n * - Minor TypeScript adjustments for this repository's compiler settings\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n getActiveSpan,\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { defaultDbStatementSerializer } from './redis-common';\nimport {\n ATTR_DB_CONNECTION_STRING,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_REDIS,\n} from './semconv';\nimport type { IORedisInstrumentationConfig } from './types';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-ioredis';\nconst ORIGIN = 'auto.db.otel.redis';\n\n// ioredis >= 5.11.0 publishes via diagnostics_channel, which Sentry subscribes\n// to separately, so this monkey-patching instrumentation only covers < 5.11.0.\nconst SUPPORTED_VERSIONS = ['>=2.0.0 <5.11.0'];\n\n// The raw imported `ioredis` module is either the CommonJS export or an ESM\n// namespace wrapping it on `.default`. Typed shallowly since it is only used\n// internally to reach the `Redis` prototype that holds the methods we patch.\ntype IORedisModule = {\n default?: { prototype: RedisPrototype };\n prototype: RedisPrototype;\n [Symbol.toStringTag]?: string;\n};\n\ninterface RedisPrototype {\n sendCommand: (...args: unknown[]) => unknown;\n connect: (...args: unknown[]) => unknown;\n}\n\n// The `this` of the patched methods is a Redis client instance exposing its\n// connection options.\ninterface RedisClient {\n options: { host?: string; port?: number };\n}\n\n// The in-flight command object ioredis passes to `sendCommand`. We swap its\n// `resolve`/`reject` so the span ends when the command settles.\ninterface RedisCommand {\n name: string;\n args: Array<string | Buffer>;\n resolve: (result: unknown) => void;\n reject: (err: Error) => void;\n}\n\nfunction endSpan(span: Span, err: Error | null | undefined): void {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n}\n\nexport class IORedisInstrumentation extends InstrumentationBase<IORedisInstrumentationConfig> {\n public constructor(config: IORedisInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition(\n 'ioredis',\n SUPPORTED_VERSIONS,\n (module: IORedisModule) => {\n const moduleExports = module[Symbol.toStringTag] === 'Module' && module.default ? module.default : module;\n if (isWrapped(moduleExports.prototype.sendCommand)) {\n this._unwrap(moduleExports.prototype, 'sendCommand');\n }\n this._wrap(moduleExports.prototype, 'sendCommand', this._patchSendCommand());\n if (isWrapped(moduleExports.prototype.connect)) {\n this._unwrap(moduleExports.prototype, 'connect');\n }\n this._wrap(moduleExports.prototype, 'connect', this._patchConnection());\n return module;\n },\n (module: IORedisModule | undefined) => {\n if (module === undefined) return;\n const moduleExports = module[Symbol.toStringTag] === 'Module' && module.default ? module.default : module;\n this._unwrap(moduleExports.prototype, 'sendCommand');\n this._unwrap(moduleExports.prototype, 'connect');\n },\n ),\n ];\n }\n\n private _patchSendCommand() {\n const instrumentation = this;\n return (original: (...args: unknown[]) => unknown) => {\n return function (this: RedisClient, ...args: unknown[]): unknown {\n const cmd = args[0] as RedisCommand | undefined;\n // ioredis only creates a span when there is an active parent span\n // (the upstream `requireParentSpan` default, which Sentry never overrides).\n if (args.length < 1 || typeof cmd !== 'object' || !getActiveSpan()) {\n return original.apply(this, args);\n }\n\n const { host, port } = this.options;\n const attributes: SpanAttributes = {\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n [ATTR_DB_STATEMENT]: defaultDbStatementSerializer(cmd.name, cmd.args),\n [ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,\n [ATTR_NET_PEER_NAME]: host,\n [ATTR_NET_PEER_PORT]: port,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n\n const span = startInactiveSpan({ name: cmd.name, kind: SPAN_KIND.CLIENT, attributes });\n\n try {\n const result = original.apply(this, args);\n const origResolve = cmd.resolve;\n cmd.resolve = function (response: unknown): void {\n instrumentation._callResponseHook(span, cmd, response);\n endSpan(span, null);\n origResolve(response);\n };\n const origReject = cmd.reject;\n cmd.reject = function (err: Error): void {\n endSpan(span, err);\n origReject(err);\n };\n return result;\n } catch (error) {\n endSpan(span, error as Error);\n throw error;\n }\n };\n };\n }\n\n private _patchConnection() {\n return (original: (...args: unknown[]) => unknown) => {\n return function (this: RedisClient, ...args: unknown[]): unknown {\n if (!getActiveSpan()) {\n return original.apply(this, args);\n }\n\n const { host, port } = this.options;\n const attributes: SpanAttributes = {\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n [ATTR_DB_STATEMENT]: 'connect',\n [ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,\n [ATTR_NET_PEER_NAME]: host,\n [ATTR_NET_PEER_PORT]: port,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n\n const span = startInactiveSpan({ name: 'connect', kind: SPAN_KIND.CLIENT, attributes });\n\n try {\n const result = original.apply(this, args) as Promise<unknown> | undefined;\n if (result instanceof Promise) {\n return result.then(\n (value: unknown) => {\n endSpan(span, null);\n return value;\n },\n (error: Error) => {\n endSpan(span, error);\n return Promise.reject(error);\n },\n );\n }\n endSpan(span, null);\n return result;\n } catch (error) {\n endSpan(span, error as Error);\n throw error;\n }\n };\n };\n }\n\n private _callResponseHook(span: Span, cmd: RedisCommand, response: unknown): void {\n const { responseHook } = this.getConfig();\n if (!responseHook) {\n return;\n }\n try {\n responseHook(span, cmd.name, cmd.args, response);\n } catch {\n // ignore errors thrown from the user-provided response hook\n }\n }\n}\n"],"names":["SPAN_STATUS_ERROR","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","isWrapped","getActiveSpan","ATTR_DB_SYSTEM","DB_SYSTEM_VALUE_REDIS","ATTR_DB_STATEMENT","defaultDbStatementSerializer","ATTR_DB_CONNECTION_STRING","ATTR_NET_PEER_NAME","ATTR_NET_PEER_PORT","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","startInactiveSpan","SPAN_KIND"],"mappings":";;;;;;;AAgCA,MAAM,YAAA,GAAe,iCAAA;AACrB,MAAM,MAAA,GAAS,oBAAA;AAIf,MAAM,kBAAA,GAAqB,CAAC,iBAAiB,CAAA;AA+B7C,SAAS,OAAA,CAAQ,MAAY,GAAA,EAAqC;AAChE,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAMA,wBAAmB,OAAA,EAAS,GAAA,CAAI,SAAS,CAAA;AAAA,EAClE;AACA,EAAA,IAAA,CAAK,GAAA,EAAI;AACX;AAEO,MAAM,+BAA+BC,mCAAA,CAAkD;AAAA,EACrF,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AAC5D,IAAA,KAAA,CAAM,YAAA,EAAcC,kBAAa,MAAM,CAAA;AAAA,EACzC;A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kBAAkB,OAAA,EAAS;AAC7B,YAAA,OAAO,MAAA,CAAO,IAAA;AAAA,cACZ,CAAC,KAAA,KAAmB;AAClB,gBAAA,OAAA,CAAQ,MAAM,IAAI,CAAA;AAClB,gBAAA,OAAO,KAAA;AAAA,cACT,CAAA;AAAA,cACA,CAAC,KAAA,KAAiB;AAChB,gBAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AACnB,gBAAA,OAAO,OAAA,CAAQ,OAAO,KAAK,CAAA;AAAA,cAC7B;AAAA,aACF;AAAA,UACF;AACA,UAAA,OAAA,CAAQ,MAAM,IAAI,CAAA;AAClB,UAAA,OAAO,MAAA;AAAA,QACT,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,MAAM,KAAc,CAAA;AAC5B,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,iBAAA,CAAkB,IAAA,EAAY,GAAA,EAAmB,QAAA,EAAyB;AAChF,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,IAAA,CAAK,SAAA,EAAU;AACxC,IAAA,IAAI,CAAC,YAAA,EAAc;AACjB,MAAA;AAAA,IACF;AACA,IAAA,IAAI;AACF,MAAA,YAAA,CAAa,IAAA,EAAM,GAAA,CAAI,IAAA,EAAM,GAAA,CAAI,MAAM,QAAQ,CAAA;AAAA,IACjD,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"ioredis-instrumentation.js","sources":["../../../../../../src/integrations/tracing/redis/vendored/ioredis-instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/instrumentation-ioredis-v0.62.0/packages/instrumentation-ioredis\n * - Upstream version: @opentelemetry/instrumentation-ioredis@0.62.0\n * - Minor TypeScript adjustments for this repository's compiler settings\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n getActiveSpan,\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { DB_STATEMENT, DB_SYSTEM, NET_PEER_NAME, NET_PEER_PORT } from '@sentry/conventions/attributes';\nimport { defaultDbStatementSerializer } from '@sentry/server-utils';\nimport { ATTR_DB_CONNECTION_STRING, DB_SYSTEM_VALUE_REDIS } from './semconv';\nimport type { IORedisInstrumentationConfig } from './types';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-ioredis';\nconst ORIGIN = 'auto.db.otel.redis';\n\n// ioredis >= 5.11.0 publishes via diagnostics_channel, which Sentry subscribes\n// to separately, so this monkey-patching instrumentation only covers < 5.11.0.\nconst SUPPORTED_VERSIONS = ['>=2.0.0 <5.11.0'];\n\n// The raw imported `ioredis` module is either the CommonJS export or an ESM\n// namespace wrapping it on `.default`. Typed shallowly since it is only used\n// internally to reach the `Redis` prototype that holds the methods we patch.\ntype IORedisModule = {\n default?: { prototype: RedisPrototype };\n prototype: RedisPrototype;\n [Symbol.toStringTag]?: string;\n};\n\ninterface RedisPrototype {\n sendCommand: (...args: unknown[]) => unknown;\n connect: (...args: unknown[]) => unknown;\n}\n\n// The `this` of the patched methods is a Redis client instance exposing its\n// connection options.\ninterface RedisClient {\n options: { host?: string; port?: number };\n}\n\n// The in-flight command object ioredis passes to `sendCommand`. We swap its\n// `resolve`/`reject` so the span ends when the command settles.\ninterface RedisCommand {\n name: string;\n args: Array<string | Buffer>;\n resolve: (result: unknown) => void;\n reject: (err: Error) => void;\n}\n\nfunction endSpan(span: Span, err: Error | null | undefined): void {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: err.message });\n }\n span.end();\n}\n\nexport class IORedisInstrumentation extends InstrumentationBase<IORedisInstrumentationConfig> {\n public constructor(config: IORedisInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition(\n 'ioredis',\n SUPPORTED_VERSIONS,\n (module: IORedisModule) => {\n const moduleExports = module[Symbol.toStringTag] === 'Module' && module.default ? module.default : module;\n if (isWrapped(moduleExports.prototype.sendCommand)) {\n this._unwrap(moduleExports.prototype, 'sendCommand');\n }\n this._wrap(moduleExports.prototype, 'sendCommand', this._patchSendCommand());\n if (isWrapped(moduleExports.prototype.connect)) {\n this._unwrap(moduleExports.prototype, 'connect');\n }\n this._wrap(moduleExports.prototype, 'connect', this._patchConnection());\n return module;\n },\n (module: IORedisModule | undefined) => {\n if (module === undefined) return;\n const moduleExports = module[Symbol.toStringTag] === 'Module' && module.default ? module.default : module;\n this._unwrap(moduleExports.prototype, 'sendCommand');\n this._unwrap(moduleExports.prototype, 'connect');\n },\n ),\n ];\n }\n\n private _patchSendCommand() {\n const instrumentation = this;\n return (original: (...args: unknown[]) => unknown) => {\n return function (this: RedisClient, ...args: unknown[]): unknown {\n const cmd = args[0] as RedisCommand | undefined;\n // ioredis only creates a span when there is an active parent span\n // (the upstream `requireParentSpan` default, which Sentry never overrides).\n if (args.length < 1 || typeof cmd !== 'object' || !getActiveSpan()) {\n return original.apply(this, args);\n }\n\n const { host, port } = this.options;\n const attributes: SpanAttributes = {\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_STATEMENT]: defaultDbStatementSerializer(cmd.name, cmd.args),\n [ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_NAME]: host,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_PORT]: port,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n\n const span = startInactiveSpan({ name: cmd.name, kind: SPAN_KIND.CLIENT, attributes });\n\n try {\n const result = original.apply(this, args);\n const origResolve = cmd.resolve;\n cmd.resolve = function (response: unknown): void {\n instrumentation._callResponseHook(span, cmd, response);\n endSpan(span, null);\n origResolve(response);\n };\n const origReject = cmd.reject;\n cmd.reject = function (err: Error): void {\n endSpan(span, err);\n origReject(err);\n };\n return result;\n } catch (error) {\n endSpan(span, error as Error);\n throw error;\n }\n };\n };\n }\n\n private _patchConnection() {\n return (original: (...args: unknown[]) => unknown) => {\n return function (this: RedisClient, ...args: unknown[]): unknown {\n if (!getActiveSpan()) {\n return original.apply(this, args);\n }\n\n const { host, port } = this.options;\n const attributes: SpanAttributes = {\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_STATEMENT]: 'connect',\n [ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_NAME]: host,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_PORT]: port,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n\n const span = startInactiveSpan({ name: 'connect', kind: SPAN_KIND.CLIENT, attributes });\n\n try {\n const result = original.apply(this, args) as Promise<unknown> | undefined;\n if (result instanceof Promise) {\n return result.then(\n (value: unknown) => {\n endSpan(span, null);\n return value;\n },\n (error: Error) => {\n endSpan(span, error);\n return Promise.reject(error);\n },\n );\n }\n endSpan(span, null);\n return result;\n } catch (error) {\n endSpan(span, error as Error);\n throw error;\n }\n };\n };\n }\n\n private _callResponseHook(span: Span, cmd: RedisCommand, response: unknown): void {\n const { responseHook } = this.getConfig();\n if (!responseHook) {\n return;\n }\n try {\n responseHook(span, cmd.name, cmd.args, response);\n } catch {\n // ignore errors thrown from the user-provided response hook\n }\n }\n}\n"],"names":["SPAN_STATUS_ERROR","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","isWrapped","getActiveSpan","attributes","DB_SYSTEM","DB_SYSTEM_VALUE_REDIS","DB_STATEMENT","defaultDbStatementSerializer","ATTR_DB_CONNECTION_STRING","NET_PEER_NAME","NET_PEER_PORT","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","startInactiveSpan","SPAN_KIND"],"mappings":";;;;;;;;AA0BA,MAAM,YAAA,GAAe,iCAAA;AACrB,MAAM,MAAA,GAAS,oBAAA;AAIf,MAAM,kBAAA,GAAqB,CAAC,iBAAiB,CAAA;AA+B7C,SAAS,OAAA,CAAQ,MAAY,GAAA,EAAqC;AAChE,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAMA,wBAAmB,OAAA,EAAS,GAAA,CAAI,SAAS,CAAA;AAAA,EAClE;AACA,EAAA,IAAA,CAAK,GAAA,EAAI;AACX;AAEO,MAAM,+BAA+BC,mCAAA,CAAkD;AAAA,EACrF,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AAC5D,IAAA,KAAA,CAAM,YAAA,EAAcC,kBAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU,IAAA,GAA8C;AACtD,IAAA,OAAO;AAAA,MACL,IAAIC,mDAAA;AAAA,QACF,SAAA;AAAA,QACA,kBAAA;AAAA,QACA,CAAC,MAAA,KAA0B;AACzB,UAAA,MAAM,aAAA,GAAgB,OAAO,MAAA,CAAO,WAAW,MAAM,QAAA,IAAY,MAAA,CAAO,OAAA,GAAU,MAAA,CAAO,OAAA,GAAU,MAAA;AACnG,UAAA,IAAIC,yBAAA,CAAU,aAAA,CAAc,SAAA,CAAU,WAAW,CAAA,EAAG;AAClD,YAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,SAAA,EAAW,aAAa,C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,CAAQ,MAAM,IAAI,CAAA;AAClB,UAAA,OAAO,MAAA;AAAA,QACT,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,MAAM,KAAc,CAAA;AAC5B,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,iBAAA,CAAkB,IAAA,EAAY,GAAA,EAAmB,QAAA,EAAyB;AAChF,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,IAAA,CAAK,SAAA,EAAU;AACxC,IAAA,IAAI,CAAC,YAAA,EAAc;AACjB,MAAA;AAAA,IACF;AACA,IAAA,IAAI;AACF,MAAA,YAAA,CAAa,IAAA,EAAM,GAAA,CAAI,IAAA,EAAM,GAAA,CAAI,MAAM,QAAQ,CAAA;AAAA,IACjD,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF;;;;"}
|
|
@@ -2,9 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const instrumentation = require('@opentelemetry/instrumentation');
|
|
4
4
|
const core = require('@sentry/core');
|
|
5
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
6
|
+
const serverUtils = require('@sentry/server-utils');
|
|
5
7
|
const debugBuild = require('../../../../debug-build.js');
|
|
6
8
|
const InstrumentationNodeModuleFile = require('../../InstrumentationNodeModuleFile.js');
|
|
7
|
-
const redisCommon = require('./redis-common.js');
|
|
8
9
|
const semconv = require('./semconv.js');
|
|
9
10
|
|
|
10
11
|
const PACKAGE_NAME = "@sentry/instrumentation-redis";
|
|
@@ -43,9 +44,12 @@ function removeCredentialsFromDBConnectionStringAttribute(url) {
|
|
|
43
44
|
}
|
|
44
45
|
function getClientAttributes(options) {
|
|
45
46
|
return {
|
|
46
|
-
|
|
47
|
-
[
|
|
48
|
-
|
|
47
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
48
|
+
[attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
49
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
50
|
+
[attributes.NET_PEER_NAME]: options?.socket?.host,
|
|
51
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
52
|
+
[attributes.NET_PEER_PORT]: options?.socket?.port,
|
|
49
53
|
[semconv.ATTR_DB_CONNECTION_STRING]: removeCredentialsFromDBConnectionStringAttribute(options?.url),
|
|
50
54
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
51
55
|
};
|
|
@@ -80,22 +84,24 @@ const _RedisInstrumentationV2_V3 = class _RedisInstrumentationV2_V3 extends inst
|
|
|
80
84
|
if (arguments.length !== 1 || typeof cmd !== "object") {
|
|
81
85
|
return original.apply(this, arguments);
|
|
82
86
|
}
|
|
83
|
-
const attributes = {
|
|
84
|
-
|
|
85
|
-
[
|
|
87
|
+
const attributes$1 = {
|
|
88
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
89
|
+
[attributes.DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
90
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
91
|
+
[attributes.DB_STATEMENT]: serverUtils.defaultDbStatementSerializer(cmd.command, cmd.args),
|
|
86
92
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
87
93
|
};
|
|
88
94
|
if (this.connection_options) {
|
|
89
|
-
attributes[
|
|
90
|
-
attributes[
|
|
95
|
+
attributes$1[attributes.NET_PEER_NAME] = this.connection_options.host;
|
|
96
|
+
attributes$1[attributes.NET_PEER_PORT] = this.connection_options.port;
|
|
91
97
|
}
|
|
92
98
|
if (this.address) {
|
|
93
|
-
attributes[semconv.ATTR_DB_CONNECTION_STRING] = `redis://${this.address}`;
|
|
99
|
+
attributes$1[semconv.ATTR_DB_CONNECTION_STRING] = `redis://${this.address}`;
|
|
94
100
|
}
|
|
95
101
|
const span = core.startInactiveSpan({
|
|
96
102
|
name: `${_RedisInstrumentationV2_V3.COMPONENT}-${cmd.command}`,
|
|
97
103
|
kind: core.SPAN_KIND.CLIENT,
|
|
98
|
-
attributes
|
|
104
|
+
attributes: attributes$1
|
|
99
105
|
});
|
|
100
106
|
const originalCallback = arguments[0].callback;
|
|
101
107
|
if (originalCallback) {
|
|
@@ -332,15 +338,15 @@ const _RedisInstrumentationV4_V5 = class _RedisInstrumentationV4_V5 extends inst
|
|
|
332
338
|
const clientOptions = origThis.options || origThis[MULTI_COMMAND_OPTIONS];
|
|
333
339
|
const commandName = redisCommandArguments[0];
|
|
334
340
|
const commandArgs = redisCommandArguments.slice(1);
|
|
335
|
-
const attributes = getClientAttributes(clientOptions);
|
|
336
|
-
const dbStatement =
|
|
341
|
+
const attributes$1 = getClientAttributes(clientOptions);
|
|
342
|
+
const dbStatement = serverUtils.defaultDbStatementSerializer(commandName, commandArgs);
|
|
337
343
|
if (dbStatement != null) {
|
|
338
|
-
attributes[
|
|
344
|
+
attributes$1[attributes.DB_STATEMENT] = dbStatement;
|
|
339
345
|
}
|
|
340
346
|
const span = core.startInactiveSpan({
|
|
341
347
|
name: `${_RedisInstrumentationV4_V5.COMPONENT}-${commandName}`,
|
|
342
348
|
kind: core.SPAN_KIND.CLIENT,
|
|
343
|
-
attributes
|
|
349
|
+
attributes: attributes$1
|
|
344
350
|
});
|
|
345
351
|
const res = core.withActiveSpan(span, () => origFunction.apply(origThis, origArguments));
|
|
346
352
|
if (res instanceof Promise) {
|