@depup/sentry__node 10.47.0-depup.1 → 10.67.0-depup.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/README.md +5 -4
- package/build/cjs/debug-build.js +0 -5
- package/build/cjs/debug-build.js.map +1 -1
- package/build/cjs/index.js +81 -68
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/init.js +0 -6
- package/build/cjs/init.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/growthbook.js +0 -4
- package/build/cjs/integrations/featureFlagShims/growthbook.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/launchDarkly.js +6 -18
- package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/openFeature.js +6 -21
- package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/statsig.js +2 -8
- package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/unleash.js +2 -8
- package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/cjs/integrations/fs/index.js +17 -0
- package/build/cjs/integrations/fs/index.js.map +1 -0
- package/build/cjs/integrations/fs/vendored/constants.js +138 -0
- package/build/cjs/integrations/fs/vendored/constants.js.map +1 -0
- package/build/cjs/integrations/fs/vendored/instrumentation.js +230 -0
- package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/fs/vendored/utils.js +31 -0
- package/build/cjs/integrations/fs/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/http.js +19 -175
- package/build/cjs/integrations/http.js.map +1 -1
- package/build/cjs/integrations/node-fetch.js +10 -94
- package/build/cjs/integrations/node-fetch.js.map +1 -1
- package/build/cjs/integrations/tracing/InstrumentationNodeModuleFile.js +15 -0
- package/build/cjs/integrations/tracing/InstrumentationNodeModuleFile.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/index.js +21 -0
- package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -0
- 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 +26 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js +17 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js +129 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/anthropic-ai/index.js +3 -58
- package/build/cjs/integrations/tracing/anthropic-ai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/anthropic-ai/instrumentation.js +21 -44
- package/build/cjs/integrations/tracing/anthropic-ai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/index.js +35 -0
- package/build/cjs/integrations/tracing/connect/index.js.map +1 -0
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js +16 -0
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -0
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +137 -0
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/connect/vendored/internal-types.js +8 -0
- package/build/cjs/integrations/tracing/connect/vendored/internal-types.js.map +1 -0
- package/build/cjs/integrations/tracing/connect/vendored/utils.js +36 -0
- package/build/cjs/integrations/tracing/connect/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/dataloader/index.js +26 -0
- package/build/cjs/integrations/tracing/dataloader/index.js.map +1 -0
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js +217 -0
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/express.js +44 -147
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +19 -234
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/constants.js +1 -18
- package/build/cjs/integrations/tracing/fastify/v3/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/enums/AttributeNames.js +20 -33
- package/build/cjs/integrations/tracing/fastify/v3/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +78 -162
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/utils.js +8 -79
- package/build/cjs/integrations/tracing/fastify/v3/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js +4 -33
- package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js +7 -23
- package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +73 -215
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +86 -210
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/index.js +21 -0
- package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -0
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js +122 -0
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/google-genai/index.js +3 -58
- package/build/cjs/integrations/tracing/google-genai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js +23 -43
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/index.js +34 -0
- package/build/cjs/integrations/tracing/graphql/index.js.map +1 -0
- package/build/cjs/integrations/tracing/graphql/vendored/enum.js +47 -0
- package/build/cjs/integrations/tracing/graphql/vendored/enum.js.map +1 -0
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js +15 -0
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -0
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +329 -0
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js +6 -0
- package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js.map +1 -0
- package/build/cjs/integrations/tracing/graphql/vendored/symbols.js +8 -0
- package/build/cjs/integrations/tracing/graphql/vendored/symbols.js.map +1 -0
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js +265 -0
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/hapi/index.js +16 -91
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js +11 -0
- package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -0
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +255 -0
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js +24 -0
- package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js.map +1 -0
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js +85 -0
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/hono/constants.js +6 -7
- package/build/cjs/integrations/tracing/hono/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/index.js +26 -77
- package/build/cjs/integrations/tracing/hono/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/instrumentation.js +47 -82
- package/build/cjs/integrations/tracing/hono/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +74 -83
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/index.js +21 -0
- package/build/cjs/integrations/tracing/kafka/index.js.map +1 -0
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js +237 -0
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js +22 -0
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js +114 -0
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/knex/index.js +26 -0
- package/build/cjs/integrations/tracing/knex/index.js.map +1 -0
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +135 -0
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js +10 -0
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/knex/vendored/utils.js +84 -0
- package/build/cjs/integrations/tracing/knex/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/koa/index.js +46 -0
- package/build/cjs/integrations/tracing/koa/index.js.map +1 -0
- package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js +10 -0
- package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -0
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +127 -0
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/koa/vendored/internal-types.js +6 -0
- package/build/cjs/integrations/tracing/koa/vendored/internal-types.js.map +1 -0
- package/build/cjs/integrations/tracing/koa/vendored/types.js +10 -0
- package/build/cjs/integrations/tracing/koa/vendored/types.js.map +1 -0
- package/build/cjs/integrations/tracing/koa/vendored/utils.js +36 -0
- package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/langchain/index.js +3 -96
- package/build/cjs/integrations/tracing/langchain/index.js.map +1 -1
- package/build/cjs/integrations/tracing/langchain/instrumentation.js +80 -140
- package/build/cjs/integrations/tracing/langchain/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/langgraph/index.js +3 -73
- package/build/cjs/integrations/tracing/langgraph/index.js.map +1 -1
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js +76 -40
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/index.js +21 -0
- package/build/cjs/integrations/tracing/lrumemoizer/index.js.map +1 -0
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js +38 -0
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/index.js +21 -0
- package/build/cjs/integrations/tracing/mongo/index.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +129 -0
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js +150 -0
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js +40 -0
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/mongoose/index.js +22 -0
- package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -0
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +240 -0
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -0
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +41 -0
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql/index.js +21 -0
- package/build/cjs/integrations/tracing/mysql/index.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js +185 -0
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js +8 -0
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js +38 -0
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql2/index.js +22 -0
- package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +138 -0
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js +8 -0
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +81 -0
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/openai/index.js +3 -58
- package/build/cjs/integrations/tracing/openai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/openai/instrumentation.js +25 -49
- package/build/cjs/integrations/tracing/openai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/index.js +27 -0
- package/build/cjs/integrations/tracing/postgres/index.js.map +1 -0
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js +11 -0
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -0
- package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js +11 -0
- package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -0
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +225 -0
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +8 -0
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js +151 -0
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/postgresjs.js +77 -190
- package/build/cjs/integrations/tracing/postgresjs.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 +50 -0
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -0
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +147 -0
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +445 -0
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js +8 -0
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/tedious/index.js +21 -0
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -0
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +154 -0
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js +8 -0
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing/tedious/vendored/utils.js +29 -0
- package/build/cjs/integrations/tracing/tedious/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/vercelai/constants.js +1 -1
- package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/index.js +7 -53
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js +60 -158
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/cjs/preload.js +1 -14
- package/build/cjs/preload.js.map +1 -1
- package/build/cjs/sdk/diagnosticsChannelInjection.js +21 -0
- package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +33 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/index.js +33 -35
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/cjs/sdk/initOtel.js +74 -60
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/cjs/utils/redisCache.js +24 -52
- package/build/cjs/utils/redisCache.js.map +1 -1
- package/build/cjs/utils/setHttpServerSpanRouteAttribute.js +21 -0
- package/build/cjs/utils/setHttpServerSpanRouteAttribute.js.map +1 -0
- package/build/esm/debug-build.js +0 -5
- package/build/esm/debug-build.js.map +1 -1
- package/build/esm/index.js +24 -22
- package/build/esm/index.js.map +1 -1
- package/build/esm/init.js +0 -6
- package/build/esm/init.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/growthbook.js +0 -4
- package/build/esm/integrations/featureFlagShims/growthbook.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/launchDarkly.js +6 -18
- package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/openFeature.js +6 -21
- package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/statsig.js +2 -8
- package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/unleash.js +2 -8
- package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/esm/integrations/fs/index.js +15 -0
- package/build/esm/integrations/fs/index.js.map +1 -0
- package/build/esm/integrations/fs/vendored/constants.js +134 -0
- package/build/esm/integrations/fs/vendored/constants.js.map +1 -0
- package/build/esm/integrations/fs/vendored/instrumentation.js +228 -0
- package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/fs/vendored/utils.js +28 -0
- package/build/esm/integrations/fs/vendored/utils.js.map +1 -0
- package/build/esm/integrations/http.js +22 -176
- package/build/esm/integrations/http.js.map +1 -1
- package/build/esm/integrations/node-fetch.js +12 -95
- package/build/esm/integrations/node-fetch.js.map +1 -1
- package/build/esm/integrations/tracing/InstrumentationNodeModuleFile.js +13 -0
- package/build/esm/integrations/tracing/InstrumentationNodeModuleFile.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/index.js +18 -0
- package/build/esm/integrations/tracing/amqplib/index.js.map +1 -0
- 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 +14 -0
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/vendored/types.js +15 -0
- package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js +117 -0
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/anthropic-ai/index.js +3 -58
- package/build/esm/integrations/tracing/anthropic-ai/index.js.map +1 -1
- package/build/esm/integrations/tracing/anthropic-ai/instrumentation.js +21 -44
- package/build/esm/integrations/tracing/anthropic-ai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/connect/index.js +31 -0
- package/build/esm/integrations/tracing/connect/index.js.map +1 -0
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js +13 -0
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -0
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +135 -0
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/connect/vendored/internal-types.js +6 -0
- package/build/esm/integrations/tracing/connect/vendored/internal-types.js.map +1 -0
- package/build/esm/integrations/tracing/connect/vendored/utils.js +32 -0
- package/build/esm/integrations/tracing/connect/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/dataloader/index.js +23 -0
- package/build/esm/integrations/tracing/dataloader/index.js.map +1 -0
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js +215 -0
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/express.js +45 -148
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js +21 -235
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/constants.js +1 -18
- package/build/esm/integrations/tracing/fastify/v3/constants.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/enums/AttributeNames.js +17 -34
- package/build/esm/integrations/tracing/fastify/v3/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +74 -158
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/utils.js +8 -79
- package/build/esm/integrations/tracing/fastify/v3/utils.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js +6 -35
- package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js +7 -23
- package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +72 -214
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +86 -210
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/index.js +18 -0
- package/build/esm/integrations/tracing/genericPool/index.js.map +1 -0
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js +120 -0
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/google-genai/index.js +3 -58
- package/build/esm/integrations/tracing/google-genai/index.js.map +1 -1
- package/build/esm/integrations/tracing/google-genai/instrumentation.js +23 -43
- package/build/esm/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/index.js +31 -0
- package/build/esm/integrations/tracing/graphql/index.js.map +1 -0
- package/build/esm/integrations/tracing/graphql/vendored/enum.js +43 -0
- package/build/esm/integrations/tracing/graphql/vendored/enum.js.map +1 -0
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js +13 -0
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -0
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +327 -0
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/graphql/vendored/internal-types.js +4 -0
- package/build/esm/integrations/tracing/graphql/vendored/internal-types.js.map +1 -0
- package/build/esm/integrations/tracing/graphql/vendored/symbols.js +5 -0
- package/build/esm/integrations/tracing/graphql/vendored/symbols.js.map +1 -0
- package/build/esm/integrations/tracing/graphql/vendored/utils.js +257 -0
- package/build/esm/integrations/tracing/graphql/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/hapi/index.js +16 -91
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js +9 -0
- package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -0
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +253 -0
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/hapi/vendored/internal-types.js +19 -0
- package/build/esm/integrations/tracing/hapi/vendored/internal-types.js.map +1 -0
- package/build/esm/integrations/tracing/hapi/vendored/utils.js +76 -0
- package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/hono/constants.js +6 -7
- package/build/esm/integrations/tracing/hono/constants.js.map +1 -1
- package/build/esm/integrations/tracing/hono/index.js +22 -73
- package/build/esm/integrations/tracing/hono/index.js.map +1 -1
- package/build/esm/integrations/tracing/hono/instrumentation.js +47 -82
- package/build/esm/integrations/tracing/hono/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +20 -29
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/index.js +18 -0
- package/build/esm/integrations/tracing/kafka/index.js.map +1 -0
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js +235 -0
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js +12 -0
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/kafka/vendored/utils.js +108 -0
- package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/knex/index.js +23 -0
- package/build/esm/integrations/tracing/knex/index.js.map +1 -0
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +133 -0
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/knex/vendored/semconv.js +6 -0
- package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/knex/vendored/utils.js +75 -0
- package/build/esm/integrations/tracing/knex/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/koa/index.js +42 -0
- package/build/esm/integrations/tracing/koa/index.js.map +1 -0
- package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js +8 -0
- package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -0
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +125 -0
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/koa/vendored/internal-types.js +4 -0
- package/build/esm/integrations/tracing/koa/vendored/internal-types.js.map +1 -0
- package/build/esm/integrations/tracing/koa/vendored/types.js +8 -0
- package/build/esm/integrations/tracing/koa/vendored/types.js.map +1 -0
- package/build/esm/integrations/tracing/koa/vendored/utils.js +33 -0
- package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/langchain/index.js +3 -96
- package/build/esm/integrations/tracing/langchain/index.js.map +1 -1
- package/build/esm/integrations/tracing/langchain/instrumentation.js +80 -140
- package/build/esm/integrations/tracing/langchain/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/langgraph/index.js +3 -73
- package/build/esm/integrations/tracing/langgraph/index.js.map +1 -1
- package/build/esm/integrations/tracing/langgraph/instrumentation.js +78 -42
- package/build/esm/integrations/tracing/langgraph/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/index.js +18 -0
- package/build/esm/integrations/tracing/lrumemoizer/index.js.map +1 -0
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js +36 -0
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/index.js +18 -0
- package/build/esm/integrations/tracing/mongo/index.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +127 -0
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/vendored/patches.js +142 -0
- package/build/esm/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/vendored/utils.js +34 -0
- package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/mongoose/index.js +19 -0
- package/build/esm/integrations/tracing/mongoose/index.js.map +1 -0
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +236 -0
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -0
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js +38 -0
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/mysql/index.js +18 -0
- package/build/esm/integrations/tracing/mysql/index.js.map +1 -0
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js +183 -0
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js +5 -0
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/mysql/vendored/utils.js +33 -0
- package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/mysql2/index.js +19 -0
- package/build/esm/integrations/tracing/mysql2/index.js.map +1 -0
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +136 -0
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js +5 -0
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js +75 -0
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/openai/index.js +3 -58
- package/build/esm/integrations/tracing/openai/index.js.map +1 -1
- package/build/esm/integrations/tracing/openai/instrumentation.js +25 -49
- package/build/esm/integrations/tracing/openai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/index.js +24 -0
- package/build/esm/integrations/tracing/postgres/index.js.map +1 -0
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js +9 -0
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -0
- package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js +9 -0
- package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -0
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +223 -0
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js +5 -0
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/postgres/vendored/utils.js +136 -0
- package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/postgresjs.js +77 -190
- package/build/esm/integrations/tracing/postgresjs.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 +43 -0
- package/build/esm/integrations/tracing/redis/index.js.map +1 -0
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +145 -0
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +443 -0
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/redis/vendored/semconv.js +5 -0
- package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/tedious/index.js +18 -0
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -0
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +152 -0
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js +5 -0
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/tracing/tedious/vendored/utils.js +26 -0
- package/build/esm/integrations/tracing/tedious/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/vercelai/constants.js +1 -1
- package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js +8 -54
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/instrumentation.js +60 -158
- package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/preload.js +1 -14
- package/build/esm/preload.js.map +1 -1
- package/build/esm/sdk/diagnosticsChannelInjection.js +17 -0
- package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +30 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/index.js +33 -36
- package/build/esm/sdk/index.js.map +1 -1
- package/build/esm/sdk/initOtel.js +77 -63
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/esm/utils/redisCache.js +24 -52
- package/build/esm/utils/redisCache.js.map +1 -1
- package/build/esm/utils/setHttpServerSpanRouteAttribute.js +19 -0
- package/build/esm/utils/setHttpServerSpanRouteAttribute.js.map +1 -0
- package/build/import-hook.mjs +6 -0
- package/build/types/index.d.ts +6 -4
- 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 +14 -0
- package/build/types/integrations/fs/index.d.ts.map +1 -0
- package/build/types/integrations/fs/vendored/constants.d.ts +5 -0
- package/build/types/integrations/fs/vendored/constants.d.ts.map +1 -0
- package/build/types/integrations/fs/vendored/instrumentation.d.ts +3 -0
- package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/fs/vendored/types.d.ts +23 -0
- package/build/types/integrations/fs/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/fs/vendored/utils.d.ts +10 -0
- package/build/types/integrations/fs/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/http.d.ts +12 -17
- package/build/types/integrations/http.d.ts.map +1 -1
- package/build/types/integrations/node-fetch.d.ts +8 -35
- package/build/types/integrations/node-fetch.d.ts.map +1 -1
- package/build/types/integrations/tracing/InstrumentationNodeModuleFile.d.ts +9 -0
- package/build/types/integrations/tracing/InstrumentationNodeModuleFile.d.ts.map +1 -0
- package/build/types/integrations/tracing/{amqplib.d.ts → amqplib/index.d.ts} +5 -3
- package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/vendored/amqplib-types.d.ts +44 -0
- package/build/types/integrations/tracing/amqplib/vendored/amqplib-types.d.ts.map +1 -0
- 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 +23 -0
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts +49 -0
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts +42 -0
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts +11 -8
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/{connect.d.ts → connect/index.d.ts} +5 -3
- package/build/types/integrations/tracing/connect/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +9 -0
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts +18 -0
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts +31 -0
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts +5 -0
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/{dataloader.d.ts → dataloader/index.d.ts} +5 -3
- package/build/types/integrations/tracing/dataloader/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts +18 -0
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/dataloader/vendored/types.d.ts +22 -0
- package/build/types/integrations/tracing/dataloader/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/express.d.ts +15 -68
- 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.d.ts → genericPool/index.d.ts} +5 -3
- package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/genericPool/vendored/generic-pool-types.d.ts +5 -0
- package/build/types/integrations/tracing/genericPool/vendored/generic-pool-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts +11 -0
- package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/google-genai/index.d.ts +11 -8
- package/build/types/integrations/tracing/google-genai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/google-genai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/{graphql.d.ts → graphql/index.d.ts} +5 -3
- package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/enum.d.ts +38 -0
- package/build/types/integrations/tracing/graphql/vendored/enum.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +10 -0
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/graphql-types.d.ts +2 -0
- package/build/types/integrations/tracing/graphql/vendored/graphql-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts +25 -0
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts +63 -0
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts +3 -0
- package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts +33 -0
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts +14 -0
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/hapi/index.d.ts +4 -2
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts +6 -0
- package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/hapi/vendored/hapi-types.d.ts +70 -0
- package/build/types/integrations/tracing/hapi/vendored/hapi-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts +72 -0
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts +32 -0
- package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts +18 -0
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/hono/index.d.ts +9 -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.d.ts → kafka/index.d.ts} +5 -3
- package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts +15 -0
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +79 -0
- package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts +54 -0
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/{knex.d.ts → knex/index.d.ts} +5 -3
- package/build/types/integrations/tracing/knex/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts +12 -0
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +7 -0
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts +9 -0
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/{koa.d.ts → koa/index.d.ts} +5 -3
- package/build/types/integrations/tracing/koa/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts +5 -0
- package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts +32 -0
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts +34 -0
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/koa/vendored/types.d.ts +13 -0
- package/build/types/integrations/tracing/koa/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts +15 -0
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/langchain/index.d.ts +16 -12
- package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langchain/instrumentation.d.ts +10 -1
- package/build/types/integrations/tracing/langchain/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts +11 -8
- package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts +1 -1
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/{lrumemoizer.d.ts → lrumemoizer/index.d.ts} +5 -3
- package/build/types/integrations/tracing/lrumemoizer/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts +6 -0
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -0
- package/build/{types-ts3.8/integrations/tracing/mongo.d.ts → types/integrations/tracing/mongo/index.d.ts} +22 -24
- package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts +11 -0
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts +62 -0
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types/integrations/tracing/mongo/vendored/patches.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts +15 -0
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/{mongoose.d.ts → mongoose/index.d.ts} +5 -3
- package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +33 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts +18 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts +4 -0
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/{mysql.d.ts → mysql/index.d.ts} +5 -3
- package/build/types/integrations/tracing/mysql/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts +14 -0
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts +78 -0
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts +19 -0
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts +22 -0
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/{mysql2.d.ts → mysql2/index.d.ts} +5 -3
- package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts +9 -0
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql2/vendored/mysql2-types.d.ts +39 -0
- package/build/types/integrations/tracing/mysql2/vendored/mysql2-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts +3 -0
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts +25 -0
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/openai/index.d.ts +11 -8
- package/build/types/integrations/tracing/openai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/{postgres.d.ts → postgres/index.d.ts} +5 -3
- package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +6 -0
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts +6 -0
- package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts +12 -0
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts +33 -0
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts +20 -0
- package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts +54 -0
- package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +13 -0
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts +11 -0
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts +56 -0
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -0
- 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/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 +28 -0
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +10 -0
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts +16 -0
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts +4 -0
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/redis/vendored/types.d.ts +24 -0
- package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/{tedious.d.ts → tedious/index.d.ts} +5 -3
- package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts +11 -0
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts +19 -0
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing/tedious/vendored/tedious-types.d.ts +21 -0
- package/build/types/integrations/tracing/tedious/vendored/tedious-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/tedious/vendored/utils.d.ts +9 -0
- package/build/types/integrations/tracing/tedious/vendored/utils.d.ts.map +1 -0
- 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/integrations/tracing/vercelai/instrumentation.d.ts +2 -2
- package/build/types/integrations/tracing/vercelai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/types.d.ts +11 -4
- package/build/types/integrations/tracing/vercelai/types.d.ts.map +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +37 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/index.d.ts +18 -0
- package/build/types/sdk/index.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/utils/redisCache.d.ts +1 -1
- package/build/types/utils/redisCache.d.ts.map +1 -1
- package/build/types/utils/setHttpServerSpanRouteAttribute.d.ts +9 -0
- package/build/types/utils/setHttpServerSpanRouteAttribute.d.ts.map +1 -0
- package/build/types-ts3.8/index.d.ts +6 -4
- 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 +14 -0
- package/build/types-ts3.8/integrations/fs/vendored/constants.d.ts +5 -0
- package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +3 -0
- package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +23 -0
- package/build/types-ts3.8/integrations/fs/vendored/utils.d.ts +15 -0
- package/build/types-ts3.8/integrations/http.d.ts +12 -17
- package/build/types-ts3.8/integrations/node-fetch.d.ts +8 -35
- package/build/types-ts3.8/integrations/tracing/InstrumentationNodeModuleFile.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing/{amqplib.d.ts → amqplib/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/amqplib-types.d.ts +44 -0
- 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 +23 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/types.d.ts +49 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/utils.d.ts +42 -0
- package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +11 -8
- package/build/types-ts3.8/integrations/tracing/{connect.d.ts → connect/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing/connect/vendored/instrumentation.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing/connect/vendored/internal-types.d.ts +36 -0
- package/build/types-ts3.8/integrations/tracing/connect/vendored/utils.d.ts +5 -0
- package/build/types-ts3.8/integrations/tracing/{dataloader.d.ts → dataloader/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/dataloader/vendored/instrumentation.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing/dataloader/vendored/types.d.ts +22 -0
- package/build/types-ts3.8/integrations/tracing/express.d.ts +15 -68
- 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.d.ts → genericPool/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/genericPool/vendored/generic-pool-types.d.ts +5 -0
- package/build/types-ts3.8/integrations/tracing/genericPool/vendored/instrumentation.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/google-genai/index.d.ts +11 -8
- package/build/types-ts3.8/integrations/tracing/{graphql.d.ts → graphql/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/enum.d.ts +38 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/graphql-types.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/instrumentation.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/internal-types.d.ts +63 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/symbols.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/types.d.ts +33 -0
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/utils.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing/hapi/index.d.ts +4 -2
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/hapi-types.d.ts +70 -0
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/instrumentation.d.ts +72 -0
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/internal-types.d.ts +32 -0
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/utils.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +9 -1
- package/build/types-ts3.8/integrations/tracing/{kafka.d.ts → kafka/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/instrumentation.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +79 -0
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/semconv.d.ts +54 -0
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
- package/build/types-ts3.8/integrations/tracing/{knex.d.ts → knex/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/knex/vendored/instrumentation.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +7 -0
- package/build/types-ts3.8/integrations/tracing/knex/vendored/utils.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing/{koa.d.ts → koa/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts +5 -0
- package/build/types-ts3.8/integrations/tracing/koa/vendored/instrumentation.d.ts +32 -0
- package/build/types-ts3.8/integrations/tracing/koa/vendored/internal-types.d.ts +34 -0
- package/build/types-ts3.8/integrations/tracing/koa/vendored/types.d.ts +13 -0
- package/build/types-ts3.8/integrations/tracing/koa/vendored/utils.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +16 -12
- package/build/types-ts3.8/integrations/tracing/langchain/instrumentation.d.ts +10 -1
- package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +11 -8
- package/build/types-ts3.8/integrations/tracing/langgraph/instrumentation.d.ts +1 -1
- package/build/types-ts3.8/integrations/tracing/{lrumemoizer.d.ts → lrumemoizer/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts +6 -0
- package/build/{types/integrations/tracing/mongo.d.ts → types-ts3.8/integrations/tracing/mongo/index.d.ts} +22 -24
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/instrumentation.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/internal-types.d.ts +62 -0
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/utils.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/{mongoose.d.ts → mongoose/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +33 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/utils.d.ts +4 -0
- package/build/types-ts3.8/integrations/tracing/{mysql.d.ts → mysql/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/instrumentation.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/mysql-types.d.ts +78 -0
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/semconv.d.ts +19 -0
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/utils.d.ts +22 -0
- package/build/types-ts3.8/integrations/tracing/{mysql2.d.ts → mysql2/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/instrumentation.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/mysql2-types.d.ts +39 -0
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/semconv.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/utils.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +11 -8
- package/build/types-ts3.8/integrations/tracing/{postgres.d.ts → postgres/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/instrumentation.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/internal-types.d.ts +33 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/pg-pool-types.d.ts +20 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/pg-types.d.ts +54 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +13 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/types.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/utils.d.ts +56 -0
- package/build/types-ts3.8/integrations/tracing/postgresjs.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/redis/cache.d.ts +22 -0
- package/build/types-ts3.8/integrations/tracing/redis/index.d.ts +28 -0
- package/build/types-ts3.8/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing/redis/vendored/redis-instrumentation.d.ts +16 -0
- package/build/types-ts3.8/integrations/tracing/redis/vendored/semconv.d.ts +4 -0
- package/build/types-ts3.8/integrations/tracing/redis/vendored/types.d.ts +24 -0
- package/build/types-ts3.8/integrations/tracing/{tedious.d.ts → tedious/index.d.ts} +5 -3
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/instrumentation.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/semconv.d.ts +19 -0
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/tedious-types.d.ts +21 -0
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/utils.d.ts +9 -0
- 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/integrations/tracing/vercelai/instrumentation.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/vercelai/types.d.ts +11 -4
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +37 -0
- package/build/types-ts3.8/sdk/index.d.ts +18 -0
- package/build/types-ts3.8/sdk/initOtel.d.ts +3 -4
- package/build/types-ts3.8/utils/redisCache.d.ts +1 -1
- package/build/types-ts3.8/utils/setHttpServerSpanRouteAttribute.d.ts +9 -0
- package/changes.json +9 -5
- package/package.json +33 -41
- package/build/cjs/integrations/fs.js +0 -142
- package/build/cjs/integrations/fs.js.map +0 -1
- package/build/cjs/integrations/tracing/amqplib.js +0 -47
- package/build/cjs/integrations/tracing/amqplib.js.map +0 -1
- package/build/cjs/integrations/tracing/connect.js +0 -110
- package/build/cjs/integrations/tracing/connect.js.map +0 -1
- package/build/cjs/integrations/tracing/dataloader.js +0 -72
- package/build/cjs/integrations/tracing/dataloader.js.map +0 -1
- package/build/cjs/integrations/tracing/genericPool.js +0 -59
- package/build/cjs/integrations/tracing/genericPool.js.map +0 -1
- package/build/cjs/integrations/tracing/graphql.js +0 -127
- package/build/cjs/integrations/tracing/graphql.js.map +0 -1
- package/build/cjs/integrations/tracing/kafka.js +0 -48
- package/build/cjs/integrations/tracing/kafka.js.map +0 -1
- package/build/cjs/integrations/tracing/knex.js +0 -57
- package/build/cjs/integrations/tracing/knex.js.map +0 -1
- package/build/cjs/integrations/tracing/koa.js +0 -138
- package/build/cjs/integrations/tracing/koa.js.map +0 -1
- package/build/cjs/integrations/tracing/lrumemoizer.js +0 -37
- package/build/cjs/integrations/tracing/lrumemoizer.js.map +0 -1
- package/build/cjs/integrations/tracing/mongo.js +0 -93
- package/build/cjs/integrations/tracing/mongo.js.map +0 -1
- package/build/cjs/integrations/tracing/mongoose.js +0 -46
- package/build/cjs/integrations/tracing/mongoose.js.map +0 -1
- package/build/cjs/integrations/tracing/mysql.js +0 -38
- package/build/cjs/integrations/tracing/mysql.js.map +0 -1
- package/build/cjs/integrations/tracing/mysql2.js +0 -46
- package/build/cjs/integrations/tracing/mysql2.js.map +0 -1
- package/build/cjs/integrations/tracing/postgres.js +0 -48
- package/build/cjs/integrations/tracing/postgres.js.map +0 -1
- package/build/cjs/integrations/tracing/prisma.js +0 -203
- package/build/cjs/integrations/tracing/prisma.js.map +0 -1
- package/build/cjs/integrations/tracing/redis.js +0 -121
- package/build/cjs/integrations/tracing/redis.js.map +0 -1
- package/build/cjs/integrations/tracing/tedious.js +0 -67
- package/build/cjs/integrations/tracing/tedious.js.map +0 -1
- package/build/esm/integrations/fs.js +0 -140
- package/build/esm/integrations/fs.js.map +0 -1
- package/build/esm/integrations/tracing/amqplib.js +0 -44
- package/build/esm/integrations/tracing/amqplib.js.map +0 -1
- package/build/esm/integrations/tracing/connect.js +0 -106
- package/build/esm/integrations/tracing/connect.js.map +0 -1
- package/build/esm/integrations/tracing/dataloader.js +0 -69
- package/build/esm/integrations/tracing/dataloader.js.map +0 -1
- package/build/esm/integrations/tracing/genericPool.js +0 -56
- package/build/esm/integrations/tracing/genericPool.js.map +0 -1
- package/build/esm/integrations/tracing/graphql.js +0 -124
- package/build/esm/integrations/tracing/graphql.js.map +0 -1
- package/build/esm/integrations/tracing/kafka.js +0 -45
- package/build/esm/integrations/tracing/kafka.js.map +0 -1
- package/build/esm/integrations/tracing/knex.js +0 -54
- package/build/esm/integrations/tracing/knex.js.map +0 -1
- package/build/esm/integrations/tracing/koa.js +0 -134
- package/build/esm/integrations/tracing/koa.js.map +0 -1
- package/build/esm/integrations/tracing/lrumemoizer.js +0 -34
- package/build/esm/integrations/tracing/lrumemoizer.js.map +0 -1
- package/build/esm/integrations/tracing/mongo.js +0 -89
- package/build/esm/integrations/tracing/mongo.js.map +0 -1
- package/build/esm/integrations/tracing/mongoose.js +0 -43
- package/build/esm/integrations/tracing/mongoose.js.map +0 -1
- package/build/esm/integrations/tracing/mysql.js +0 -35
- package/build/esm/integrations/tracing/mysql.js.map +0 -1
- package/build/esm/integrations/tracing/mysql2.js +0 -43
- package/build/esm/integrations/tracing/mysql2.js.map +0 -1
- package/build/esm/integrations/tracing/postgres.js +0 -45
- package/build/esm/integrations/tracing/postgres.js.map +0 -1
- package/build/esm/integrations/tracing/prisma.js +0 -200
- package/build/esm/integrations/tracing/prisma.js.map +0 -1
- package/build/esm/integrations/tracing/redis.js +0 -117
- package/build/esm/integrations/tracing/redis.js.map +0 -1
- package/build/esm/integrations/tracing/tedious.js +0 -64
- package/build/esm/integrations/tracing/tedious.js.map +0 -1
- package/build/types/integrations/fs.d.ts +0 -24
- package/build/types/integrations/fs.d.ts.map +0 -1
- package/build/types/integrations/tracing/amqplib.d.ts.map +0 -1
- package/build/types/integrations/tracing/connect.d.ts.map +0 -1
- package/build/types/integrations/tracing/dataloader.d.ts.map +0 -1
- package/build/types/integrations/tracing/genericPool.d.ts.map +0 -1
- package/build/types/integrations/tracing/graphql.d.ts.map +0 -1
- package/build/types/integrations/tracing/kafka.d.ts.map +0 -1
- package/build/types/integrations/tracing/knex.d.ts.map +0 -1
- package/build/types/integrations/tracing/koa.d.ts.map +0 -1
- package/build/types/integrations/tracing/lrumemoizer.d.ts.map +0 -1
- package/build/types/integrations/tracing/mongo.d.ts.map +0 -1
- package/build/types/integrations/tracing/mongoose.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql2.d.ts.map +0 -1
- package/build/types/integrations/tracing/postgres.d.ts.map +0 -1
- package/build/types/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts +0 -38
- package/build/types/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts.map +0 -1
- package/build/types/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts +0 -31
- package/build/types/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts.map +0 -1
- package/build/types/integrations/tracing/prisma.d.ts +0 -50
- package/build/types/integrations/tracing/prisma.d.ts.map +0 -1
- package/build/types/integrations/tracing/redis.d.ts +0 -41
- package/build/types/integrations/tracing/redis.d.ts.map +0 -1
- package/build/types/integrations/tracing/tedious.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/fs.d.ts +0 -24
- package/build/types-ts3.8/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts +0 -44
- package/build/types-ts3.8/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts +0 -34
- package/build/types-ts3.8/integrations/tracing/prisma.d.ts +0 -50
- package/build/types-ts3.8/integrations/tracing/redis.d.ts +0 -41
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { MESSAGING_BATCH_MESSAGE_COUNT } from '@sentry/conventions/attributes';
|
|
3
|
+
import { SDK_VERSION, continueTrace, withActiveSpan, startNewTrace, startInactiveSpan, SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';
|
|
4
|
+
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE } from './semconv.js';
|
|
5
|
+
import { getHeaderAsString, startConsumerSpan, endSpansOnPromise, getLinksFromHeaders, startProducerSpan } from './utils.js';
|
|
6
|
+
|
|
7
|
+
const PACKAGE_NAME = "@sentry/instrumentation-kafkajs";
|
|
8
|
+
class KafkaJsInstrumentation extends InstrumentationBase {
|
|
9
|
+
constructor(config = {}) {
|
|
10
|
+
super(PACKAGE_NAME, SDK_VERSION, config);
|
|
11
|
+
}
|
|
12
|
+
init() {
|
|
13
|
+
const unpatch = (moduleExports) => {
|
|
14
|
+
if (isWrapped(moduleExports?.Kafka?.prototype.producer)) {
|
|
15
|
+
this._unwrap(moduleExports.Kafka.prototype, "producer");
|
|
16
|
+
}
|
|
17
|
+
if (isWrapped(moduleExports?.Kafka?.prototype.consumer)) {
|
|
18
|
+
this._unwrap(moduleExports.Kafka.prototype, "consumer");
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const module = new InstrumentationNodeModuleDefinition(
|
|
22
|
+
"kafkajs",
|
|
23
|
+
[">=0.3.0 <3"],
|
|
24
|
+
(moduleExports) => {
|
|
25
|
+
unpatch(moduleExports);
|
|
26
|
+
this._wrap(moduleExports?.Kafka?.prototype, "producer", this._getProducerPatch());
|
|
27
|
+
this._wrap(moduleExports?.Kafka?.prototype, "consumer", this._getConsumerPatch());
|
|
28
|
+
return moduleExports;
|
|
29
|
+
},
|
|
30
|
+
unpatch
|
|
31
|
+
);
|
|
32
|
+
return module;
|
|
33
|
+
}
|
|
34
|
+
_getConsumerPatch() {
|
|
35
|
+
const instrumentation = this;
|
|
36
|
+
return (original) => {
|
|
37
|
+
return function consumer(...args) {
|
|
38
|
+
const newConsumer = original.apply(this, args);
|
|
39
|
+
if (isWrapped(newConsumer.run)) {
|
|
40
|
+
instrumentation._unwrap(newConsumer, "run");
|
|
41
|
+
}
|
|
42
|
+
instrumentation._wrap(newConsumer, "run", instrumentation._getConsumerRunPatch());
|
|
43
|
+
return newConsumer;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
_getProducerPatch() {
|
|
48
|
+
const instrumentation = this;
|
|
49
|
+
return (original) => {
|
|
50
|
+
return function consumer(...args) {
|
|
51
|
+
const newProducer = original.apply(this, args);
|
|
52
|
+
if (isWrapped(newProducer.sendBatch)) {
|
|
53
|
+
instrumentation._unwrap(newProducer, "sendBatch");
|
|
54
|
+
}
|
|
55
|
+
instrumentation._wrap(newProducer, "sendBatch", instrumentation._getSendBatchPatch());
|
|
56
|
+
if (isWrapped(newProducer.send)) {
|
|
57
|
+
instrumentation._unwrap(newProducer, "send");
|
|
58
|
+
}
|
|
59
|
+
instrumentation._wrap(newProducer, "send", instrumentation._getSendPatch());
|
|
60
|
+
if (isWrapped(newProducer.transaction)) {
|
|
61
|
+
instrumentation._unwrap(newProducer, "transaction");
|
|
62
|
+
}
|
|
63
|
+
instrumentation._wrap(newProducer, "transaction", instrumentation._getProducerTransactionPatch());
|
|
64
|
+
return newProducer;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
_getConsumerRunPatch() {
|
|
69
|
+
const instrumentation = this;
|
|
70
|
+
return (original) => {
|
|
71
|
+
return function run(...args) {
|
|
72
|
+
const config = args[0];
|
|
73
|
+
if (config?.eachMessage) {
|
|
74
|
+
if (isWrapped(config.eachMessage)) {
|
|
75
|
+
instrumentation._unwrap(config, "eachMessage");
|
|
76
|
+
}
|
|
77
|
+
instrumentation._wrap(config, "eachMessage", instrumentation._getConsumerEachMessagePatch());
|
|
78
|
+
}
|
|
79
|
+
if (config?.eachBatch) {
|
|
80
|
+
if (isWrapped(config.eachBatch)) {
|
|
81
|
+
instrumentation._unwrap(config, "eachBatch");
|
|
82
|
+
}
|
|
83
|
+
instrumentation._wrap(config, "eachBatch", instrumentation._getConsumerEachBatchPatch());
|
|
84
|
+
}
|
|
85
|
+
return original.call(this, config);
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
_getConsumerEachMessagePatch() {
|
|
90
|
+
return (original) => {
|
|
91
|
+
return function eachMessage(...args) {
|
|
92
|
+
const payload = args[0];
|
|
93
|
+
const sentryTrace = getHeaderAsString(payload.message.headers, "sentry-trace");
|
|
94
|
+
const baggage = getHeaderAsString(payload.message.headers, "baggage");
|
|
95
|
+
return continueTrace({ sentryTrace, baggage }, () => {
|
|
96
|
+
const span = startConsumerSpan({
|
|
97
|
+
topic: payload.topic,
|
|
98
|
+
message: payload.message,
|
|
99
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
100
|
+
attributes: {
|
|
101
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition)
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const eachMessagePromise = withActiveSpan(span, () => {
|
|
105
|
+
return original.apply(this, args);
|
|
106
|
+
});
|
|
107
|
+
return endSpansOnPromise([span], eachMessagePromise);
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
_getConsumerEachBatchPatch() {
|
|
113
|
+
return (original) => {
|
|
114
|
+
return function eachBatch(...args) {
|
|
115
|
+
const payload = args[0];
|
|
116
|
+
const receivingSpan = startNewTrace(
|
|
117
|
+
() => startConsumerSpan({
|
|
118
|
+
topic: payload.batch.topic,
|
|
119
|
+
message: void 0,
|
|
120
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,
|
|
121
|
+
attributes: {
|
|
122
|
+
[MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
|
|
123
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
return withActiveSpan(receivingSpan, () => {
|
|
128
|
+
const spans = [receivingSpan];
|
|
129
|
+
payload.batch.messages.forEach((message) => {
|
|
130
|
+
spans.push(
|
|
131
|
+
startConsumerSpan({
|
|
132
|
+
topic: payload.batch.topic,
|
|
133
|
+
message,
|
|
134
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
135
|
+
links: getLinksFromHeaders(message.headers),
|
|
136
|
+
attributes: {
|
|
137
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
const batchMessagePromise = original.apply(this, args);
|
|
143
|
+
return endSpansOnPromise(spans, batchMessagePromise);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
_getProducerTransactionPatch() {
|
|
149
|
+
const instrumentation = this;
|
|
150
|
+
return (original) => {
|
|
151
|
+
return function transaction(...args) {
|
|
152
|
+
const transactionSpan = startInactiveSpan({ name: "transaction" });
|
|
153
|
+
const transactionPromise = original.apply(this, args);
|
|
154
|
+
transactionPromise.then((transaction2) => {
|
|
155
|
+
const originalSend = transaction2.send;
|
|
156
|
+
transaction2.send = function send(...args2) {
|
|
157
|
+
return withActiveSpan(transactionSpan, () => {
|
|
158
|
+
const patched = instrumentation._getSendPatch()(originalSend);
|
|
159
|
+
return patched.apply(this, args2).catch((err) => {
|
|
160
|
+
transactionSpan.setStatus({
|
|
161
|
+
code: SPAN_STATUS_ERROR,
|
|
162
|
+
message: err?.message
|
|
163
|
+
});
|
|
164
|
+
throw err;
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
const originalSendBatch = transaction2.sendBatch;
|
|
169
|
+
transaction2.sendBatch = function sendBatch(...args2) {
|
|
170
|
+
return withActiveSpan(transactionSpan, () => {
|
|
171
|
+
const patched = instrumentation._getSendBatchPatch()(originalSendBatch);
|
|
172
|
+
return patched.apply(this, args2).catch((err) => {
|
|
173
|
+
transactionSpan.setStatus({
|
|
174
|
+
code: SPAN_STATUS_ERROR,
|
|
175
|
+
message: err?.message
|
|
176
|
+
});
|
|
177
|
+
throw err;
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const originalCommit = transaction2.commit;
|
|
182
|
+
transaction2.commit = function commit(...args2) {
|
|
183
|
+
const originCommitPromise = originalCommit.apply(this, args2).then(() => {
|
|
184
|
+
transactionSpan.setStatus({ code: SPAN_STATUS_OK });
|
|
185
|
+
});
|
|
186
|
+
return endSpansOnPromise([transactionSpan], originCommitPromise);
|
|
187
|
+
};
|
|
188
|
+
const originalAbort = transaction2.abort;
|
|
189
|
+
transaction2.abort = function abort(...args2) {
|
|
190
|
+
const originAbortPromise = originalAbort.apply(this, args2);
|
|
191
|
+
return endSpansOnPromise([transactionSpan], originAbortPromise);
|
|
192
|
+
};
|
|
193
|
+
}).catch((err) => {
|
|
194
|
+
transactionSpan.setStatus({
|
|
195
|
+
code: SPAN_STATUS_ERROR,
|
|
196
|
+
message: err?.message
|
|
197
|
+
});
|
|
198
|
+
transactionSpan.end();
|
|
199
|
+
});
|
|
200
|
+
return transactionPromise;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
_getSendBatchPatch() {
|
|
205
|
+
return (original) => {
|
|
206
|
+
return function sendBatch(...args) {
|
|
207
|
+
const batch = args[0];
|
|
208
|
+
const messages = batch.topicMessages || [];
|
|
209
|
+
const spans = [];
|
|
210
|
+
messages.forEach((topicMessage) => {
|
|
211
|
+
topicMessage.messages.forEach((message) => {
|
|
212
|
+
spans.push(startProducerSpan(topicMessage.topic, message));
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
const origSendResult = original.apply(this, args);
|
|
216
|
+
return endSpansOnPromise(spans, origSendResult);
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
_getSendPatch() {
|
|
221
|
+
return (original) => {
|
|
222
|
+
return function send(...args) {
|
|
223
|
+
const record = args[0];
|
|
224
|
+
const spans = record.messages.map((message) => {
|
|
225
|
+
return startProducerSpan(record.topic, message);
|
|
226
|
+
});
|
|
227
|
+
const origSendResult = original.apply(this, args);
|
|
228
|
+
return endSpansOnPromise(spans, origSendResult);
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export { KafkaJsInstrumentation };
|
|
235
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Some types vendored from kafkajs with simplifications\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n * - Cross-broker trace propagation uses Sentry's `getTraceData`/`continueTrace` instead of the OTel\n * propagator, so the vendored `bufferTextMapGetter` propagator is gone\n * - Dropped the OTel metrics (no MeterProvider is wired up) and, with them, the `network.request`\n * event listeners they relied on; origin is folded into span creation instead of `index.ts` hooks\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { MESSAGING_BATCH_MESSAGE_COUNT } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport {\n continueTrace,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n SPAN_STATUS_OK,\n startInactiveSpan,\n startNewTrace,\n withActiveSpan,\n} from '@sentry/core';\nimport type {\n Consumer,\n ConsumerRunConfig,\n EachBatchHandler,\n EachMessageHandler,\n Kafka,\n KafkaMessage,\n Producer,\n RecordMetadata,\n Transaction,\n} from './kafkajs-types';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n} from './semconv';\nimport {\n endSpansOnPromise,\n getHeaderAsString,\n getLinksFromHeaders,\n startConsumerSpan,\n startProducerSpan,\n} from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-kafkajs';\n\nexport class KafkaJsInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition {\n const unpatch = (moduleExports: any): void => {\n if (isWrapped(moduleExports?.Kafka?.prototype.producer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'producer');\n }\n if (isWrapped(moduleExports?.Kafka?.prototype.consumer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'consumer');\n }\n };\n\n const module = new InstrumentationNodeModuleDefinition(\n 'kafkajs',\n ['>=0.3.0 <3'],\n (moduleExports: any) => {\n unpatch(moduleExports);\n this._wrap(moduleExports?.Kafka?.prototype, 'producer', this._getProducerPatch());\n this._wrap(moduleExports?.Kafka?.prototype, 'consumer', this._getConsumerPatch());\n\n return moduleExports;\n },\n unpatch,\n );\n return module;\n }\n\n private _getConsumerPatch() {\n const instrumentation = this;\n return (original: Kafka['consumer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['consumer']>) {\n const newConsumer: Consumer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newConsumer.run)) {\n instrumentation._unwrap(newConsumer, 'run');\n }\n\n instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());\n\n return newConsumer;\n };\n };\n }\n\n private _getProducerPatch() {\n const instrumentation = this;\n return (original: Kafka['producer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['producer']>) {\n const newProducer: Producer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.sendBatch)) {\n instrumentation._unwrap(newProducer, 'sendBatch');\n }\n instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.send)) {\n instrumentation._unwrap(newProducer, 'send');\n }\n instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.transaction)) {\n instrumentation._unwrap(newProducer, 'transaction');\n }\n instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());\n\n return newProducer;\n };\n };\n }\n\n private _getConsumerRunPatch() {\n const instrumentation = this;\n return (original: Consumer['run']) => {\n return function run(this: Consumer, ...args: Parameters<Consumer['run']>): ReturnType<Consumer['run']> {\n const config = args[0];\n if (config?.eachMessage) {\n if (isWrapped(config.eachMessage)) {\n instrumentation._unwrap(config, 'eachMessage');\n }\n instrumentation._wrap(config, 'eachMessage', instrumentation._getConsumerEachMessagePatch());\n }\n if (config?.eachBatch) {\n if (isWrapped(config.eachBatch)) {\n instrumentation._unwrap(config, 'eachBatch');\n }\n instrumentation._wrap(config, 'eachBatch', instrumentation._getConsumerEachBatchPatch());\n }\n return original.call(this, config);\n };\n };\n }\n\n private _getConsumerEachMessagePatch() {\n return (original: ConsumerRunConfig['eachMessage']) => {\n return function eachMessage(this: unknown, ...args: Parameters<EachMessageHandler>): Promise<void> {\n const payload = args[0];\n const sentryTrace = getHeaderAsString(payload.message.headers, 'sentry-trace');\n const baggage = getHeaderAsString(payload.message.headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n return continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const eachMessagePromise = withActiveSpan(span, () => {\n return original!.apply(this, args);\n });\n return endSpansOnPromise([span], eachMessagePromise);\n });\n };\n };\n }\n\n private _getConsumerEachBatchPatch() {\n return (original: ConsumerRunConfig['eachBatch']) => {\n return function eachBatch(this: unknown, ...args: Parameters<EachBatchHandler>): Promise<void> {\n const payload = args[0];\n // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#topic-with-multiple-consumers\n // A batch pull aggregates messages from many producers, so the receiving span is a fresh root\n // trace and each processed message links back to its own producer span.\n const receivingSpan = startNewTrace(() =>\n startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n attributes: {\n [MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n\n return withActiveSpan(receivingSpan, () => {\n const spans: Span[] = [receivingSpan];\n payload.batch.messages.forEach((message: KafkaMessage) => {\n spans.push(\n startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n links: getLinksFromHeaders(message.headers),\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n });\n const batchMessagePromise: Promise<void> = original!.apply(this, args);\n return endSpansOnPromise(spans, batchMessagePromise);\n });\n };\n };\n }\n\n private _getProducerTransactionPatch() {\n const instrumentation = this;\n return (original: Producer['transaction']) => {\n return function transaction(\n this: Producer,\n ...args: Parameters<Producer['transaction']>\n ): ReturnType<Producer['transaction']> {\n const transactionSpan = startInactiveSpan({ name: 'transaction' });\n\n const transactionPromise = original.apply(this, args);\n\n transactionPromise\n .then((transaction: Transaction) => {\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSend = transaction.send;\n transaction.send = function send(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendPatch()(originalSend);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSendBatch = transaction.sendBatch;\n transaction.sendBatch = function sendBatch(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendBatchPatch()(originalSendBatch);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalCommit = transaction.commit;\n transaction.commit = function commit(this: Transaction, ...args) {\n const originCommitPromise = originalCommit.apply(this, args).then(() => {\n transactionSpan.setStatus({ code: SPAN_STATUS_OK });\n });\n return endSpansOnPromise([transactionSpan], originCommitPromise);\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalAbort = transaction.abort;\n transaction.abort = function abort(this: Transaction, ...args) {\n const originAbortPromise = originalAbort.apply(this, args);\n return endSpansOnPromise([transactionSpan], originAbortPromise);\n };\n })\n .catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n transactionSpan.end();\n });\n\n return transactionPromise;\n };\n };\n }\n\n private _getSendBatchPatch() {\n return (original: Producer['sendBatch'] | Transaction['sendBatch']) => {\n return function sendBatch(\n this: Producer | Transaction,\n ...args: Parameters<Producer['sendBatch']>\n ): ReturnType<Producer['sendBatch']> {\n const batch = args[0];\n const messages = batch.topicMessages || [];\n\n const spans: Span[] = [];\n\n messages.forEach((topicMessage: any) => {\n topicMessage.messages.forEach((message: any) => {\n spans.push(startProducerSpan(topicMessage.topic, message));\n });\n });\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n\n private _getSendPatch() {\n return (original: Producer['send'] | Transaction['send']) => {\n return function send(\n this: Producer | Transaction,\n ...args: Parameters<Producer['send']>\n ): ReturnType<Producer['send']> {\n const record = args[0];\n const spans: Span[] = record.messages.map((message: any) => {\n return startProducerSpan(record.topic, message);\n });\n\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSp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A,UAC3D,CAAC,CAAA;AAAA,QACH,CAAC,CAAA;AACD,QAAA,MAAM,cAAA,GAA4C,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC3E,QAAA,OAAO,iBAAA,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,aAAA,GAAgB;AACtB,IAAA,OAAO,CAAC,QAAA,KAAqD;AAC3D,MAAA,OAAO,SAAS,QAEX,IAAA,EAC2B;AAC9B,QAAA,MAAM,MAAA,GAAS,KAAK,CAAC,CAAA;AACrB,QAAA,MAAM,KAAA,GAAgB,MAAA,CAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,KAAiB;AAC1D,UAAA,OAAO,iBAAA,CAAkB,MAAA,CAAO,KAAA,EAAO,OAAO,CAAA;AAAA,QAChD,CAAC,CAAA;AAED,QAAA,MAAM,cAAA,GAA4C,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC3E,QAAA,OAAO,iBAAA,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const ATTR_MESSAGING_DESTINATION_PARTITION_ID = "messaging.destination.partition.id";
|
|
2
|
+
const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message.key";
|
|
3
|
+
const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = "messaging.kafka.message.tombstone";
|
|
4
|
+
const ATTR_MESSAGING_KAFKA_OFFSET = "messaging.kafka.offset";
|
|
5
|
+
const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = "process";
|
|
6
|
+
const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = "receive";
|
|
7
|
+
const MESSAGING_OPERATION_TYPE_VALUE_SEND = "send";
|
|
8
|
+
const MESSAGING_SYSTEM_VALUE_KAFKA = "kafka";
|
|
9
|
+
const ERROR_TYPE_VALUE_OTHER = "_OTHER";
|
|
10
|
+
|
|
11
|
+
export { ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_OFFSET, ERROR_TYPE_VALUE_OTHER, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, MESSAGING_OPERATION_TYPE_VALUE_SEND, MESSAGING_SYSTEM_VALUE_KAFKA };
|
|
12
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Metric semantic conventions dropped; `error.type` inlined from `@opentelemetry/semantic-conventions`\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.\n *\n * @example \"1\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_DESTINATION_PARTITION_ID = 'messaging.destination.partition.id' as const;\n\n/**\n * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute **MUST NOT** be set.\n *\n * @example \"myKey\"\n *\n * @note If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = 'messaging.kafka.message.key' as const;\n\n/**\n * A boolean that is true if the message is a tombstone.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = 'messaging.kafka.message.tombstone' as const;\n\n/**\n * The offset of a record in the corresponding Kafka partition.\n *\n * @example 42\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_KAFKA_OFFSET = 'messaging.kafka.offset' as const;\n\n/**\n * Enum value \"process\" for attribute `messaging.operation.type`.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = 'process' as const;\n\n/**\n * Enum value \"receive\" for attribute `messaging.operation.type`.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = 'receive' as const;\n\n/**\n * Enum value \"send\" for attribute `messaging.operation.type`.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_SEND = 'send' as const;\n\n/**\n * Enum value \"kafka\" for attribute `messaging.system`.\n */\nexport const MESSAGING_SYSTEM_VALUE_KAFKA = 'kafka' as const;\n\n/**\n * Enum value \"_OTHER\" for attribute `error.type`. A fallback error value to be used when\n * the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = '_OTHER' as const;\n"],"names":[],"mappings":"AAuBO,MAAM,uCAAA,GAA0C;AAWhD,MAAM,gCAAA,GAAmC;AAOzC,MAAM,sCAAA,GAAyC;AAS/C,MAAM,2BAAA,GAA8B;AAKpC,MAAM,sCAAA,GAAyC;AAK/C,MAAM,sCAAA,GAAyC;AAK/C,MAAM,mCAAA,GAAsC;AAK5C,MAAM,4BAAA,GAA+B;AAMrC,MAAM,sBAAA,GAAyB;;;;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { TraceFlags } from '@opentelemetry/api';
|
|
2
|
+
import { MESSAGING_OPERATION_NAME, MESSAGING_OPERATION_TYPE, MESSAGING_DESTINATION_NAME, MESSAGING_SYSTEM, ERROR_TYPE } from '@sentry/conventions/attributes';
|
|
3
|
+
import { startInactiveSpan, SPAN_KIND, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, propagationContextFromHeaders, getTraceData } from '@sentry/core';
|
|
4
|
+
import { MESSAGING_SYSTEM_VALUE_KAFKA, ATTR_MESSAGING_KAFKA_OFFSET, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, ERROR_TYPE_VALUE_OTHER, MESSAGING_OPERATION_TYPE_VALUE_SEND, ATTR_MESSAGING_DESTINATION_PARTITION_ID } from './semconv.js';
|
|
5
|
+
|
|
6
|
+
const PRODUCER_ORIGIN = "auto.kafkajs.otel.producer";
|
|
7
|
+
const CONSUMER_ORIGIN = "auto.kafkajs.otel.consumer";
|
|
8
|
+
function getHeaderAsString(headers, key) {
|
|
9
|
+
const value = headers?.[key];
|
|
10
|
+
if (value == null) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
return Array.isArray(value) ? value[0]?.toString() : value.toString();
|
|
14
|
+
}
|
|
15
|
+
function getLinksFromHeaders(headers) {
|
|
16
|
+
const sentryTrace = getHeaderAsString(headers, "sentry-trace");
|
|
17
|
+
if (!sentryTrace) {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
const { traceId, parentSpanId, sampled } = propagationContextFromHeaders(
|
|
21
|
+
sentryTrace,
|
|
22
|
+
getHeaderAsString(headers, "baggage")
|
|
23
|
+
);
|
|
24
|
+
if (!parentSpanId) {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
context: {
|
|
30
|
+
traceId,
|
|
31
|
+
spanId: parentSpanId,
|
|
32
|
+
isRemote: true,
|
|
33
|
+
traceFlags: sampled ? TraceFlags.SAMPLED : TraceFlags.NONE
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
function startConsumerSpan({ topic, message, operationType, links, attributes }) {
|
|
39
|
+
const operationName = operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? "poll" : operationType;
|
|
40
|
+
return startInactiveSpan({
|
|
41
|
+
name: `${operationName} ${topic}`,
|
|
42
|
+
kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SPAN_KIND.CLIENT : SPAN_KIND.CONSUMER,
|
|
43
|
+
links,
|
|
44
|
+
attributes: {
|
|
45
|
+
...attributes,
|
|
46
|
+
[MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
47
|
+
[MESSAGING_DESTINATION_NAME]: topic,
|
|
48
|
+
[MESSAGING_OPERATION_TYPE]: operationType,
|
|
49
|
+
[MESSAGING_OPERATION_NAME]: operationName,
|
|
50
|
+
[ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : void 0,
|
|
51
|
+
[ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : void 0,
|
|
52
|
+
[ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,
|
|
53
|
+
// Mirror the upstream behavior of only tagging per-message processing spans (not the batch
|
|
54
|
+
// receiving span, which carries no message) with the auto origin.
|
|
55
|
+
...message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function startProducerSpan(topic, message) {
|
|
60
|
+
const span = startInactiveSpan({
|
|
61
|
+
name: `send ${topic}`,
|
|
62
|
+
kind: SPAN_KIND.PRODUCER,
|
|
63
|
+
attributes: {
|
|
64
|
+
[MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
65
|
+
[MESSAGING_DESTINATION_NAME]: topic,
|
|
66
|
+
[ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : void 0,
|
|
67
|
+
[ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : void 0,
|
|
68
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: message.partition !== void 0 ? String(message.partition) : void 0,
|
|
69
|
+
[MESSAGING_OPERATION_NAME]: "send",
|
|
70
|
+
[MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,
|
|
71
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
message.headers = message.headers ?? {};
|
|
75
|
+
const traceData = getTraceData({ span });
|
|
76
|
+
if (traceData["sentry-trace"]) {
|
|
77
|
+
message.headers["sentry-trace"] = traceData["sentry-trace"];
|
|
78
|
+
}
|
|
79
|
+
if (traceData.baggage) {
|
|
80
|
+
message.headers["baggage"] = traceData.baggage;
|
|
81
|
+
}
|
|
82
|
+
return span;
|
|
83
|
+
}
|
|
84
|
+
function endSpansOnPromise(spans, sendPromise) {
|
|
85
|
+
return Promise.resolve(sendPromise).catch((reason) => {
|
|
86
|
+
let errorMessage;
|
|
87
|
+
let errorType = ERROR_TYPE_VALUE_OTHER;
|
|
88
|
+
if (typeof reason === "string" || reason === void 0) {
|
|
89
|
+
errorMessage = reason;
|
|
90
|
+
} else if (typeof reason === "object" && Object.prototype.hasOwnProperty.call(reason, "message")) {
|
|
91
|
+
errorMessage = reason.message;
|
|
92
|
+
errorType = reason.constructor.name;
|
|
93
|
+
}
|
|
94
|
+
spans.forEach((span) => {
|
|
95
|
+
span.setAttribute(ERROR_TYPE, errorType);
|
|
96
|
+
span.setStatus({
|
|
97
|
+
code: SPAN_STATUS_ERROR,
|
|
98
|
+
message: errorMessage
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
throw reason;
|
|
102
|
+
}).finally(() => {
|
|
103
|
+
spans.forEach((span) => span.end());
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { endSpansOnPromise, getHeaderAsString, getLinksFromHeaders, startConsumerSpan, startProducerSpan };
|
|
108
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\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-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Span creation extracted here and migrated to the @sentry/core API; origin folded into span creation\n */\n\nimport { TraceFlags } from '@opentelemetry/api';\nimport {\n ERROR_TYPE,\n MESSAGING_DESTINATION_NAME,\n MESSAGING_OPERATION_NAME,\n MESSAGING_OPERATION_TYPE,\n MESSAGING_SYSTEM,\n} from '@sentry/conventions/attributes';\nimport type { Span, SpanAttributes, SpanLink } from '@sentry/core';\nimport {\n getTraceData,\n propagationContextFromHeaders,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { KafkaMessage, Message } from './kafkajs-types';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n ATTR_MESSAGING_KAFKA_MESSAGE_KEY,\n ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE,\n ATTR_MESSAGING_KAFKA_OFFSET,\n ERROR_TYPE_VALUE_OTHER,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n MESSAGING_OPERATION_TYPE_VALUE_SEND,\n MESSAGING_SYSTEM_VALUE_KAFKA,\n} from './semconv';\n\nconst PRODUCER_ORIGIN = 'auto.kafkajs.otel.producer';\nconst CONSUMER_ORIGIN = 'auto.kafkajs.otel.consumer';\n\nexport interface ConsumerSpanOptions {\n topic: string;\n message: KafkaMessage | undefined;\n operationType: string;\n attributes: SpanAttributes;\n links?: SpanLink[];\n}\n\n/**\n * Reads a header value off a kafkajs message as a string. kafkajs delivers headers as `Buffer`s (or\n * arrays of them), so we normalize to a string before handing them to Sentry's trace helpers.\n */\nexport function getHeaderAsString(headers: KafkaMessage['headers'], key: string): string | undefined {\n const value = headers?.[key];\n if (value == null) {\n return undefined;\n }\n return Array.isArray(value) ? value[0]?.toString() : value.toString();\n}\n\n/**\n * Builds a span link to the producer span carried in the message headers, mirroring the upstream\n * behavior of linking each batch-processed message to its originating producer span.\n */\nexport function getLinksFromHeaders(headers: KafkaMessage['headers']): SpanLink[] | undefined {\n const sentryTrace = getHeaderAsString(headers, 'sentry-trace');\n if (!sentryTrace) {\n return undefined;\n }\n\n const { traceId, parentSpanId, sampled } = propagationContextFromHeaders(\n sentryTrace,\n getHeaderAsString(headers, 'baggage'),\n );\n if (!parentSpanId) {\n return undefined;\n }\n\n return [\n {\n context: {\n traceId,\n spanId: parentSpanId,\n isRemote: true,\n traceFlags: sampled ? TraceFlags.SAMPLED : TraceFlags.NONE,\n },\n },\n ];\n}\n\n/** Starts an inactive consumer (process/receive) span carrying the kafkajs messaging attributes. */\nexport function startConsumerSpan({ topic, message, operationType, links, attributes }: ConsumerSpanOptions): Span {\n const operationName =\n operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE\n ? 'poll' // for batch processing spans\n : operationType; // for individual message processing spans\n\n return startInactiveSpan({\n name: `${operationName} ${topic}`,\n kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SPAN_KIND.CLIENT : SPAN_KIND.CONSUMER,\n links,\n attributes: {\n ...attributes,\n [MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [MESSAGING_DESTINATION_NAME]: topic,\n [MESSAGING_OPERATION_TYPE]: operationType,\n [MESSAGING_OPERATION_NAME]: operationName,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,\n // Mirror the upstream behavior of only tagging per-message processing spans (not the batch\n // receiving span, which carries no message) with the auto origin.\n ...(message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}),\n },\n });\n}\n\n/** Starts an inactive producer span and propagates its trace into the message headers. */\nexport function startProducerSpan(topic: string, message: Message): Span {\n const span = startInactiveSpan({\n name: `send ${topic}`,\n kind: SPAN_KIND.PRODUCER,\n attributes: {\n [MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]:\n message.partition !== undefined ? String(message.partition) : undefined,\n [MESSAGING_OPERATION_NAME]: 'send',\n [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN,\n },\n });\n\n // Propagate the producer span's trace to consumers via the message headers.\n message.headers = message.headers ?? {};\n const traceData = getTraceData({ span });\n if (traceData['sentry-trace']) {\n message.headers['sentry-trace'] = traceData['sentry-trace'];\n }\n if (traceData.baggage) {\n message.headers['baggage'] = traceData.baggage;\n }\n\n return span;\n}\n\n/**\n * Resolves once `sendPromise` settles, ending all `spans` and, on failure, marking them with the\n * error status and `error.type` before re-throwing.\n */\nexport function endSpansOnPromise<T>(spans: Span[], sendPromise: Promise<T>): Promise<T> {\n return Promise.resolve(sendPromise)\n .catch(reason => {\n let errorMessage: string | undefined;\n let errorType: string = ERROR_TYPE_VALUE_OTHER;\n if (typeof reason === 'string' || reason === undefined) {\n errorMessage = reason;\n } else if (typeof reason === 'object' && Object.prototype.hasOwnProperty.call(reason, 'message')) {\n errorMessage = reason.message;\n errorType = reason.constructor.name;\n }\n\n spans.forEach(span => {\n span.setAttribute(ERROR_TYPE, errorType);\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: errorMessage,\n });\n });\n\n throw reason;\n })\n .finally(() => {\n spans.forEach(span => span.end());\n });\n}\n"],"names":[],"mappings":";;;;;AAuCA,MAAM,eAAA,GAAkB,4BAAA;AACxB,MAAM,eAAA,GAAkB,4BAAA;AAcjB,SAAS,iBAAA,CAAkB,SAAkC,GAAA,EAAiC;AACnG,EAAA,MAAM,KAAA,GAAQ,UAAU,GAAG,CAAA;AAC3B,EAAA,IAAI,SAAS,IAAA,EAAM;AACjB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAI,KAAA,CAAM,CAAC,CAAA,EAAG,QAAA,EAAS,GAAI,KAAA,CAAM,QAAA,EAAS;AACtE;AAMO,SAAS,oBAAoB,OAAA,EAA0D;AAC5F,EAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,OAAA,EAAS,cAAc,CAAA;AAC7D,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,EAAE,OAAA,EAAS,YAAA,EAAc,OAAA,EAAQ,GAAI,6BAAA;AAAA,IACzC,WAAA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WAAA,EAAqC;AACvF,EAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,WAAW,CAAA,CAC/B,MAAM,CAAA,MAAA,KAAU;AACf,IAAA,IAAI,YAAA;AACJ,IAAA,IAAI,SAAA,GAAoB,sBAAA;AACxB,IAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,MAAA,KAAW,MAAA,EAAW;AACtD,MAAA,YAAA,GAAe,MAAA;AAAA,IACjB,CAAA,MAAA,IAAW,OAAO,MAAA,KAAW,QAAA,IAAY,MAAA,CAAO,UAAU,cAAA,CAAe,IAAA,CAAK,MAAA,EAAQ,SAAS,CAAA,EAAG;AAChG,MAAA,YAAA,GAAe,MAAA,CAAO,OAAA;AACtB,MAAA,SAAA,GAAY,OAAO,WAAA,CAAY,IAAA;AAAA,IACjC;AAEA,IAAA,KAAA,CAAM,QAAQ,CAAA,IAAA,KAAQ;AACpB,MAAA,IAAA,CAAK,YAAA,CAAa,YAAY,SAAS,CAAA;AACvC,MAAA,IAAA,CAAK,SAAA,CAAU;AAAA,QACb,IAAA,EAAM,iBAAA;AAAA,QACN,OAAA,EAAS;AAAA,OACV,CAAA;AAAA,IACH,CAAC,CAAA;AAED,IAAA,MAAM,MAAA;AAAA,EACR,CAAC,CAAA,CACA,OAAA,CAAQ,MAAM;AACb,IAAA,KAAA,CAAM,OAAA,CAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,GAAA,EAAK,CAAA;AAAA,EAClC,CAAC,CAAA;AACL;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { KnexInstrumentation } from './vendored/instrumentation.js';
|
|
2
|
+
import { defineIntegration } from '@sentry/core';
|
|
3
|
+
import { generateInstrumentOnce } from '@sentry/node-core';
|
|
4
|
+
import { isOrchestrionInjected, knexChannelIntegration } from '@sentry/server-utils/orchestrion';
|
|
5
|
+
|
|
6
|
+
const INTEGRATION_NAME = "Knex";
|
|
7
|
+
const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());
|
|
8
|
+
const _knexIntegration = (() => {
|
|
9
|
+
return {
|
|
10
|
+
name: INTEGRATION_NAME,
|
|
11
|
+
setupOnce() {
|
|
12
|
+
if (isOrchestrionInjected()) {
|
|
13
|
+
knexChannelIntegration().setupOnce?.();
|
|
14
|
+
} else {
|
|
15
|
+
instrumentKnex();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const knexIntegration = defineIntegration(_knexIntegration);
|
|
21
|
+
|
|
22
|
+
export { instrumentKnex, knexIntegration };
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/knex/index.ts"],"sourcesContent":["import { KnexInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { isOrchestrionInjected, knexChannelIntegration } from '@sentry/server-utils/orchestrion';\n\nconst INTEGRATION_NAME = 'Knex' as const;\n\nexport const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());\n\nconst _knexIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // Prefer the diagnostics-channel subscriber when orchestrion injected its channels; otherwise\n // fall back to the vendored OTel instrumentation. `isOrchestrionInjected()` is only reliable by\n // `setupOnce` (the runtime injection runs during `Sentry.init()`, after integrations are built).\n if (isOrchestrionInjected()) {\n knexChannelIntegration().setupOnce?.();\n } else {\n instrumentKnex();\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":[],"mappings":";;;;;AAMA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,qBAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAIV,MAAA,IAAI,uBAAsB,EAAG;AAC3B,QAAA,sBAAA,GAAyB,SAAA,IAAY;AAAA,MACvC,CAAA,MAAO;AACL,QAAA,cAAA,EAAe;AAAA,MACjB;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,eAAA,GAAkB,kBAAkB,gBAAgB;;;;"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { SDK_VERSION, getActiveSpan, startSpan, SPAN_KIND, SPAN_STATUS_ERROR, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
|
+
import { DB_STATEMENT, NET_TRANSPORT, NET_PEER_PORT, NET_PEER_NAME, DB_USER, DB_SYSTEM, DB_NAME, DB_OPERATION } from '@sentry/conventions/attributes';
|
|
4
|
+
import { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile.js';
|
|
5
|
+
import { ATTR_DB_SQL_TABLE } from './semconv.js';
|
|
6
|
+
import { extractTableName, extractDatabaseFromConnectionString, limitLength, extractPortFromConnectionString, extractHostFromConnectionString, mapSystem, getName, getFormatter } from './utils.js';
|
|
7
|
+
|
|
8
|
+
const PACKAGE_NAME = "@sentry/instrumentation-knex";
|
|
9
|
+
const ORIGIN = "auto.db.otel.knex";
|
|
10
|
+
const MODULE_NAME = "knex";
|
|
11
|
+
const SUPPORTED_VERSIONS = [
|
|
12
|
+
// use "lib/execution" for runner.js, "lib" for client.js as basepath, latest tested 0.95.6
|
|
13
|
+
">=0.22.0 <4",
|
|
14
|
+
// use "lib" as basepath
|
|
15
|
+
">=0.10.0 <0.18.0",
|
|
16
|
+
">=0.19.0 <0.22.0",
|
|
17
|
+
// use "src" as basepath
|
|
18
|
+
">=0.18.0 <0.19.0"
|
|
19
|
+
];
|
|
20
|
+
const MAX_QUERY_LENGTH = 1022;
|
|
21
|
+
const parentSpanSymbol = /* @__PURE__ */ Symbol("sentry.instrumentation-knex.parent-span");
|
|
22
|
+
class KnexInstrumentation extends InstrumentationBase {
|
|
23
|
+
constructor(config = {}) {
|
|
24
|
+
super(PACKAGE_NAME, SDK_VERSION, config);
|
|
25
|
+
}
|
|
26
|
+
init() {
|
|
27
|
+
const module = new InstrumentationNodeModuleDefinition(MODULE_NAME, SUPPORTED_VERSIONS);
|
|
28
|
+
module.files.push(
|
|
29
|
+
this._getClientNodeModuleFileInstrumentation("src"),
|
|
30
|
+
this._getClientNodeModuleFileInstrumentation("lib"),
|
|
31
|
+
this._getRunnerNodeModuleFileInstrumentation("src"),
|
|
32
|
+
this._getRunnerNodeModuleFileInstrumentation("lib"),
|
|
33
|
+
this._getRunnerNodeModuleFileInstrumentation("lib/execution")
|
|
34
|
+
);
|
|
35
|
+
return module;
|
|
36
|
+
}
|
|
37
|
+
_getRunnerNodeModuleFileInstrumentation(basePath) {
|
|
38
|
+
return new InstrumentationNodeModuleFile(
|
|
39
|
+
`knex/${basePath}/runner.js`,
|
|
40
|
+
SUPPORTED_VERSIONS,
|
|
41
|
+
(Runner, moduleVersion) => {
|
|
42
|
+
this._ensureWrapped(Runner.prototype, "query", this._createQueryWrapper(moduleVersion));
|
|
43
|
+
return Runner;
|
|
44
|
+
},
|
|
45
|
+
(Runner) => {
|
|
46
|
+
this._unwrap(Runner.prototype, "query");
|
|
47
|
+
return Runner;
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
_getClientNodeModuleFileInstrumentation(basePath) {
|
|
52
|
+
return new InstrumentationNodeModuleFile(
|
|
53
|
+
`knex/${basePath}/client.js`,
|
|
54
|
+
SUPPORTED_VERSIONS,
|
|
55
|
+
(Client) => {
|
|
56
|
+
this._ensureWrapped(Client.prototype, "queryBuilder", this._storeContext.bind(this));
|
|
57
|
+
this._ensureWrapped(Client.prototype, "schemaBuilder", this._storeContext.bind(this));
|
|
58
|
+
this._ensureWrapped(Client.prototype, "raw", this._storeContext.bind(this));
|
|
59
|
+
return Client;
|
|
60
|
+
},
|
|
61
|
+
(Client) => {
|
|
62
|
+
this._unwrap(Client.prototype, "queryBuilder");
|
|
63
|
+
this._unwrap(Client.prototype, "schemaBuilder");
|
|
64
|
+
this._unwrap(Client.prototype, "raw");
|
|
65
|
+
return Client;
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
_createQueryWrapper(moduleVersion) {
|
|
70
|
+
return function wrapQuery(original) {
|
|
71
|
+
return function wrapped_logging_method(query) {
|
|
72
|
+
const config = this.client.config;
|
|
73
|
+
const table = extractTableName(this.builder);
|
|
74
|
+
const operation = query?.method;
|
|
75
|
+
const connectionString = config?.connection?.connectionString;
|
|
76
|
+
const name = config?.connection?.filename || config?.connection?.database || extractDatabaseFromConnectionString(connectionString);
|
|
77
|
+
const attributes = {
|
|
78
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
79
|
+
"knex.version": moduleVersion,
|
|
80
|
+
[DB_SYSTEM]: mapSystem(this.client.driverName),
|
|
81
|
+
[ATTR_DB_SQL_TABLE]: table,
|
|
82
|
+
[DB_OPERATION]: operation,
|
|
83
|
+
[DB_USER]: config?.connection?.user,
|
|
84
|
+
[DB_NAME]: name,
|
|
85
|
+
[NET_PEER_NAME]: config?.connection?.host ?? extractHostFromConnectionString(connectionString),
|
|
86
|
+
[NET_PEER_PORT]: config?.connection?.port ?? extractPortFromConnectionString(connectionString),
|
|
87
|
+
[NET_TRANSPORT]: config?.connection?.filename === ":memory:" ? "inproc" : void 0,
|
|
88
|
+
[DB_STATEMENT]: limitLength(query?.sql, MAX_QUERY_LENGTH)
|
|
89
|
+
};
|
|
90
|
+
const parentSpan = this.builder[parentSpanSymbol] || getActiveSpan();
|
|
91
|
+
const args = arguments;
|
|
92
|
+
return startSpan(
|
|
93
|
+
{
|
|
94
|
+
name: getName(name, operation, table),
|
|
95
|
+
kind: SPAN_KIND.CLIENT,
|
|
96
|
+
attributes,
|
|
97
|
+
parentSpan,
|
|
98
|
+
onlyIfParent: true
|
|
99
|
+
},
|
|
100
|
+
(span) => (
|
|
101
|
+
// `Runner.query` returns a real, already-executing Promise, so it is safe to let
|
|
102
|
+
// `startSpan` await it and auto-end the span.
|
|
103
|
+
original.apply(this, args).catch((err) => {
|
|
104
|
+
const formatter = getFormatter(this);
|
|
105
|
+
const fullQuery = formatter(query.sql, query.bindings || []);
|
|
106
|
+
const message = err.message.replace(`${fullQuery} - `, "");
|
|
107
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message });
|
|
108
|
+
throw err;
|
|
109
|
+
})
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
_storeContext(original) {
|
|
116
|
+
return function wrapped_logging_method() {
|
|
117
|
+
const builder = original.apply(this, arguments);
|
|
118
|
+
Object.defineProperty(builder, parentSpanSymbol, {
|
|
119
|
+
value: getActiveSpan()
|
|
120
|
+
});
|
|
121
|
+
return builder;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
_ensureWrapped(obj, methodName, wrapper) {
|
|
125
|
+
if (isWrapped(obj[methodName])) {
|
|
126
|
+
this._unwrap(obj, methodName);
|
|
127
|
+
}
|
|
128
|
+
this._wrap(obj, methodName, wrapper);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { KnexInstrumentation };
|
|
133
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/knex/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-knex\n * - Upstream version: @opentelemetry/instrumentation-knex@0.62.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n */\n\n/* oxlint-disable typescript/no-deprecated */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\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 startSpan,\n} from '@sentry/core';\nimport {\n DB_NAME,\n DB_OPERATION,\n DB_STATEMENT,\n DB_SYSTEM,\n DB_USER,\n NET_PEER_NAME,\n NET_PEER_PORT,\n NET_TRANSPORT,\n} from '@sentry/conventions/attributes';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport { ATTR_DB_SQL_TABLE } from './semconv';\nimport * as utils from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-knex';\nconst ORIGIN = 'auto.db.otel.knex';\n\nconst MODULE_NAME = 'knex';\nconst SUPPORTED_VERSIONS = [\n // use \"lib/execution\" for runner.js, \"lib\" for client.js as basepath, latest tested 0.95.6\n '>=0.22.0 <4',\n // use \"lib\" as basepath\n '>=0.10.0 <0.18.0',\n '>=0.19.0 <0.22.0',\n // use \"src\" as basepath\n '>=0.18.0 <0.19.0',\n];\n\n// Max length of the query text captured in the `db.statement` attribute; \"..\" is appended when truncated.\nconst MAX_QUERY_LENGTH = 1022;\n\nconst parentSpanSymbol = Symbol('sentry.instrumentation-knex.parent-span');\n\nexport class KnexInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(MODULE_NAME, SUPPORTED_VERSIONS);\n\n module.files.push(\n this._getClientNodeModuleFileInstrumentation('src'),\n this._getClientNodeModuleFileInstrumentation('lib'),\n this._getRunnerNodeModuleFileInstrumentation('src'),\n this._getRunnerNodeModuleFileInstrumentation('lib'),\n this._getRunnerNodeModuleFileInstrumentation('lib/execution'),\n );\n\n return module;\n }\n\n private _getRunnerNodeModuleFileInstrumentation(basePath: string): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n `knex/${basePath}/runner.js`,\n SUPPORTED_VERSIONS,\n (Runner: any, moduleVersion?: string) => {\n this._ensureWrapped(Runner.prototype, 'query', this._createQueryWrapper(moduleVersion));\n return Runner;\n },\n (Runner: any) => {\n this._unwrap(Runner.prototype, 'query');\n return Runner;\n },\n );\n }\n\n private _getClientNodeModuleFileInstrumentation(basePath: string): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n `knex/${basePath}/client.js`,\n SUPPORTED_VERSIONS,\n (Client: any) => {\n this._ensureWrapped(Client.prototype, 'queryBuilder', this._storeContext.bind(this));\n this._ensureWrapped(Client.prototype, 'schemaBuilder', this._storeContext.bind(this));\n this._ensureWrapped(Client.prototype, 'raw', this._storeContext.bind(this));\n return Client;\n },\n (Client: any) => {\n this._unwrap(Client.prototype, 'queryBuilder');\n this._unwrap(Client.prototype, 'schemaBuilder');\n this._unwrap(Client.prototype, 'raw');\n return Client;\n },\n );\n }\n\n private _createQueryWrapper(moduleVersion?: string) {\n return function wrapQuery(original: (...args: any[]) => any) {\n return function wrapped_logging_method(this: any, query: any) {\n const config = this.client.config;\n\n const table = utils.extractTableName(this.builder);\n const operation = query?.method;\n const connectionString = config?.connection?.connectionString;\n const name =\n config?.connection?.filename ||\n config?.connection?.database ||\n utils.extractDatabaseFromConnectionString(connectionString);\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n 'knex.version': moduleVersion,\n [DB_SYSTEM]: utils.mapSystem(this.client.driverName),\n [ATTR_DB_SQL_TABLE]: table,\n [DB_OPERATION]: operation,\n [DB_USER]: config?.connection?.user,\n [DB_NAME]: name,\n [NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),\n [NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),\n [NET_TRANSPORT]: config?.connection?.filename === ':memory:' ? 'inproc' : undefined,\n [DB_STATEMENT]: utils.limitLength(query?.sql, MAX_QUERY_LENGTH),\n };\n\n // The query builder captures the span active when it was created (see `_storeContext`).\n // `onlyIfParent` ensures we only instrument queries that run as part of an existing trace.\n const parentSpan: Span | undefined = this.builder[parentSpanSymbol] || getActiveSpan();\n\n const args = arguments;\n return startSpan(\n {\n name: utils.getName(name, operation, table),\n kind: SPAN_KIND.CLIENT,\n attributes,\n parentSpan,\n onlyIfParent: true,\n },\n span =>\n // `Runner.query` returns a real, already-executing Promise, so it is safe to let\n // `startSpan` await it and auto-end the span.\n original.apply(this, args).catch((err: any) => {\n const formatter = utils.getFormatter(this);\n const fullQuery = formatter(query.sql, query.bindings || []);\n const message = err.message.replace(`${fullQuery} - `, '');\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n throw err;\n }),\n );\n };\n };\n }\n\n private _storeContext(original: (...args: any[]) => any) {\n return function wrapped_logging_method(this: any) {\n const builder = original.apply(this, arguments);\n // Capture the span that is active when the query builder is created. The query often executes\n // in a different async context, so we reuse this span as the parent when the query runs.\n Object.defineProperty(builder, parentSpanSymbol, {\n value: getActiveSpan(),\n });\n return builder;\n };\n }\n\n private _ensureWrapped(obj: any, methodName: string, wrapper: (original: any) => any): void {\n if (isWrapped(obj[methodName])) {\n this._unwrap(obj, methodName);\n }\n this._wrap(obj, methodName, wrapper);\n }\n}\n"],"names":["utils.extractTableName","utils.extractDatabaseFromConnectionString","utils.mapSystem","utils.extractHostFromConnectionString","utils.extractPortFromConnectionString","utils.limitLength","utils.getName","utils.getFormatter"],"mappings":";;;;;;;AAsCA,MAAM,YAAA,GAAe,8BAAA;AACrB,MAAM,MAAA,GAAS,mBAAA;AAEf,MAAM,WAAA,GAAc,MAAA;AACpB,MAAM,kBAAA,GAAqB;AAAA;AAAA,EAEzB,aAAA;AAAA;AAAA,EAEA,kBAAA;AAAA,EACA,kBAAA;AAAA;AAAA,EAEA;AACF,CAAA;AAGA,MAAM,gBAAA,GAAmB,IAAA;AAEzB,MAAM,gBAAA,0BAA0B,yCAAyC,CAAA;AAElE,MAAM,4BAA4B,mBAAA,CAA2C;AAAA,EAC3E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEO,IAAA,GAA4C;AACjD,IAAA,MAAM,MAAA,GAAS,IAAI,mCAAA,CAAoC,WAAA,EAAa,kBAAkB,CAAA;AAEtF,IAAA,MAAA,CAAO,KAAA,CAAM,IAAA;AAAA,MACX,IAAA,CAAK,wCAAwC,KAAK,CAAA;AAAA,MAClD,IAAA,CAAK,wCAAwC,KAAK,CAAA;AAAA,MAClD,IAAA,CAAK,wCAAwC,KAAK,CAAA;AAAA,MAClD,IAAA,CAAK,wCAAwC,KAAK,CAAA;AAAA,MAClD,IAAA,CAAK,wCAAwC,eAAe;AAAA,KAC9D;AAEA,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEQ,wCAAwC,QAAA,EAAiD;AAC/F,IAAA,OAAO,IAAI,6BAAA;AAAA,MACT,QAAQ,QAAQ,CAAA,UAAA,CAAA;AAAA,MAChB,kBAAA;AAAA,MACA,CAAC,QAAa,aAAA,KAA2B;AACvC,QAAA,IAAA,CA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AAK,KAAA,CAAM,GAAA,EAAK,UAAA,EAAY,OAAO,CAAA;AAAA,EACrC;AACF;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const ATTR_DB_SQL_TABLE = "db.sql.table";
|
|
2
|
+
const DB_SYSTEM_NAME_VALUE_SQLITE = "sqlite";
|
|
3
|
+
const DB_SYSTEM_NAME_VALUE_POSTGRESQL = "postgresql";
|
|
4
|
+
|
|
5
|
+
export { ATTR_DB_SQL_TABLE, DB_SYSTEM_NAME_VALUE_POSTGRESQL, DB_SYSTEM_NAME_VALUE_SQLITE };
|
|
6
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/knex/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-knex\n * - Upstream version: @opentelemetry/instrumentation-knex@0.62.0\n */\n\n/**\n * @deprecated Replaced by `db.collection.name`.\n */\nexport const ATTR_DB_SQL_TABLE = 'db.sql.table' as const;\n\nexport const DB_SYSTEM_NAME_VALUE_SQLITE = 'sqlite' as const;\n\nexport const DB_SYSTEM_NAME_VALUE_POSTGRESQL = 'postgresql' as const;\n"],"names":[],"mappings":"AAYO,MAAM,iBAAA,GAAoB;AAE1B,MAAM,2BAAA,GAA8B;AAEpC,MAAM,+BAAA,GAAkC;;;;"}
|