@sentry/node 10.61.0 → 10.63.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/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/index.js +7 -49
- package/build/cjs/integrations/node-fetch/index.js.map +1 -1
- package/build/cjs/integrations/node-fetch/undici-instrumentation.js +266 -0
- package/build/cjs/integrations/node-fetch/undici-instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/index.js +2 -10
- package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/instrumentation.js +117 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/patches.js +185 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/patches.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js +21 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js +0 -6
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js +71 -80
- 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/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 +2 -3
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js +1 -24
- package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -11
- package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +33 -72
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +46 -105
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.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/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/knex/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/index.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/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js +34 -128
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js +0 -2
- 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/postgres/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/index.js +1 -10
- 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/index.js +5 -3
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/index.js +4 -3
- 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 +8 -6
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
- 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/index.js +9 -50
- package/build/esm/integrations/node-fetch/index.js.map +1 -1
- package/build/esm/integrations/node-fetch/undici-instrumentation.js +264 -0
- package/build/esm/integrations/node-fetch/undici-instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/index.js +3 -11
- package/build/esm/integrations/tracing/amqplib/index.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/instrumentation.js +115 -0
- package/build/esm/integrations/tracing/amqplib/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/vendored/patches.js +177 -0
- package/build/esm/integrations/tracing/amqplib/vendored/patches.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js +12 -2
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/types.js +1 -6
- package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js +68 -78
- 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/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 +3 -4
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js +3 -26
- package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -11
- package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +34 -73
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +47 -106
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.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/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/knex/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa/index.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/mongoose/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js +37 -131
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js +1 -2
- 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/postgres/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/index.js +2 -11
- 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/index.js +7 -5
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js +5 -4
- 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 +9 -7
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.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/index.d.ts +4 -35
- package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/types.d.ts +96 -0
- package/build/types/integrations/node-fetch/types.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/undici-instrumentation.d.ts +14 -0
- package/build/types/integrations/node-fetch/undici-instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/index.d.ts +4 -2
- package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/instrumentation.d.ts +11 -0
- package/build/types/integrations/tracing/amqplib/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/vendored/patches.d.ts +11 -0
- package/build/types/integrations/tracing/amqplib/vendored/patches.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts +25 -37
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts +0 -81
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts +16 -9
- 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/firebase/otel/firebaseInstrumentation.d.ts +4 -9
- package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts +2 -5
- package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts +3 -8
- package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/otel/types.d.ts +0 -20
- package/build/types/integrations/tracing/firebase/otel/types.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/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/knex/index.d.ts +3 -1
- package/build/types/integrations/tracing/knex/index.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/mongoose/index.d.ts +3 -1
- package/build/types/integrations/tracing/mongoose/index.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 +0 -8
- 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/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/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/index.d.ts +4 -2
- package/build/types/integrations/tracing/redis/index.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/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 -2
- 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.map +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/index.d.ts +4 -35
- package/build/types-ts3.8/integrations/node-fetch/types.d.ts +96 -0
- package/build/types-ts3.8/integrations/node-fetch/undici-instrumentation.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/index.d.ts +4 -2
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/instrumentation.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/patches.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv.d.ts +25 -37
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/types.d.ts +0 -81
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/utils.d.ts +16 -9
- 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/firebase/otel/firebaseInstrumentation.d.ts +4 -9
- package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/firestore.d.ts +2 -5
- package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/functions.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/firebase/otel/types.d.ts +0 -20
- 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/knex/index.d.ts +3 -1
- 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/mongoose/index.d.ts +3 -1
- 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 +0 -8
- 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/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/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/index.d.ts +4 -2
- package/build/types-ts3.8/integrations/tracing/tedious/index.d.ts +3 -1
- 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 -2
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +1 -1
- package/package.json +6 -5
- 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/amqplib/vendored/amqplib.js +0 -452
- package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +0 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js +0 -24
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.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/mysql/vendored/AttributeNames.js +0 -9
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.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/amqplib/vendored/amqplib.js +0 -450
- package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +0 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js +0 -13
- package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.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/mysql/vendored/AttributeNames.js +0 -7
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.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/amqplib/vendored/amqplib.d.ts +0 -26
- package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +0 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts +0 -63
- package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.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/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-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/amqplib/vendored/amqplib.d.ts +0 -26
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts +0 -63
- package/build/types-ts3.8/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
- 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
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { SDK_VERSION } from '@sentry/core';
|
|
3
|
+
import { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile.js';
|
|
4
|
+
import { getConnectPatch, getPublishPatch, getConsumePatch, getAckPatch, getAckAllPatch, getChannelEmitPatch, getConfirmedPublishPatch } from './patches.js';
|
|
5
|
+
import { EndOperation } from './types.js';
|
|
6
|
+
|
|
7
|
+
const PACKAGE_NAME = "@sentry/instrumentation-amqplib";
|
|
8
|
+
const supportedVersions = [">=0.5.5 <2"];
|
|
9
|
+
class AmqplibInstrumentation extends InstrumentationBase {
|
|
10
|
+
constructor(config = {}) {
|
|
11
|
+
super(PACKAGE_NAME, SDK_VERSION, config);
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
const channelModelModuleFile = new InstrumentationNodeModuleFile(
|
|
15
|
+
"amqplib/lib/channel_model.js",
|
|
16
|
+
supportedVersions,
|
|
17
|
+
this.patchChannelModel.bind(this),
|
|
18
|
+
this.unpatchChannelModel.bind(this)
|
|
19
|
+
);
|
|
20
|
+
const callbackModelModuleFile = new InstrumentationNodeModuleFile(
|
|
21
|
+
"amqplib/lib/callback_model.js",
|
|
22
|
+
supportedVersions,
|
|
23
|
+
this.patchChannelModel.bind(this),
|
|
24
|
+
this.unpatchChannelModel.bind(this)
|
|
25
|
+
);
|
|
26
|
+
const connectModuleFile = new InstrumentationNodeModuleFile(
|
|
27
|
+
"amqplib/lib/connect.js",
|
|
28
|
+
supportedVersions,
|
|
29
|
+
this.patchConnect.bind(this),
|
|
30
|
+
this.unpatchConnect.bind(this)
|
|
31
|
+
);
|
|
32
|
+
const module = new InstrumentationNodeModuleDefinition("amqplib", supportedVersions, void 0, void 0, [
|
|
33
|
+
channelModelModuleFile,
|
|
34
|
+
connectModuleFile,
|
|
35
|
+
callbackModelModuleFile
|
|
36
|
+
]);
|
|
37
|
+
return module;
|
|
38
|
+
}
|
|
39
|
+
patchConnect(moduleExports) {
|
|
40
|
+
const unpatchedExports = this.unpatchConnect(moduleExports);
|
|
41
|
+
if (!isWrapped(unpatchedExports.connect)) {
|
|
42
|
+
this._wrap(unpatchedExports, "connect", getConnectPatch);
|
|
43
|
+
}
|
|
44
|
+
return unpatchedExports;
|
|
45
|
+
}
|
|
46
|
+
unpatchConnect(moduleExports) {
|
|
47
|
+
if (isWrapped(moduleExports.connect)) {
|
|
48
|
+
this._unwrap(moduleExports, "connect");
|
|
49
|
+
}
|
|
50
|
+
return moduleExports;
|
|
51
|
+
}
|
|
52
|
+
patchChannelModel(moduleExports) {
|
|
53
|
+
if (!isWrapped(moduleExports.Channel.prototype.publish)) {
|
|
54
|
+
this._wrap(moduleExports.Channel.prototype, "publish", getPublishPatch);
|
|
55
|
+
}
|
|
56
|
+
if (!isWrapped(moduleExports.Channel.prototype.consume)) {
|
|
57
|
+
this._wrap(moduleExports.Channel.prototype, "consume", getConsumePatch);
|
|
58
|
+
}
|
|
59
|
+
if (!isWrapped(moduleExports.Channel.prototype.ack)) {
|
|
60
|
+
this._wrap(moduleExports.Channel.prototype, "ack", getAckPatch(false, EndOperation.Ack));
|
|
61
|
+
}
|
|
62
|
+
if (!isWrapped(moduleExports.Channel.prototype.nack)) {
|
|
63
|
+
this._wrap(moduleExports.Channel.prototype, "nack", getAckPatch(true, EndOperation.Nack));
|
|
64
|
+
}
|
|
65
|
+
if (!isWrapped(moduleExports.Channel.prototype.reject)) {
|
|
66
|
+
this._wrap(moduleExports.Channel.prototype, "reject", getAckPatch(true, EndOperation.Reject));
|
|
67
|
+
}
|
|
68
|
+
if (!isWrapped(moduleExports.Channel.prototype.ackAll)) {
|
|
69
|
+
this._wrap(moduleExports.Channel.prototype, "ackAll", getAckAllPatch(false, EndOperation.AckAll));
|
|
70
|
+
}
|
|
71
|
+
if (!isWrapped(moduleExports.Channel.prototype.nackAll)) {
|
|
72
|
+
this._wrap(moduleExports.Channel.prototype, "nackAll", getAckAllPatch(true, EndOperation.NackAll));
|
|
73
|
+
}
|
|
74
|
+
if (!isWrapped(moduleExports.Channel.prototype.emit)) {
|
|
75
|
+
this._wrap(moduleExports.Channel.prototype, "emit", getChannelEmitPatch);
|
|
76
|
+
}
|
|
77
|
+
if (!isWrapped(moduleExports.ConfirmChannel.prototype.publish)) {
|
|
78
|
+
this._wrap(moduleExports.ConfirmChannel.prototype, "publish", getConfirmedPublishPatch);
|
|
79
|
+
}
|
|
80
|
+
return moduleExports;
|
|
81
|
+
}
|
|
82
|
+
unpatchChannelModel(moduleExports) {
|
|
83
|
+
if (isWrapped(moduleExports.Channel.prototype.publish)) {
|
|
84
|
+
this._unwrap(moduleExports.Channel.prototype, "publish");
|
|
85
|
+
}
|
|
86
|
+
if (isWrapped(moduleExports.Channel.prototype.consume)) {
|
|
87
|
+
this._unwrap(moduleExports.Channel.prototype, "consume");
|
|
88
|
+
}
|
|
89
|
+
if (isWrapped(moduleExports.Channel.prototype.ack)) {
|
|
90
|
+
this._unwrap(moduleExports.Channel.prototype, "ack");
|
|
91
|
+
}
|
|
92
|
+
if (isWrapped(moduleExports.Channel.prototype.nack)) {
|
|
93
|
+
this._unwrap(moduleExports.Channel.prototype, "nack");
|
|
94
|
+
}
|
|
95
|
+
if (isWrapped(moduleExports.Channel.prototype.reject)) {
|
|
96
|
+
this._unwrap(moduleExports.Channel.prototype, "reject");
|
|
97
|
+
}
|
|
98
|
+
if (isWrapped(moduleExports.Channel.prototype.ackAll)) {
|
|
99
|
+
this._unwrap(moduleExports.Channel.prototype, "ackAll");
|
|
100
|
+
}
|
|
101
|
+
if (isWrapped(moduleExports.Channel.prototype.nackAll)) {
|
|
102
|
+
this._unwrap(moduleExports.Channel.prototype, "nackAll");
|
|
103
|
+
}
|
|
104
|
+
if (isWrapped(moduleExports.Channel.prototype.emit)) {
|
|
105
|
+
this._unwrap(moduleExports.Channel.prototype, "emit");
|
|
106
|
+
}
|
|
107
|
+
if (isWrapped(moduleExports.ConfirmChannel.prototype.publish)) {
|
|
108
|
+
this._unwrap(moduleExports.ConfirmChannel.prototype, "publish");
|
|
109
|
+
}
|
|
110
|
+
return moduleExports;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { AmqplibInstrumentation };
|
|
115
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/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/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs; the channel/connection\n * patches live in `patches.ts` and span creation in `utils.ts`\n * - Dropped the instrumentation config and all hooks; origin is folded into span creation instead of\n * `index.ts` hooks (see `patches.ts`/`utils.ts` for details)\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport {\n getAckAllPatch,\n getAckPatch,\n getChannelEmitPatch,\n getConfirmedPublishPatch,\n getConnectPatch,\n getConsumePatch,\n getPublishPatch,\n} from './patches';\nimport { EndOperation } from './types';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-amqplib';\nconst supportedVersions = ['>=0.5.5 <2'];\n\nexport class AmqplibInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition {\n const channelModelModuleFile = new InstrumentationNodeModuleFile(\n 'amqplib/lib/channel_model.js',\n supportedVersions,\n this.patchChannelModel.bind(this),\n this.unpatchChannelModel.bind(this),\n );\n\n const callbackModelModuleFile = new InstrumentationNodeModuleFile(\n 'amqplib/lib/callback_model.js',\n supportedVersions,\n this.patchChannelModel.bind(this),\n this.unpatchChannelModel.bind(this),\n );\n\n const connectModuleFile = new InstrumentationNodeModuleFile(\n 'amqplib/lib/connect.js',\n supportedVersions,\n this.patchConnect.bind(this),\n this.unpatchConnect.bind(this),\n );\n\n const module = new InstrumentationNodeModuleDefinition('amqplib', supportedVersions, undefined, undefined, [\n channelModelModuleFile,\n connectModuleFile,\n callbackModelModuleFile,\n ]);\n return module;\n }\n\n private patchConnect(moduleExports: any): any {\n const unpatchedExports = this.unpatchConnect(moduleExports);\n if (!isWrapped(unpatchedExports.connect)) {\n this._wrap(unpatchedExports, 'connect', getConnectPatch);\n }\n return unpatchedExports;\n }\n\n private unpatchConnect(moduleExports: any): any {\n if (isWrapped(moduleExports.connect)) {\n this._unwrap(moduleExports, 'connect');\n }\n return moduleExports;\n }\n\n private patchChannelModel(moduleExports: any): any {\n if (!isWrapped(moduleExports.Channel.prototype.publish)) {\n this._wrap(moduleExports.Channel.prototype, 'publish', getPublishPatch);\n }\n if (!isWrapped(moduleExports.Channel.prototype.consume)) {\n this._wrap(moduleExports.Channel.prototype, 'consume', getConsumePatch);\n }\n if (!isWrapped(moduleExports.Channel.prototype.ack)) {\n this._wrap(moduleExports.Channel.prototype, 'ack', getAckPatch(false, EndOperation.Ack));\n }\n if (!isWrapped(moduleExports.Channel.prototype.nack)) {\n this._wrap(moduleExports.Channel.prototype, 'nack', getAckPatch(true, EndOperation.Nack));\n }\n if (!isWrapped(moduleExports.Channel.prototype.reject)) {\n this._wrap(moduleExports.Channel.prototype, 'reject', getAckPatch(true, EndOperation.Reject));\n }\n if (!isWrapped(moduleExports.Channel.prototype.ackAll)) {\n this._wrap(moduleExports.Channel.prototype, 'ackAll', getAckAllPatch(false, EndOperation.AckAll));\n }\n if (!isWrapped(moduleExports.Channel.prototype.nackAll)) {\n this._wrap(moduleExports.Channel.prototype, 'nackAll', getAckAllPatch(true, EndOperation.NackAll));\n }\n if (!isWrapped(moduleExports.Channel.prototype.emit)) {\n this._wrap(moduleExports.Channel.prototype, 'emit', getChannelEmitPatch);\n }\n if (!isWrapped(moduleExports.ConfirmChannel.prototype.publish)) {\n this._wrap(moduleExports.ConfirmChannel.prototype, 'publish', getConfirmedPublishPatch);\n }\n return moduleExports;\n }\n\n private unpatchChannelModel(moduleExports: any): any {\n if (isWrapped(moduleExports.Channel.prototype.publish)) {\n this._unwrap(moduleExports.Channel.prototype, 'publish');\n }\n if (isWrapped(moduleExports.Channel.prototype.consume)) {\n this._unwrap(moduleExports.Channel.prototype, 'consume');\n }\n if (isWrapped(moduleExports.Channel.prototype.ack)) {\n this._unwrap(moduleExports.Channel.prototype, 'ack');\n }\n if (isWrapped(moduleExports.Channel.prototype.nack)) {\n this._unwrap(moduleExports.Channel.prototype, 'nack');\n }\n if (isWrapped(moduleExports.Channel.prototype.reject)) {\n this._unwrap(moduleExports.Channel.prototype, 'reject');\n }\n if (isWrapped(moduleExports.Channel.prototype.ackAll)) {\n this._unwrap(moduleExports.Channel.prototype, 'ackAll');\n }\n if (isWrapped(moduleExports.Channel.prototype.nackAll)) {\n this._unwrap(moduleExports.Channel.prototype, 'nackAll');\n }\n if (isWrapped(moduleExports.Channel.prototype.emit)) {\n this._unwrap(moduleExports.Channel.prototype, 'emit');\n }\n if (isWrapped(moduleExports.ConfirmChannel.prototype.publish)) {\n this._unwrap(moduleExports.ConfirmChannel.prototype, 'publish');\n }\n return moduleExports;\n }\n}\n"],"names":[],"mappings":";;;;;;AA4BA,MAAM,YAAA,GAAe,iCAAA;AACrB,MAAM,iBAAA,GAAoB,CAAC,YAAY,CAAA;AAEhC,MAAM,+BAA+B,mBAAA,CAA2C;AAAA,EAC9E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU,IAAA,GAA4C;AACpD,IAAA,MAAM,yBAAyB,IAAI,6BAAA;AAAA,MACjC,8BAAA;AAAA,MACA,iBAAA;AAAA,MACA,IAAA,CAAK,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA;AAAA,MAChC,IAAA,CAAK,mBAAA,CAAoB,IAAA,CAAK,IAAI;AAAA,KACpC;AAEA,IAAA,MAAM,0BAA0B,IAAI,6BAAA;AAAA,MAClC,+BAAA;AAAA,MACA,iBAAA;AAAA,MACA,IAAA,CAAK,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA;AAAA,MAChC,IAAA,CAAK,mBAAA,CAAoB,IAAA,CAAK,IAAI;AAAA,KACpC;AAEA,IAAA,MAAM,oBAAoB,IAAI,6BAAA;AAAA,MAC5B,wBAAA;AAAA,MACA,iBAAA;AAAA,MACA,IAAA,CAAK,YAAA,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,EAAW,QAAQ,CAAA;AAAA,IACxD;AACA,IAAA,IAAI,SAAA,CAAU,aAAA,CAAc,OAAA,CAAQ,SAAA,CAAU,MAAM,CAAA,EAAG;AACrD,MAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,OAAA,CAAQ,SAAA,EAAW,QAAQ,CAAA;AAAA,IACxD;AACA,IAAA,IAAI,SAAA,CAAU,aAAA,CAAc,OAAA,CAAQ,SAAA,CAAU,OAAO,CAAA,EAAG;AACtD,MAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,OAAA,CAAQ,SAAA,EAAW,SAAS,CAAA;AAAA,IACzD;AACA,IAAA,IAAI,SAAA,CAAU,aAAA,CAAc,OAAA,CAAQ,SAAA,CAAU,IAAI,CAAA,EAAG;AACnD,MAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,OAAA,CAAQ,SAAA,EAAW,MAAM,CAAA;AAAA,IACtD;AACA,IAAA,IAAI,SAAA,CAAU,aAAA,CAAc,cAAA,CAAe,SAAA,CAAU,OAAO,CAAA,EAAG;AAC7D,MAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,cAAA,CAAe,SAAA,EAAW,SAAS,CAAA;AAAA,IAChE;AACA,IAAA,OAAO,aAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { timestampInSeconds, continueTrace, withActiveSpan, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
2
|
+
import { EndOperation } from './types.js';
|
|
3
|
+
import { getConnectionAttributesFromUrl, getConnectionAttributesFromServer, CONNECTION_ATTRIBUTES, CHANNEL_IS_CONFIRM_PUBLISHING, startPublishSpan, CHANNEL_SPANS_NOT_ENDED, CHANNEL_CONSUME_TIMEOUT_TIMER, getHeaderAsString, startConsumeSpan, MESSAGE_STORED_SPAN } from './utils.js';
|
|
4
|
+
|
|
5
|
+
const CONSUME_TIMEOUT_MS = 1e3 * 60;
|
|
6
|
+
function endConsumerSpan(message, isRejected, operation, requeue) {
|
|
7
|
+
const storedSpan = message[MESSAGE_STORED_SPAN];
|
|
8
|
+
if (!storedSpan) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (isRejected !== false) {
|
|
12
|
+
storedSpan.setStatus({
|
|
13
|
+
code: SPAN_STATUS_ERROR,
|
|
14
|
+
message: operation !== EndOperation.ChannelClosed && operation !== EndOperation.ChannelError ? `${operation} called on message${requeue === true ? " with requeue" : requeue === false ? " without requeue" : ""}` : operation
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
storedSpan.end();
|
|
18
|
+
message[MESSAGE_STORED_SPAN] = void 0;
|
|
19
|
+
}
|
|
20
|
+
function endAllSpansOnChannel(channel, isRejected, operation, requeue) {
|
|
21
|
+
const spansNotEnded = channel[CHANNEL_SPANS_NOT_ENDED] ?? [];
|
|
22
|
+
spansNotEnded.forEach((msgDetails) => {
|
|
23
|
+
endConsumerSpan(msgDetails.msg, isRejected, operation, requeue);
|
|
24
|
+
});
|
|
25
|
+
channel[CHANNEL_SPANS_NOT_ENDED] = [];
|
|
26
|
+
}
|
|
27
|
+
function checkConsumeTimeoutOnChannel(channel) {
|
|
28
|
+
const currentTime = timestampInSeconds();
|
|
29
|
+
const spansNotEnded = channel[CHANNEL_SPANS_NOT_ENDED] ?? [];
|
|
30
|
+
let i;
|
|
31
|
+
for (i = 0; i < spansNotEnded.length; i++) {
|
|
32
|
+
const currMessage = spansNotEnded[i];
|
|
33
|
+
const timeFromConsumeMs = (currentTime - currMessage.timeOfConsume) * 1e3;
|
|
34
|
+
if (timeFromConsumeMs < CONSUME_TIMEOUT_MS) {
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
endConsumerSpan(currMessage.msg, null, EndOperation.InstrumentationTimeout, true);
|
|
38
|
+
}
|
|
39
|
+
spansNotEnded.splice(0, i);
|
|
40
|
+
}
|
|
41
|
+
function getConnectPatch(original) {
|
|
42
|
+
return function patchedConnect(url, socketOptions, openCallback) {
|
|
43
|
+
return original.call(this, url, socketOptions, function(err, conn) {
|
|
44
|
+
if (err == null) {
|
|
45
|
+
const urlAttributes = getConnectionAttributesFromUrl(url);
|
|
46
|
+
const serverAttributes = getConnectionAttributesFromServer(conn);
|
|
47
|
+
conn[CONNECTION_ATTRIBUTES] = {
|
|
48
|
+
...urlAttributes,
|
|
49
|
+
...serverAttributes
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
openCallback.apply(this, arguments);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function getChannelEmitPatch(original) {
|
|
57
|
+
return function emit(eventName) {
|
|
58
|
+
if (eventName === "close") {
|
|
59
|
+
endAllSpansOnChannel(this, true, EndOperation.ChannelClosed, void 0);
|
|
60
|
+
const activeTimer = this[CHANNEL_CONSUME_TIMEOUT_TIMER];
|
|
61
|
+
if (activeTimer) {
|
|
62
|
+
clearInterval(activeTimer);
|
|
63
|
+
}
|
|
64
|
+
this[CHANNEL_CONSUME_TIMEOUT_TIMER] = void 0;
|
|
65
|
+
} else if (eventName === "error") {
|
|
66
|
+
endAllSpansOnChannel(this, true, EndOperation.ChannelError, void 0);
|
|
67
|
+
}
|
|
68
|
+
return original.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getAckAllPatch(isRejected, endOperation) {
|
|
72
|
+
return (original) => function ackAll(requeueOrEmpty) {
|
|
73
|
+
endAllSpansOnChannel(this, isRejected, endOperation, requeueOrEmpty);
|
|
74
|
+
return original.apply(this, arguments);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function getAckPatch(isRejected, endOperation) {
|
|
78
|
+
return (original) => function ack(message, allUpToOrRequeue, requeue) {
|
|
79
|
+
const channel = this;
|
|
80
|
+
const requeueResolved = endOperation === EndOperation.Reject ? allUpToOrRequeue : requeue;
|
|
81
|
+
const spansNotEnded = channel[CHANNEL_SPANS_NOT_ENDED] ?? [];
|
|
82
|
+
const msgIndex = spansNotEnded.findIndex((msgDetails) => msgDetails.msg === message);
|
|
83
|
+
if (msgIndex < 0) {
|
|
84
|
+
endConsumerSpan(message, isRejected, endOperation, requeueResolved);
|
|
85
|
+
} else if (endOperation !== EndOperation.Reject && allUpToOrRequeue) {
|
|
86
|
+
for (let i = 0; i <= msgIndex; i++) {
|
|
87
|
+
endConsumerSpan(spansNotEnded[i].msg, isRejected, endOperation, requeueResolved);
|
|
88
|
+
}
|
|
89
|
+
spansNotEnded.splice(0, msgIndex + 1);
|
|
90
|
+
} else {
|
|
91
|
+
endConsumerSpan(message, isRejected, endOperation, requeueResolved);
|
|
92
|
+
spansNotEnded.splice(msgIndex, 1);
|
|
93
|
+
}
|
|
94
|
+
return original.apply(this, arguments);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function getConsumePatch(original) {
|
|
98
|
+
return function consume(queue, onMessage, options) {
|
|
99
|
+
const channel = this;
|
|
100
|
+
if (!Object.prototype.hasOwnProperty.call(channel, CHANNEL_SPANS_NOT_ENDED)) {
|
|
101
|
+
const timer = setInterval(() => {
|
|
102
|
+
checkConsumeTimeoutOnChannel(channel);
|
|
103
|
+
}, CONSUME_TIMEOUT_MS);
|
|
104
|
+
timer.unref();
|
|
105
|
+
channel[CHANNEL_CONSUME_TIMEOUT_TIMER] = timer;
|
|
106
|
+
channel[CHANNEL_SPANS_NOT_ENDED] = [];
|
|
107
|
+
}
|
|
108
|
+
const patchedOnMessage = function(msg) {
|
|
109
|
+
if (!msg) {
|
|
110
|
+
return onMessage.call(this, msg);
|
|
111
|
+
}
|
|
112
|
+
const headers = msg.properties.headers ?? {};
|
|
113
|
+
const sentryTrace = getHeaderAsString(headers, "sentry-trace");
|
|
114
|
+
const baggage = getHeaderAsString(headers, "baggage");
|
|
115
|
+
continueTrace({ sentryTrace, baggage }, () => {
|
|
116
|
+
const span = startConsumeSpan(queue, msg, channel);
|
|
117
|
+
if (!options?.noAck) {
|
|
118
|
+
channel[CHANNEL_SPANS_NOT_ENDED].push({ msg, timeOfConsume: timestampInSeconds() });
|
|
119
|
+
msg[MESSAGE_STORED_SPAN] = span;
|
|
120
|
+
}
|
|
121
|
+
withActiveSpan(span, () => {
|
|
122
|
+
onMessage.call(this, msg);
|
|
123
|
+
});
|
|
124
|
+
if (options?.noAck) {
|
|
125
|
+
span.end();
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
const callArgs = Array.prototype.slice.call(arguments);
|
|
130
|
+
callArgs[1] = patchedOnMessage;
|
|
131
|
+
return original.apply(this, callArgs);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function getConfirmedPublishPatch(original) {
|
|
135
|
+
return function confirmedPublish(exchange, routingKey, content, options, callback) {
|
|
136
|
+
const channel = this;
|
|
137
|
+
const { span, modifiedOptions } = startPublishSpan(exchange, routingKey, channel, options);
|
|
138
|
+
const patchedOnConfirm = function(err, ok) {
|
|
139
|
+
try {
|
|
140
|
+
withActiveSpan(span, () => {
|
|
141
|
+
callback?.call(this, err, ok);
|
|
142
|
+
});
|
|
143
|
+
} finally {
|
|
144
|
+
if (err) {
|
|
145
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "message confirmation has been nack'ed" });
|
|
146
|
+
}
|
|
147
|
+
span.end();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const argumentsCopy = [...arguments];
|
|
151
|
+
argumentsCopy[3] = modifiedOptions;
|
|
152
|
+
argumentsCopy[4] = patchedOnConfirm;
|
|
153
|
+
channel[CHANNEL_IS_CONFIRM_PUBLISHING] = true;
|
|
154
|
+
try {
|
|
155
|
+
return original.apply(this, argumentsCopy);
|
|
156
|
+
} finally {
|
|
157
|
+
channel[CHANNEL_IS_CONFIRM_PUBLISHING] = false;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function getPublishPatch(original) {
|
|
162
|
+
return function publish(exchange, routingKey, content, options) {
|
|
163
|
+
if (this[CHANNEL_IS_CONFIRM_PUBLISHING]) {
|
|
164
|
+
return original.apply(this, arguments);
|
|
165
|
+
}
|
|
166
|
+
const channel = this;
|
|
167
|
+
const { span, modifiedOptions } = startPublishSpan(exchange, routingKey, channel, options);
|
|
168
|
+
const argumentsCopy = [...arguments];
|
|
169
|
+
argumentsCopy[3] = modifiedOptions;
|
|
170
|
+
const originalRes = original.apply(this, argumentsCopy);
|
|
171
|
+
span.end();
|
|
172
|
+
return originalRes;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { getAckAllPatch, getAckPatch, getChannelEmitPatch, getConfirmedPublishPatch, getConnectPatch, getConsumePatch, getPublishPatch };
|
|
177
|
+
//# sourceMappingURL=patches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patches.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/patches.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/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - The channel/connection patches were extracted from the instrumentation class into standalone factories\n * and migrated to Sentry's span APIs; origin is folded into span creation instead of `index.ts` hooks\n * - Cross-service trace propagation uses Sentry's `getTraceData`/`continueTrace` instead of the OTel propagator\n * - Replaced the OTel context-key confirm-channel marker with a synchronous flag on the channel instance\n * - Dropped the instrumentation config and all hooks (publish/publishConfirm/consume/consumeEnd) and the\n * `useLinksForConsume` path; the SDK never used them\n */\n\nimport { continueTrace, SPAN_STATUS_ERROR, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport type { Connection, Options, Replies } from './amqplib-types';\nimport { EndOperation, type ConsumeMessage, type Message } from './types';\nimport type {\n InstrumentationConnection,\n InstrumentationConsumeChannel,\n InstrumentationConsumeMessage,\n InstrumentationMessage,\n InstrumentationPublishChannel,\n} from './utils';\nimport {\n CHANNEL_CONSUME_TIMEOUT_TIMER,\n CHANNEL_IS_CONFIRM_PUBLISHING,\n CHANNEL_SPANS_NOT_ENDED,\n CONNECTION_ATTRIBUTES,\n getConnectionAttributesFromServer,\n getConnectionAttributesFromUrl,\n getHeaderAsString,\n MESSAGE_STORED_SPAN,\n startConsumeSpan,\n startPublishSpan,\n} from './utils';\n\n// To prevent reference leaks from un-acked messages, their spans are closed after this timeout. The\n// upstream instrumentation exposed this as the `consumeTimeoutMs` option; the SDK always used the default.\nconst CONSUME_TIMEOUT_MS = 1000 * 60; // 1 minute\n\nfunction endConsumerSpan(\n message: InstrumentationMessage,\n isRejected: boolean | null,\n operation: EndOperation,\n requeue: boolean | undefined,\n): void {\n const storedSpan = message[MESSAGE_STORED_SPAN];\n if (!storedSpan) {\n return;\n }\n if (isRejected !== false) {\n storedSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message:\n operation !== EndOperation.ChannelClosed && operation !== EndOperation.ChannelError\n ? `${operation} called on message${\n requeue === true ? ' with requeue' : requeue === false ? ' without requeue' : ''\n }`\n : operation,\n });\n }\n storedSpan.end();\n message[MESSAGE_STORED_SPAN] = undefined;\n}\n\nfunction endAllSpansOnChannel(\n channel: InstrumentationConsumeChannel,\n isRejected: boolean,\n operation: EndOperation,\n requeue: boolean | undefined,\n): void {\n const spansNotEnded: { msg: Message }[] = channel[CHANNEL_SPANS_NOT_ENDED] ?? [];\n spansNotEnded.forEach(msgDetails => {\n endConsumerSpan(msgDetails.msg, isRejected, operation, requeue);\n });\n channel[CHANNEL_SPANS_NOT_ENDED] = [];\n}\n\nfunction checkConsumeTimeoutOnChannel(channel: InstrumentationConsumeChannel): void {\n const currentTime = timestampInSeconds();\n const spansNotEnded = channel[CHANNEL_SPANS_NOT_ENDED] ?? [];\n let i: number;\n for (i = 0; i < spansNotEnded.length; i++) {\n const currMessage = spansNotEnded[i]!;\n const timeFromConsumeMs = (currentTime - currMessage.timeOfConsume) * 1000;\n if (timeFromConsumeMs < CONSUME_TIMEOUT_MS) {\n break;\n }\n endConsumerSpan(currMessage.msg, null, EndOperation.InstrumentationTimeout, true);\n }\n spansNotEnded.splice(0, i);\n}\n\nexport function getConnectPatch(\n original: (\n url: string | Options.Connect,\n socketOptions: any,\n openCallback: (err: any, connection: Connection) => void,\n ) => Connection,\n) {\n return function patchedConnect(\n this: unknown,\n url: string | Options.Connect,\n socketOptions: any,\n openCallback: Function,\n ): Connection {\n return original.call(this, url, socketOptions, function (this: unknown, err: any, conn: InstrumentationConnection) {\n if (err == null) {\n const urlAttributes = getConnectionAttributesFromUrl(url);\n const serverAttributes = getConnectionAttributesFromServer(conn);\n conn[CONNECTION_ATTRIBUTES] = {\n ...urlAttributes,\n ...serverAttributes,\n };\n }\n openCallback.apply(this, arguments);\n });\n };\n}\n\nexport function getChannelEmitPatch(original: Function) {\n return function emit(this: InstrumentationConsumeChannel, eventName: string): void {\n if (eventName === 'close') {\n endAllSpansOnChannel(this, true, EndOperation.ChannelClosed, undefined);\n const activeTimer = this[CHANNEL_CONSUME_TIMEOUT_TIMER];\n if (activeTimer) {\n clearInterval(activeTimer);\n }\n this[CHANNEL_CONSUME_TIMEOUT_TIMER] = undefined;\n } else if (eventName === 'error') {\n endAllSpansOnChannel(this, true, EndOperation.ChannelError, undefined);\n }\n return original.apply(this, arguments);\n };\n}\n\nexport function getAckAllPatch(isRejected: boolean, endOperation: EndOperation) {\n return (original: Function) =>\n function ackAll(this: InstrumentationConsumeChannel, requeueOrEmpty?: boolean): void {\n endAllSpansOnChannel(this, isRejected, endOperation, requeueOrEmpty);\n return original.apply(this, arguments);\n };\n}\n\nexport function getAckPatch(isRejected: boolean, endOperation: EndOperation) {\n return (original: Function) =>\n function ack(\n this: InstrumentationConsumeChannel,\n message: Message,\n allUpToOrRequeue?: boolean,\n requeue?: boolean,\n ): void {\n const channel = this;\n // we use this patch in the reject function as well, but it has a different signature\n const requeueResolved = endOperation === EndOperation.Reject ? allUpToOrRequeue : requeue;\n\n const spansNotEnded: { msg: Message }[] = channel[CHANNEL_SPANS_NOT_ENDED] ?? [];\n const msgIndex = spansNotEnded.findIndex(msgDetails => msgDetails.msg === message);\n if (msgIndex < 0) {\n // should not happen in the happy flow, but possible if the user calls ack twice with the same message\n endConsumerSpan(message, isRejected, endOperation, requeueResolved);\n } else if (endOperation !== EndOperation.Reject && allUpToOrRequeue) {\n for (let i = 0; i <= msgIndex; i++) {\n endConsumerSpan(spansNotEnded[i]!.msg, isRejected, endOperation, requeueResolved);\n }\n spansNotEnded.splice(0, msgIndex + 1);\n } else {\n endConsumerSpan(message, isRejected, endOperation, requeueResolved);\n spansNotEnded.splice(msgIndex, 1);\n }\n return original.apply(this, arguments);\n };\n}\n\nexport function getConsumePatch(original: Function) {\n return function consume(\n this: InstrumentationConsumeChannel,\n queue: string,\n onMessage: (msg: ConsumeMessage | null) => void,\n options?: Options.Consume,\n ): Promise<Replies.Consume> {\n const channel = this;\n if (!Object.prototype.hasOwnProperty.call(channel, CHANNEL_SPANS_NOT_ENDED)) {\n const timer = setInterval(() => {\n checkConsumeTimeoutOnChannel(channel);\n }, CONSUME_TIMEOUT_MS);\n timer.unref();\n channel[CHANNEL_CONSUME_TIMEOUT_TIMER] = timer;\n channel[CHANNEL_SPANS_NOT_ENDED] = [];\n }\n\n const patchedOnMessage = function (this: unknown, msg: InstrumentationConsumeMessage | null): void {\n // msg is expected to be null for a consumer cancel notification\n // https://www.rabbitmq.com/consumer-cancel.html\n // in this case, we do not start a span, as this is not a real message.\n if (!msg) {\n return onMessage.call(this, msg);\n }\n\n const headers = msg.properties.headers ?? {};\n const sentryTrace = getHeaderAsString(headers, 'sentry-trace');\n const baggage = getHeaderAsString(headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumeSpan(queue, msg, channel);\n\n if (!options?.noAck) {\n // store the message on the channel so we can close the span on ackAll etc\n channel[CHANNEL_SPANS_NOT_ENDED]!.push({ msg, timeOfConsume: timestampInSeconds() });\n // store the span on the message so we can end it when the user calls 'ack' on it\n msg[MESSAGE_STORED_SPAN] = span;\n }\n withActiveSpan(span, () => {\n onMessage.call(this, msg);\n });\n\n if (options?.noAck) {\n span.end();\n }\n });\n };\n\n // Copy `arguments` instead of mutating it: in CJS builds it's aliased to the named parameters,\n // so `arguments[1] = ...` would also reassign `onMessage` to `patchedOnMessage`, making the wrapper\n // call itself and recurse infinitely.\n const callArgs = Array.prototype.slice.call(arguments);\n callArgs[1] = patchedOnMessage;\n return original.apply(this, callArgs);\n };\n}\n\nexport function getConfirmedPublishPatch(original: Function) {\n return function confirmedPublish(\n this: InstrumentationPublishChannel,\n exchange: string,\n routingKey: string,\n content: Buffer,\n options?: Options.Publish,\n callback?: (err: any, ok: Replies.Empty) => void,\n ): boolean {\n const channel = this;\n const { span, modifiedOptions } = startPublishSpan(exchange, routingKey, channel, options);\n\n const patchedOnConfirm = function (this: unknown, err: any, ok: Replies.Empty): void {\n try {\n withActiveSpan(span, () => {\n callback?.call(this, err, ok);\n });\n } finally {\n if (err) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: \"message confirmation has been nack'ed\" });\n }\n span.end();\n }\n };\n\n // The confirm channel publish stores the message and registers a broker-confirm callback; the span\n // ends in that callback. The confirm publish internally delegates to the base channel publish, so we\n // flag the channel to stop the base publish patch from creating a second span. The inner call is\n // synchronous, so a flag on the instance is enough and avoids the OTel context machinery.\n const argumentsCopy = [...arguments];\n argumentsCopy[3] = modifiedOptions;\n argumentsCopy[4] = patchedOnConfirm;\n channel[CHANNEL_IS_CONFIRM_PUBLISHING] = true;\n try {\n return original.apply(this, argumentsCopy);\n } finally {\n channel[CHANNEL_IS_CONFIRM_PUBLISHING] = false;\n }\n };\n}\n\nexport function getPublishPatch(original: Function) {\n return function publish(\n this: InstrumentationPublishChannel,\n exchange: string,\n routingKey: string,\n content: Buffer,\n options?: Options.Publish,\n ): boolean {\n if (this[CHANNEL_IS_CONFIRM_PUBLISHING]) {\n // already instrumented by the confirm-channel publish patch\n return original.apply(this, arguments);\n }\n const channel = this;\n const { span, modifiedOptions } = startPublishSpan(exchange, routingKey, channel, options);\n\n // calling the normal channel publish function only stores the message in the queue; it does not send\n // it and wait for an ack, so the span duration is expected to be very short.\n const argumentsCopy = [...arguments];\n argumentsCopy[3] = modifiedOptions;\n const originalRes = original.apply(this, argumentsCopy);\n span.end();\n return originalRes;\n };\n}\n"],"names":[],"mappings":";;;;AAwCA,MAAM,qBAAqB,GAAA,GAAO,EAAA;AAElC,SAAS,eAAA,CACP,OAAA,EACA,UAAA,EACA,SAAA,EACA,OAAA,EACM;AACN,EAAA,MAAM,UAAA,GAAa,QAAQ,mBAAmB,CAAA;AAC9C,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA;AAAA,EACF;AACA,EAAA,IAAI,eAAe,KAAA,EAAO;AACxB,IAAA,UAAA,CAAW,SAAA,CAAU;AAAA,MACnB,IAAA,EAAM,iBAAA;AAAA,MACN,SACE,SAAA,KAAc,YAAA,CAAa,aAAA,IAAiB,SAAA,KAAc,aAAa,YAAA,GACnE,CAAA,EAAG,SAAS,CAAA,kBAAA,EACV,YAAY,IAAA,GAAO,eAAA,GAAkB,YAAY,KAAA,GAAQ,kBAAA,GAAqB,EAChF,CAAA,CAAA,GACA;AAAA,KACP,CAAA;AAAA,EACH;AACA,EAAA,UAAA,CAAW,GAAA,EAAI;AACf,EAAA,OAAA,CAAQ,mBAAmB,CAAA,GAAI,MAAA;AACjC;AAEA,SAAS,oBAAA,CACP,OAAA,EACA,UAAA,EACA,SAAA,EACA,OAAA,EACM;AACN,EAAA,MAAM,aAAA,GAAoC,OAAA,CAAQ,uBAAuB,CAAA,IAAK,EAAC;AAC/E,EAAA,aAAA,CAAc,QAAQ,CAAA,UAAA,KAAc;AAClC,IAAA,eAAA,CAAgB,UAAA,CAAW,GAAA,EAAK,UAAA,EAAY,SAAA,EAAW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IAAA,IAAI,IAAA,CAAK,6BAA6B,CAAA,EAAG;AAEvC,MAAA,OAAO,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,SAAS,CAAA;AAAA,IACvC;AACA,IAAA,MAAM,OAAA,GAAU,IAAA;AAChB,IAAA,MAAM,EAAE,MAAM,eAAA,EAAgB,GAAI,iBAAiB,QAAA,EAAU,UAAA,EAAY,SAAS,OAAO,CAAA;AAIzF,IAAA,MAAM,aAAA,GAAgB,CAAC,GAAG,SAAS,CAAA;AACnC,IAAA,aAAA,CAAc,CAAC,CAAA,GAAI,eAAA;AACnB,IAAA,MAAM,WAAA,GAAc,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,aAAa,CAAA;AACtD,IAAA,IAAA,CAAK,GAAA,EAAI;AACT,IAAA,OAAO,WAAA;AAAA,EACT,CAAA;AACF;;;;"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
const ATTR_MESSAGING_OPERATION = "messaging.operation";
|
|
2
1
|
const ATTR_MESSAGING_SYSTEM = "messaging.system";
|
|
2
|
+
const ATTR_MESSAGING_OPERATION = "messaging.operation";
|
|
3
3
|
const ATTR_NET_PEER_NAME = "net.peer.name";
|
|
4
4
|
const ATTR_NET_PEER_PORT = "net.peer.port";
|
|
5
|
+
const ATTR_MESSAGING_DESTINATION = "messaging.destination";
|
|
6
|
+
const ATTR_MESSAGING_DESTINATION_KIND = "messaging.destination_kind";
|
|
7
|
+
const ATTR_MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key";
|
|
8
|
+
const ATTR_MESSAGING_PROTOCOL = "messaging.protocol";
|
|
9
|
+
const ATTR_MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version";
|
|
10
|
+
const ATTR_MESSAGING_URL = "messaging.url";
|
|
11
|
+
const OLD_ATTR_MESSAGING_MESSAGE_ID = "messaging.message_id";
|
|
12
|
+
const ATTR_MESSAGING_CONVERSATION_ID = "messaging.conversation_id";
|
|
13
|
+
const MESSAGING_DESTINATION_KIND_VALUE_TOPIC = "topic";
|
|
14
|
+
const MESSAGING_OPERATION_VALUE_PROCESS = "process";
|
|
5
15
|
|
|
6
|
-
export { ATTR_MESSAGING_OPERATION, ATTR_MESSAGING_SYSTEM, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT };
|
|
16
|
+
export { ATTR_MESSAGING_CONVERSATION_ID, ATTR_MESSAGING_DESTINATION, ATTR_MESSAGING_DESTINATION_KIND, ATTR_MESSAGING_OPERATION, ATTR_MESSAGING_PROTOCOL, ATTR_MESSAGING_PROTOCOL_VERSION, ATTR_MESSAGING_RABBITMQ_ROUTING_KEY, ATTR_MESSAGING_SYSTEM, ATTR_MESSAGING_URL, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT, MESSAGING_DESTINATION_KIND_VALUE_TOPIC, MESSAGING_OPERATION_VALUE_PROCESS, OLD_ATTR_MESSAGING_MESSAGE_ID };
|
|
7
17
|
//# sourceMappingURL=semconv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/semconv.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/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n
|
|
1
|
+
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/semconv.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/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Merged the upstream `semconv.ts` and `semconv-obsolete.ts` into a single file containing only the\n * constants this instrumentation emits. These mirror the (now legacy) messaging semantic conventions\n * that the SDK has always emitted; the `@deprecated` annotations were dropped since these vendored\n * copies are intentionally the chosen output and we don't want to flag every usage site.\n */\n\n/** The messaging system as identified by the client instrumentation, e.g. `rabbitmq`. */\nexport const ATTR_MESSAGING_SYSTEM = 'messaging.system' as const;\n\n/** A string identifying the kind of message consumption. */\nexport const ATTR_MESSAGING_OPERATION = 'messaging.operation' as const;\n\n/** Host name of the message broker. */\nexport const ATTR_NET_PEER_NAME = 'net.peer.name' as const;\n\n/** Port of the message broker. */\nexport const ATTR_NET_PEER_PORT = 'net.peer.port' as const;\n\n/** The message destination name (the exchange for amqplib). */\nexport const ATTR_MESSAGING_DESTINATION = 'messaging.destination' as const;\n\n/** The kind of message destination. */\nexport const ATTR_MESSAGING_DESTINATION_KIND = 'messaging.destination_kind' as const;\n\n/** RabbitMQ message routing key. */\nexport const ATTR_MESSAGING_RABBITMQ_ROUTING_KEY = 'messaging.rabbitmq.routing_key' as const;\n\n/** The name of the transport protocol. */\nexport const ATTR_MESSAGING_PROTOCOL = 'messaging.protocol' as const;\n\n/** The version of the transport protocol. */\nexport const ATTR_MESSAGING_PROTOCOL_VERSION = 'messaging.protocol_version' as const;\n\n/** Connection string. */\nexport const ATTR_MESSAGING_URL = 'messaging.url' as const;\n\n/** A value used by the messaging system as an identifier for the message, represented as a string. */\nexport const OLD_ATTR_MESSAGING_MESSAGE_ID = 'messaging.message_id' as const;\n\n/** The conversation ID (a.k.a. correlation ID) identifying the conversation the message belongs to. */\nexport const ATTR_MESSAGING_CONVERSATION_ID = 'messaging.conversation_id' as const;\n\n/** Value for `messaging.destination_kind` when the destination is a topic. */\nexport const MESSAGING_DESTINATION_KIND_VALUE_TOPIC = 'topic' as const;\n\n/** Value for `messaging.operation` when the message is being processed by a consumer. */\nexport const MESSAGING_OPERATION_VALUE_PROCESS = 'process' as const;\n"],"names":[],"mappings":"AAcO,MAAM,qBAAA,GAAwB;AAG9B,MAAM,wBAAA,GAA2B;AAGjC,MAAM,kBAAA,GAAqB;AAG3B,MAAM,kBAAA,GAAqB;AAG3B,MAAM,0BAAA,GAA6B;AAGnC,MAAM,+BAAA,GAAkC;AAGxC,MAAM,mCAAA,GAAsC;AAG5C,MAAM,uBAAA,GAA0B;AAGhC,MAAM,+BAAA,GAAkC;AAGxC,MAAM,kBAAA,GAAqB;AAG3B,MAAM,6BAAA,GAAgC;AAGtC,MAAM,8BAAA,GAAiC;AAGvC,MAAM,sCAAA,GAAyC;AAG/C,MAAM,iCAAA,GAAoC;;;;"}
|
|
@@ -10,11 +10,6 @@ var EndOperation = /* @__PURE__ */ ((EndOperation2) => {
|
|
|
10
10
|
EndOperation2["InstrumentationTimeout"] = "instrumentation timeout";
|
|
11
11
|
return EndOperation2;
|
|
12
12
|
})(EndOperation || {});
|
|
13
|
-
const DEFAULT_CONFIG = {
|
|
14
|
-
consumeTimeoutMs: 1e3 * 60,
|
|
15
|
-
// 1 minute
|
|
16
|
-
useLinksForConsume: false
|
|
17
|
-
};
|
|
18
13
|
|
|
19
|
-
export {
|
|
14
|
+
export { EndOperation };
|
|
20
15
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/types.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/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/types.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/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Some types vendored from @types/amqplib with simplifications\n * - Dropped the instrumentation config and all hooks; the SDK folds origin into span creation instead\n */\n\nexport enum EndOperation {\n AutoAck = 'auto ack',\n Ack = 'ack',\n AckAll = 'ackAll',\n Reject = 'reject',\n Nack = 'nack',\n NackAll = 'nackAll',\n ChannelClosed = 'channel closed',\n ChannelError = 'channel error',\n InstrumentationTimeout = 'instrumentation timeout',\n}\n\n// The following types are vendored from `@types/amqplib@0.10.1` - commit SHA: 4205e03127692a40b4871709a7134fe4e2ed5510\n\n// Vendored from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4205e03127692a40b4871709a7134fe4e2ed5510/types/amqplib/properties.d.ts#L142\nexport interface Message {\n content: Buffer;\n fields: MessageFields;\n properties: MessageProperties;\n}\n\nexport interface ConsumeMessage extends Message {\n fields: ConsumeMessageFields;\n}\n\nexport interface CommonMessageFields {\n deliveryTag: number;\n redelivered: boolean;\n exchange: string;\n routingKey: string;\n}\n\nexport interface MessageFields extends CommonMessageFields {\n messageCount?: number;\n consumerTag?: string;\n}\n\nexport interface ConsumeMessageFields extends CommonMessageFields {\n deliveryTag: number;\n}\n\nexport interface MessageProperties {\n contentType: any | undefined;\n contentEncoding: any | undefined;\n headers: any;\n deliveryMode: any | undefined;\n priority: any | undefined;\n correlationId: any | undefined;\n replyTo: any | undefined;\n expiration: any | undefined;\n messageId: any | undefined;\n timestamp: any | undefined;\n type: any | undefined;\n userId: any | undefined;\n appId: any | undefined;\n clusterId: any | undefined;\n}\n"],"names":["EndOperation"],"mappings":"AAWO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AACL,EAAAA,cAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,cAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,cAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,cAAA,eAAA,CAAA,GAAgB,gBAAA;AAChB,EAAAA,cAAA,cAAA,CAAA,GAAe,eAAA;AACf,EAAAA,cAAA,wBAAA,CAAA,GAAyB,yBAAA;AATf,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT, ATTR_MESSAGING_SYSTEM } from './semconv.js';
|
|
5
|
-
import { ATTR_MESSAGING_URL, ATTR_MESSAGING_PROTOCOL, ATTR_MESSAGING_PROTOCOL_VERSION } from './semconv-obsolete.js';
|
|
1
|
+
import { SpanKind } from '@opentelemetry/api';
|
|
2
|
+
import { startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getTraceData } from '@sentry/core';
|
|
3
|
+
import { ATTR_MESSAGING_PROTOCOL, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT, ATTR_MESSAGING_SYSTEM, MESSAGING_DESTINATION_KIND_VALUE_TOPIC, ATTR_MESSAGING_CONVERSATION_ID, OLD_ATTR_MESSAGING_MESSAGE_ID, ATTR_MESSAGING_RABBITMQ_ROUTING_KEY, ATTR_MESSAGING_DESTINATION_KIND, ATTR_MESSAGING_DESTINATION, ATTR_MESSAGING_PROTOCOL_VERSION, MESSAGING_OPERATION_VALUE_PROCESS, ATTR_MESSAGING_OPERATION, ATTR_MESSAGING_URL } from './semconv.js';
|
|
6
4
|
|
|
5
|
+
const PUBLISHER_ORIGIN = "auto.amqplib.otel.publisher";
|
|
6
|
+
const CONSUMER_ORIGIN = "auto.amqplib.otel.consumer";
|
|
7
7
|
const MESSAGE_STORED_SPAN = /* @__PURE__ */ Symbol("opentelemetry.amqplib.message.stored-span");
|
|
8
8
|
const CHANNEL_SPANS_NOT_ENDED = /* @__PURE__ */ Symbol("opentelemetry.amqplib.channel.spans-not-ended");
|
|
9
9
|
const CHANNEL_CONSUME_TIMEOUT_TIMER = /* @__PURE__ */ Symbol(
|
|
10
10
|
"opentelemetry.amqplib.channel.consumer-timeout-timer"
|
|
11
11
|
);
|
|
12
12
|
const CONNECTION_ATTRIBUTES = /* @__PURE__ */ Symbol("opentelemetry.amqplib.connection.attributes");
|
|
13
|
-
const
|
|
13
|
+
const CHANNEL_IS_CONFIRM_PUBLISHING = /* @__PURE__ */ Symbol("sentry.amqplib.channel.is-confirm-publishing");
|
|
14
14
|
const normalizeExchange = (exchangeName) => exchangeName !== "" ? exchangeName : "<default>";
|
|
15
15
|
const censorPassword = (url) => {
|
|
16
16
|
return url.replace(/:[^:@/]*@/, ":***@");
|
|
@@ -26,16 +26,6 @@ const getProtocol = (protocolFromUrl) => {
|
|
|
26
26
|
const getHostname = (hostnameFromUrl) => {
|
|
27
27
|
return hostnameFromUrl || "localhost";
|
|
28
28
|
};
|
|
29
|
-
const extractConnectionAttributeOrLog = (url, attributeKey, attributeValue, nameForLog) => {
|
|
30
|
-
if (attributeValue) {
|
|
31
|
-
return { [attributeKey]: attributeValue };
|
|
32
|
-
} else {
|
|
33
|
-
diag.error(`amqplib instrumentation: could not extract connection attribute ${nameForLog} from user supplied url`, {
|
|
34
|
-
url
|
|
35
|
-
});
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
29
|
const getConnectionAttributesFromServer = (conn) => {
|
|
40
30
|
const product = conn.serverProperties.product?.toLowerCase?.();
|
|
41
31
|
if (product) {
|
|
@@ -46,81 +36,81 @@ const getConnectionAttributesFromServer = (conn) => {
|
|
|
46
36
|
return {};
|
|
47
37
|
}
|
|
48
38
|
};
|
|
49
|
-
const getConnectionAttributesFromUrl = (url
|
|
39
|
+
const getConnectionAttributesFromUrl = (url) => {
|
|
50
40
|
const attributes = {
|
|
51
41
|
[ATTR_MESSAGING_PROTOCOL_VERSION]: "0.9.1"
|
|
52
42
|
// this is the only protocol supported by the instrumented library
|
|
53
43
|
};
|
|
54
|
-
|
|
55
|
-
if (typeof
|
|
56
|
-
const connectOptions =
|
|
44
|
+
const resolvedUrl = url || "amqp://localhost";
|
|
45
|
+
if (typeof resolvedUrl === "object") {
|
|
46
|
+
const connectOptions = resolvedUrl;
|
|
57
47
|
const protocol = getProtocol(connectOptions?.protocol);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const hostname = getHostname(connectOptions?.hostname);
|
|
62
|
-
if (netSemconvStability & SemconvStability.OLD) {
|
|
63
|
-
Object.assign(attributes, {
|
|
64
|
-
...extractConnectionAttributeOrLog(url, ATTR_NET_PEER_NAME, hostname, "hostname")
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (netSemconvStability & SemconvStability.STABLE) {
|
|
68
|
-
Object.assign(attributes, {
|
|
69
|
-
...extractConnectionAttributeOrLog(url, ATTR_SERVER_ADDRESS, hostname, "hostname")
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const port = getPort(connectOptions.port, protocol);
|
|
73
|
-
if (netSemconvStability & SemconvStability.OLD) {
|
|
74
|
-
Object.assign(attributes, extractConnectionAttributeOrLog(url, ATTR_NET_PEER_PORT, port, "port"));
|
|
75
|
-
}
|
|
76
|
-
if (netSemconvStability & SemconvStability.STABLE) {
|
|
77
|
-
Object.assign(attributes, extractConnectionAttributeOrLog(url, ATTR_SERVER_PORT, port, "port"));
|
|
78
|
-
}
|
|
48
|
+
attributes[ATTR_MESSAGING_PROTOCOL] = protocol;
|
|
49
|
+
attributes[ATTR_NET_PEER_NAME] = getHostname(connectOptions?.hostname);
|
|
50
|
+
attributes[ATTR_NET_PEER_PORT] = getPort(connectOptions.port, protocol);
|
|
79
51
|
} else {
|
|
80
|
-
const censoredUrl = censorPassword(
|
|
52
|
+
const censoredUrl = censorPassword(resolvedUrl);
|
|
81
53
|
attributes[ATTR_MESSAGING_URL] = censoredUrl;
|
|
82
54
|
try {
|
|
83
55
|
const urlParts = new URL(censoredUrl);
|
|
84
56
|
const protocol = getProtocol(urlParts.protocol);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (netSemconvStability & SemconvStability.OLD) {
|
|
90
|
-
Object.assign(attributes, {
|
|
91
|
-
...extractConnectionAttributeOrLog(censoredUrl, ATTR_NET_PEER_NAME, hostname, "hostname")
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if (netSemconvStability & SemconvStability.STABLE) {
|
|
95
|
-
Object.assign(attributes, {
|
|
96
|
-
...extractConnectionAttributeOrLog(censoredUrl, ATTR_SERVER_ADDRESS, hostname, "hostname")
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
const port = getPort(urlParts.port ? parseInt(urlParts.port) : void 0, protocol);
|
|
100
|
-
if (netSemconvStability & SemconvStability.OLD) {
|
|
101
|
-
Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, ATTR_NET_PEER_PORT, port, "port"));
|
|
102
|
-
}
|
|
103
|
-
if (netSemconvStability & SemconvStability.STABLE) {
|
|
104
|
-
Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, ATTR_SERVER_PORT, port, "port"));
|
|
105
|
-
}
|
|
106
|
-
} catch (err) {
|
|
107
|
-
diag.error("amqplib instrumentation: error while extracting connection details from connection url", {
|
|
108
|
-
censoredUrl,
|
|
109
|
-
err
|
|
110
|
-
});
|
|
57
|
+
attributes[ATTR_MESSAGING_PROTOCOL] = protocol;
|
|
58
|
+
attributes[ATTR_NET_PEER_NAME] = getHostname(urlParts.hostname);
|
|
59
|
+
attributes[ATTR_NET_PEER_PORT] = getPort(urlParts.port ? parseInt(urlParts.port) : void 0, protocol);
|
|
60
|
+
} catch {
|
|
111
61
|
}
|
|
112
62
|
}
|
|
113
63
|
return attributes;
|
|
114
64
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
65
|
+
function getHeaderAsString(headers, key) {
|
|
66
|
+
const value = headers?.[key];
|
|
67
|
+
if (value == null) {
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
return Array.isArray(value) ? String(value[0]) : String(value);
|
|
71
|
+
}
|
|
72
|
+
function startPublishSpan(exchange, routingKey, channel, options) {
|
|
73
|
+
const normalizedExchange = normalizeExchange(exchange);
|
|
74
|
+
const span = startInactiveSpan({
|
|
75
|
+
name: `publish ${normalizedExchange}`,
|
|
76
|
+
kind: SpanKind.PRODUCER,
|
|
77
|
+
attributes: {
|
|
78
|
+
...channel.connection[CONNECTION_ATTRIBUTES],
|
|
79
|
+
[ATTR_MESSAGING_DESTINATION]: exchange,
|
|
80
|
+
[ATTR_MESSAGING_DESTINATION_KIND]: MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
|
|
81
|
+
[ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: routingKey,
|
|
82
|
+
[OLD_ATTR_MESSAGING_MESSAGE_ID]: options?.messageId,
|
|
83
|
+
[ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId,
|
|
84
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const modifiedOptions = options ?? {};
|
|
88
|
+
modifiedOptions.headers = modifiedOptions.headers ?? {};
|
|
89
|
+
const traceData = getTraceData({ span });
|
|
90
|
+
if (traceData["sentry-trace"]) {
|
|
91
|
+
modifiedOptions.headers["sentry-trace"] = traceData["sentry-trace"];
|
|
92
|
+
}
|
|
93
|
+
if (traceData.baggage) {
|
|
94
|
+
modifiedOptions.headers["baggage"] = traceData.baggage;
|
|
95
|
+
}
|
|
96
|
+
return { span, modifiedOptions };
|
|
97
|
+
}
|
|
98
|
+
function startConsumeSpan(queue, msg, channel) {
|
|
99
|
+
return startInactiveSpan({
|
|
100
|
+
name: `${queue} process`,
|
|
101
|
+
kind: SpanKind.CONSUMER,
|
|
102
|
+
attributes: {
|
|
103
|
+
...channel?.connection?.[CONNECTION_ATTRIBUTES],
|
|
104
|
+
[ATTR_MESSAGING_DESTINATION]: msg.fields?.exchange,
|
|
105
|
+
[ATTR_MESSAGING_DESTINATION_KIND]: MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
|
|
106
|
+
[ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: msg.fields?.routingKey,
|
|
107
|
+
[ATTR_MESSAGING_OPERATION]: MESSAGING_OPERATION_VALUE_PROCESS,
|
|
108
|
+
[OLD_ATTR_MESSAGING_MESSAGE_ID]: msg?.properties.messageId,
|
|
109
|
+
[ATTR_MESSAGING_CONVERSATION_ID]: msg?.properties.correlationId,
|
|
110
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
124
114
|
|
|
125
|
-
export { CHANNEL_CONSUME_TIMEOUT_TIMER, CHANNEL_SPANS_NOT_ENDED, CONNECTION_ATTRIBUTES, MESSAGE_STORED_SPAN, getConnectionAttributesFromServer, getConnectionAttributesFromUrl,
|
|
115
|
+
export { CHANNEL_CONSUME_TIMEOUT_TIMER, CHANNEL_IS_CONFIRM_PUBLISHING, CHANNEL_SPANS_NOT_ENDED, CONNECTION_ATTRIBUTES, MESSAGE_STORED_SPAN, getConnectionAttributesFromServer, getConnectionAttributesFromUrl, getHeaderAsString, normalizeExchange, startConsumeSpan, startPublishSpan };
|
|
126
116
|
//# sourceMappingURL=utils.js.map
|