@sentry/node 10.58.0 → 10.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/fs/index.js +3 -84
- package/build/cjs/integrations/fs/index.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/instrumentation.js +145 -175
- package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/index.js +0 -21
- package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js +0 -6
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +33 -42
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/utils.js +3 -2
- package/build/cjs/integrations/tracing/connect/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/index.js +1 -15
- package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js +30 -18
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/index.js +1 -51
- package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/enum.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +67 -57
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js +28 -62
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js +0 -17
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +28 -45
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js +4 -9
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +1 -0
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/index.js +2 -17
- package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +65 -93
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js +2 -0
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/utils.js +2 -15
- package/build/cjs/integrations/tracing/knex/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/index.js +1 -24
- package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +29 -41
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/index.js +1 -42
- package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +12 -562
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js +151 -0
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -4
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js +153 -0
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/mongoose/index.js +1 -8
- package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +56 -203
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -4
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +19 -49
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/index.js +1 -8
- package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +21 -59
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +14 -33
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/index.js +0 -4
- package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +51 -261
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js +43 -167
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +89 -160
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +92 -231
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -2
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/index.js +1 -25
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +25 -76
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/utils.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 +19 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/index.js +17 -1
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/fs/index.js +4 -85
- package/build/esm/integrations/fs/index.js.map +1 -1
- package/build/esm/integrations/fs/vendored/constants.js.map +1 -1
- package/build/esm/integrations/fs/vendored/instrumentation.js +147 -177
- package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/fs/vendored/utils.js.map +1 -1
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/connect/index.js +1 -22
- package/build/esm/integrations/tracing/connect/index.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js +1 -6
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +36 -44
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/utils.js +3 -2
- package/build/esm/integrations/tracing/connect/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/index.js +3 -17
- package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js +31 -19
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/index.js +3 -53
- package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/enum.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +69 -59
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/utils.js +29 -62
- package/build/esm/integrations/tracing/graphql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js +1 -18
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +30 -47
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/utils.js +5 -10
- package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +1 -0
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/knex/index.js +4 -19
- package/build/esm/integrations/tracing/knex/index.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +66 -94
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js +2 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/utils.js +3 -15
- package/build/esm/integrations/tracing/knex/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/koa/index.js +3 -26
- package/build/esm/integrations/tracing/koa/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +31 -43
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/index.js +3 -43
- package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +13 -563
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/patches.js +143 -0
- package/build/esm/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -3
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/utils.js +146 -0
- package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/mongoose/index.js +2 -9
- package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +59 -206
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -3
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js +20 -50
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/index.js +2 -9
- package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +26 -64
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js +15 -34
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/index.js +1 -5
- package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +52 -262
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/utils.js +44 -165
- package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +92 -163
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +94 -233
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -2
- package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/index.js +3 -27
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +29 -79
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/utils.js.map +1 -1
- package/build/esm/package.json +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 +17 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/index.js +17 -1
- package/build/esm/sdk/index.js.map +1 -1
- package/build/import-hook.mjs +6 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/fs/index.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/instrumentation.d.ts +6 -10
- package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/types.d.ts +10 -15
- package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/utils.d.ts +2 -2
- package/build/types/integrations/fs/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts +5 -5
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts +1 -1
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/enum.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts +7 -2
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts +4 -4
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts +5 -43
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts +8 -11
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts +3 -4
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts +0 -6
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/types.d.ts +2 -39
- package/build/types/integrations/tracing/koa/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts +3 -3
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/index.d.ts +0 -4
- package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts.map +1 -1
- 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/semconv.d.ts +0 -54
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts +1 -9
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts +2 -56
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/types.d.ts +2 -36
- package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/utils.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 +34 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/index.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +6 -10
- package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +10 -15
- package/build/types-ts3.8/integrations/fs/vendored/utils.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/connect/vendored/instrumentation.d.ts +4 -4
- package/build/types-ts3.8/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/instrumentation.d.ts +6 -1
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/internal-types.d.ts +3 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/types.d.ts +4 -42
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/utils.d.ts +6 -9
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/utils.d.ts +1 -2
- package/build/types-ts3.8/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
- package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/knex/vendored/utils.d.ts +0 -6
- package/build/types-ts3.8/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
- package/build/types-ts3.8/integrations/tracing/koa/vendored/types.d.ts +1 -38
- package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/instrumentation.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/types.d.ts +1 -55
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
- package/build/types-ts3.8/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/redis/vendored/types.d.ts +2 -36
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
- package/package.json +20 -6
- package/build/cjs/integrations/tracing/knex/vendored/constants.js +0 -16
- package/build/cjs/integrations/tracing/knex/vendored/constants.js.map +0 -1
- package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js +0 -6
- package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
- package/build/cjs/integrations/tracing/utils/sql-common.js +0 -43
- package/build/cjs/integrations/tracing/utils/sql-common.js.map +0 -1
- package/build/esm/integrations/tracing/knex/vendored/constants.js +0 -13
- package/build/esm/integrations/tracing/knex/vendored/constants.js.map +0 -1
- package/build/esm/integrations/tracing/postgres/vendored/internal-types.js +0 -4
- package/build/esm/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
- package/build/esm/integrations/tracing/utils/sql-common.js +0 -41
- package/build/esm/integrations/tracing/utils/sql-common.js.map +0 -1
- package/build/types/integrations/tracing/knex/vendored/constants.d.ts +0 -3
- package/build/types/integrations/tracing/knex/vendored/constants.d.ts.map +0 -1
- package/build/types/integrations/tracing/knex/vendored/types.d.ts +0 -8
- package/build/types/integrations/tracing/knex/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/mongo/vendored/types.d.ts +0 -51
- package/build/types/integrations/tracing/mongo/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
- package/build/types/integrations/tracing/mongoose/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
- package/build/types/integrations/tracing/mysql2/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/tedious/vendored/types.d.ts +0 -10
- package/build/types/integrations/tracing/tedious/vendored/types.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/tracing/knex/vendored/constants.d.ts +0 -3
- package/build/types-ts3.8/integrations/tracing/knex/vendored/types.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/types.d.ts +0 -51
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/types.d.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\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 * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n/* eslint-disable */\n\nimport {\n Attributes,\n Context,\n context,\n Counter,\n Histogram,\n Link,\n propagation,\n ROOT_CONTEXT,\n Span,\n SpanKind,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n isWrapped,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n ERROR_TYPE_VALUE_OTHER,\n} from '@opentelemetry/semantic-conventions';\nimport type { Kafka, Transaction, Producer, ConsumerEvents, ProducerEvents, RequestEvent } from './kafkajs-types';\nimport type {\n Consumer,\n ConsumerRunConfig,\n EachBatchHandler,\n EachMessageHandler,\n KafkaMessage,\n Message,\n RecordMetadata,\n} from './kafkajs-types';\nimport { EVENT_LISTENERS_SET } from './internal-types';\nimport { bufferTextMapGetter } from './propagator';\nimport {\n ATTR_MESSAGING_BATCH_MESSAGE_COUNT,\n ATTR_MESSAGING_DESTINATION_NAME,\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n ATTR_MESSAGING_KAFKA_MESSAGE_KEY,\n ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE,\n ATTR_MESSAGING_KAFKA_OFFSET,\n ATTR_MESSAGING_OPERATION_NAME,\n ATTR_MESSAGING_OPERATION_TYPE,\n ATTR_MESSAGING_SYSTEM,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n MESSAGING_OPERATION_TYPE_VALUE_SEND,\n MESSAGING_SYSTEM_VALUE_KAFKA,\n METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES,\n METRIC_MESSAGING_CLIENT_OPERATION_DURATION,\n METRIC_MESSAGING_CLIENT_SENT_MESSAGES,\n METRIC_MESSAGING_PROCESS_DURATION,\n} from './semconv';\nimport { KafkaJsInstrumentationConfig } from './types';\n\ninterface ConsumerSpanOptions {\n topic: string;\n message: KafkaMessage | undefined;\n operationType: string;\n attributes: Attributes;\n ctx?: Context | undefined;\n link?: Link;\n}\nimport { SDK_VERSION } from '@sentry/core';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-kafkajs';\n\n// This interface acts as a strict subset of the KafkaJS Consumer and\n// Producer interfaces (just for the event we're needing)\ninterface KafkaEventEmitter {\n on(eventName: ConsumerEvents['REQUEST'] | ProducerEvents['REQUEST'], listener: (event: RequestEvent) => void): void;\n events: {\n REQUEST: ConsumerEvents['REQUEST'] | ProducerEvents['REQUEST'];\n };\n [EVENT_LISTENERS_SET]?: boolean;\n}\n\ninterface StandardAttributes<OP extends string = string> extends Attributes {\n [ATTR_MESSAGING_SYSTEM]: string;\n [ATTR_MESSAGING_OPERATION_NAME]: OP;\n [ATTR_ERROR_TYPE]?: string;\n}\ninterface TopicAttributes {\n [ATTR_MESSAGING_DESTINATION_NAME]: string;\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]?: string;\n}\n\ninterface ClientDurationAttributes extends StandardAttributes, Partial<TopicAttributes> {\n [ATTR_SERVER_ADDRESS]: string;\n [ATTR_SERVER_PORT]: number;\n [ATTR_MESSAGING_OPERATION_TYPE]?: string;\n}\ninterface SentMessagesAttributes extends StandardAttributes<'send'>, TopicAttributes {\n [ATTR_ERROR_TYPE]?: string;\n}\ntype ConsumedMessagesAttributes = StandardAttributes<'receive' | 'process'>;\ninterface MessageProcessDurationAttributes extends StandardAttributes<'process'>, TopicAttributes {\n [ATTR_MESSAGING_SYSTEM]: string;\n [ATTR_MESSAGING_OPERATION_NAME]: 'process';\n [ATTR_ERROR_TYPE]?: string;\n}\ntype RecordPendingMetric = (errorType?: string | undefined) => void;\n\nfunction prepareCounter<T extends Attributes>(meter: Counter<T>, value: number, attributes: T): RecordPendingMetric {\n return (errorType?: string | undefined) => {\n meter.add(value, {\n ...attributes,\n ...(errorType ? { [ATTR_ERROR_TYPE]: errorType } : {}),\n });\n };\n}\n\nfunction prepareDurationHistogram<T extends Attributes>(\n meter: Histogram<T>,\n value: number,\n attributes: T,\n): RecordPendingMetric {\n return (errorType?: string | undefined) => {\n meter.record((Date.now() - value) / 1000, {\n ...attributes,\n ...(errorType ? { [ATTR_ERROR_TYPE]: errorType } : {}),\n });\n };\n}\n\nconst HISTOGRAM_BUCKET_BOUNDARIES = [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10];\nexport class KafkaJsInstrumentation extends InstrumentationBase<KafkaJsInstrumentationConfig> {\n declare private _clientDuration: Histogram<ClientDurationAttributes>;\n declare private _sentMessages: Counter<SentMessagesAttributes>;\n declare private _consumedMessages: Counter<ConsumedMessagesAttributes>;\n declare private _processDuration: Histogram<MessageProcessDurationAttributes>;\n\n constructor(config: KafkaJsInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n override _updateMetricInstruments() {\n this._clientDuration = this.meter.createHistogram(METRIC_MESSAGING_CLIENT_OPERATION_DURATION, {\n advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES },\n });\n this._sentMessages = this.meter.createCounter(METRIC_MESSAGING_CLIENT_SENT_MESSAGES);\n this._consumedMessages = this.meter.createCounter(METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES);\n this._processDuration = this.meter.createHistogram(METRIC_MESSAGING_PROCESS_DURATION, {\n advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES },\n });\n }\n\n protected init() {\n const unpatch = (moduleExports: any) => {\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 if (isWrapped(newConsumer.run)) {\n instrumentation._unwrap(newConsumer, 'run');\n }\n\n instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());\n\n instrumentation._setKafkaEventListeners(newConsumer);\n\n return newConsumer;\n };\n };\n }\n\n private _setKafkaEventListeners(kafkaObj: KafkaEventEmitter) {\n if (kafkaObj[EVENT_LISTENERS_SET]) return;\n\n // The REQUEST Consumer event was added in kafkajs@1.5.0.\n if (kafkaObj.events?.REQUEST) {\n kafkaObj.on(kafkaObj.events.REQUEST, this._recordClientDurationMetric.bind(this));\n }\n\n kafkaObj[EVENT_LISTENERS_SET] = true;\n }\n\n private _recordClientDurationMetric(event: Pick<RequestEvent, 'payload'>) {\n const [address = '', port = '0'] = event.payload.broker.split(':');\n this._clientDuration.record(event.payload.duration / 1000, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: `${event.payload.apiName}`,\n [ATTR_SERVER_ADDRESS]: address,\n [ATTR_SERVER_PORT]: Number.parseInt(port, 10),\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 if (isWrapped(newProducer.sendBatch)) {\n instrumentation._unwrap(newProducer, 'sendBatch');\n }\n instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());\n\n if (isWrapped(newProducer.send)) {\n instrumentation._unwrap(newProducer, 'send');\n }\n instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());\n\n if (isWrapped(newProducer.transaction)) {\n instrumentation._unwrap(newProducer, 'transaction');\n }\n instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());\n\n instrumentation._setKafkaEventListeners(newProducer);\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 const instrumentation = this;\n return (original: ConsumerRunConfig['eachMessage']) => {\n return function eachMessage(this: unknown, ...args: Parameters<EachMessageHandler>): Promise<void> {\n const payload = args[0];\n const propagatedContext: Context = propagation.extract(\n ROOT_CONTEXT,\n payload.message.headers,\n bufferTextMapGetter,\n );\n const span = instrumentation._startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n ctx: propagatedContext,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const pendingMetrics: RecordPendingMetric[] = [\n prepareDurationHistogram(instrumentation._processDuration, Date.now(), {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n }),\n prepareCounter(instrumentation._consumedMessages, 1, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n }),\n ];\n\n const eachMessagePromise = context.with(trace.setSpan(propagatedContext, span), () => {\n return original!.apply(this, args);\n });\n return instrumentation._endSpansOnPromise([span], pendingMetrics, eachMessagePromise);\n };\n };\n }\n\n private _getConsumerEachBatchPatch() {\n return (original: ConsumerRunConfig['eachBatch']) => {\n const instrumentation = this;\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 const receivingSpan = instrumentation._startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n ctx: ROOT_CONTEXT,\n attributes: {\n [ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n });\n return context.with(trace.setSpan(context.active(), receivingSpan), () => {\n const startTime = Date.now();\n const spans: Span[] = [];\n const pendingMetrics: RecordPendingMetric[] = [\n prepareCounter(instrumentation._consumedMessages, payload.batch.messages.length, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n }),\n ];\n payload.batch.messages.forEach((message: any) => {\n const propagatedContext: Context = propagation.extract(ROOT_CONTEXT, message.headers, bufferTextMapGetter);\n const spanContext = trace.getSpan(propagatedContext)?.spanContext();\n let origSpanLink: Link | undefined;\n if (spanContext) {\n origSpanLink = {\n context: spanContext,\n };\n }\n spans.push(\n instrumentation._startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n link: origSpanLink,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n pendingMetrics.push(\n prepareDurationHistogram(instrumentation._processDuration, startTime, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n }),\n );\n });\n const batchMessagePromise: Promise<void> = original!.apply(this, args);\n spans.unshift(receivingSpan);\n return instrumentation._endSpansOnPromise(spans, pendingMetrics, 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 = instrumentation.tracer.startSpan('transaction');\n\n const transactionPromise = original.apply(this, args);\n\n transactionPromise\n .then((transaction: Transaction) => {\n const originalSend = transaction.send;\n transaction.send = function send(this: Transaction, ...args) {\n return context.with(trace.setSpan(context.active(), transactionSpan), () => {\n const patched = instrumentation._getSendPatch()(originalSend);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n transactionSpan.recordException(err);\n throw err;\n });\n });\n };\n\n const originalSendBatch = transaction.sendBatch;\n transaction.sendBatch = function sendBatch(this: Transaction, ...args) {\n return context.with(trace.setSpan(context.active(), transactionSpan), () => {\n const patched = instrumentation._getSendBatchPatch()(originalSendBatch);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n transactionSpan.recordException(err);\n throw err;\n });\n });\n };\n\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: SpanStatusCode.OK });\n });\n return instrumentation._endSpansOnPromise([transactionSpan], [], originCommitPromise);\n };\n\n const originalAbort = transaction.abort;\n transaction.abort = function abort(this: Transaction, ...args) {\n const originAbortPromise = originalAbort.apply(this, args);\n return instrumentation._endSpansOnPromise([transactionSpan], [], originAbortPromise);\n };\n })\n .catch((err: any) => {\n transactionSpan.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n transactionSpan.recordException(err);\n transactionSpan.end();\n });\n\n return transactionPromise;\n };\n };\n }\n\n private _getSendBatchPatch() {\n const instrumentation = this;\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 const pendingMetrics: RecordPendingMetric[] = [];\n\n messages.forEach((topicMessage: any) => {\n topicMessage.messages.forEach((message: any) => {\n spans.push(instrumentation._startProducerSpan(topicMessage.topic, message));\n pendingMetrics.push(\n prepareCounter(instrumentation._sentMessages, 1, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_DESTINATION_NAME]: topicMessage.topic,\n ...(message.partition !== undefined\n ? {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(message.partition),\n }\n : {}),\n }),\n );\n });\n });\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return instrumentation._endSpansOnPromise(spans, pendingMetrics, origSendResult);\n };\n };\n }\n\n private _getSendPatch() {\n const instrumentation = this;\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 instrumentation._startProducerSpan(record.topic, message);\n });\n\n const pendingMetrics: RecordPendingMetric[] = record.messages.map((m: any) =>\n prepareCounter(instrumentation._sentMessages, 1, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_DESTINATION_NAME]: record.topic,\n ...(m.partition !== undefined\n ? {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(m.partition),\n }\n : {}),\n }),\n );\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return instrumentation._endSpansOnPromise(spans, pendingMetrics, origSendResult);\n };\n };\n }\n\n private _endSpansOnPromise<T>(\n spans: Span[],\n pendingMetrics: RecordPendingMetric[],\n sendPromise: Promise<T>,\n ): Promise<T> {\n return Promise.resolve(sendPromise)\n .then(result => {\n pendingMetrics.forEach(m => m());\n return result;\n })\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 pendingMetrics.forEach(m => m(errorType));\n\n spans.forEach(span => {\n span.setAttribute(ATTR_ERROR_TYPE, errorType);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: errorMessage,\n });\n });\n\n throw reason;\n })\n .finally(() => {\n spans.forEach(span => span.end());\n });\n }\n\n private _startConsumerSpan({ topic, message, operationType, ctx, link, attributes }: ConsumerSpanOptions) {\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 const span = this.tracer.startSpan(\n `${operationName} ${topic}`,\n {\n kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SpanKind.CLIENT : SpanKind.CONSUMER,\n attributes: {\n ...attributes,\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_OPERATION_TYPE]: operationType,\n [ATTR_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 },\n links: link ? [link] : [],\n },\n ctx,\n );\n\n const { consumerHook } = this.getConfig();\n if (consumerHook && message) {\n safeExecuteInTheMiddle(\n () => consumerHook(span, { topic, message }),\n e => {\n if (e) this._diag.error('consumerHook error', e);\n },\n true,\n );\n }\n\n return span;\n }\n\n private _startProducerSpan(topic: string, message: Message) {\n const span = this.tracer.startSpan(`send ${topic}`, {\n kind: SpanKind.PRODUCER,\n attributes: {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_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 [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,\n },\n });\n\n message.headers = message.headers ?? {};\n propagation.inject(trace.setSpan(context.active(), span), message.headers);\n\n const { producerHook } = this.getConfig();\n if (producerHook) {\n safeExecuteInTheMiddle(\n () => producerHook(span, { topic, message }),\n e => {\n if (e) this._diag.error('producerHook error', e);\n },\n true,\n );\n }\n\n return span;\n }\n}\n"],"names":["ATTR_ERROR_TYPE","InstrumentationBase","SDK_VERSION","METRIC_MESSAGING_CLIENT_OPERATION_DURATION","METRIC_MESSAGING_CLIENT_SENT_MESSAGES","METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES","METRIC_MESSAGING_PROCESS_DURATION","isWrapped","InstrumentationNodeModuleDefinition","instrumentation","EVENT_LISTENERS_SET","ATTR_MESSAGING_SYSTEM","MESSAGING_SYSTEM_VALUE_KAFKA","ATTR_MESSAGING_OPERATION_NAME","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","propagation","ROOT_CONTEXT","bufferTextMapGetter","MESSAGING_OPERATION_TYPE_VALUE_PROCESS","ATTR_MESSAGING_DESTINATION_PARTITION_ID","ATTR_MESSAGING_DESTINATION_NAME","context","trace","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","ATTR_MESSAGING_BATCH_MESSAGE_COUNT","transaction","args","SpanStatusCode","ERROR_TYPE_VALUE_OTHER","SpanKind","ATTR_MESSAGING_OPERATION_TYPE","ATTR_MESSAGING_KAFKA_MESSAGE_KEY","ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE","ATTR_MESSAGING_KAFKA_OFFSET","safeExecuteInTheMiddle","MESSAGING_OPERATION_TYPE_VALUE_SEND"],"mappings":";;;;;;;;;;AA4FA,MAAM,YAAA,GAAe,iCAAA;AAsCrB,SAAS,cAAA,CAAqC,KAAA,EAAmB,KAAA,EAAe,UAAA,EAAoC;AAClH,EAAA,OAAO,CAAC,SAAA,KAAmC;AACzC,IAAA,KAAA,CAAM,IAAI,KAAA,EAAO;AAAA,MACf,GAAG,UAAA;AAAA,MACH,GAAI,YAAY,EAAE,CAACA,mCAAe,GAAG,SAAA,KAAc;AAAC,KACrD,CAAA;AAAA,EACH,CAAA;AACF;AAEA,SAAS,wBAAA,CACP,KAAA,EACA,KAAA,EACA,UAAA,EACqB;AACrB,EAAA,OAAO,CAAC,SAAA,KAAmC;AACzC,IAAA,KAAA,CAAM,MAAA,CAAA,CAAQ,IAAA,CAAK,GAAA,EAAI,GAAI,SAAS,GAAA,EAAM;AAAA,MACxC,GAAG,UAAA;AAAA,MACH,GAAI,YAAY,EAAE,CAACA,mCAAe,GAAG,SAAA,KAAc;AAAC,KACrD,CAAA;AAAA,EACH,CAAA;AACF;AAEA,MAAM,2BAAA,GAA8B,CAAC,IAAA,EAAO,IAAA,EAAM,OAAO,IAAA,EAAM,KAAA,EAAO,GAAA,EAAK,IAAA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;AAAA,QACjC,CAACkB,qCAA6B,GAAGK;AAAA;AACnC,KACD,CAAA;AAED,IAAA,OAAA,CAAQ,OAAA,GAAU,OAAA,CAAQ,OAAA,IAAW,EAAC;AACtC,IAAApB,eAAA,CAAY,MAAA,CAAOO,UAAM,OAAA,CAAQD,WAAA,CAAQ,QAAO,EAAG,IAAI,CAAA,EAAG,OAAA,CAAQ,OAAO,CAAA;AAEzE,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,IAAA,CAAK,SAAA,EAAU;AACxC,IAAA,IAAI,YAAA,EAAc;AAChB,MAAAa,sCAAA;AAAA,QACE,MAAM,YAAA,CAAa,IAAA,EAAM,EAAE,KAAA,EAAO,SAAS,CAAA;AAAA,QAC3C,CAAA,CAAA,KAAK;AACH,UAAA,IAAI,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,sBAAsB,CAAC,CAAA;AAAA,QACjD,CAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;;;;"}
|
|
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 * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n/* eslint-disable */\n\nimport {\n Attributes,\n Context,\n context,\n Counter,\n Histogram,\n Link,\n propagation,\n ROOT_CONTEXT,\n Span,\n SpanKind,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n isWrapped,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n ERROR_TYPE_VALUE_OTHER,\n} from '@opentelemetry/semantic-conventions';\nimport type { Kafka, Transaction, Producer, ConsumerEvents, ProducerEvents, RequestEvent } from './kafkajs-types';\nimport type {\n Consumer,\n ConsumerRunConfig,\n EachBatchHandler,\n EachMessageHandler,\n KafkaMessage,\n Message,\n RecordMetadata,\n} from './kafkajs-types';\nimport { EVENT_LISTENERS_SET } from './internal-types';\nimport { bufferTextMapGetter } from './propagator';\nimport {\n ATTR_MESSAGING_BATCH_MESSAGE_COUNT,\n ATTR_MESSAGING_DESTINATION_NAME,\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n ATTR_MESSAGING_KAFKA_MESSAGE_KEY,\n ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE,\n ATTR_MESSAGING_KAFKA_OFFSET,\n ATTR_MESSAGING_OPERATION_NAME,\n ATTR_MESSAGING_OPERATION_TYPE,\n ATTR_MESSAGING_SYSTEM,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n MESSAGING_OPERATION_TYPE_VALUE_SEND,\n MESSAGING_SYSTEM_VALUE_KAFKA,\n METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES,\n METRIC_MESSAGING_CLIENT_OPERATION_DURATION,\n METRIC_MESSAGING_CLIENT_SENT_MESSAGES,\n METRIC_MESSAGING_PROCESS_DURATION,\n} from './semconv';\nimport { KafkaJsInstrumentationConfig } from './types';\n\ninterface ConsumerSpanOptions {\n topic: string;\n message: KafkaMessage | undefined;\n operationType: string;\n attributes: Attributes;\n ctx?: Context | undefined;\n link?: Link;\n}\nimport { SDK_VERSION } from '@sentry/core';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-kafkajs';\n\n// This interface acts as a strict subset of the KafkaJS Consumer and\n// Producer interfaces (just for the event we're needing)\ninterface KafkaEventEmitter {\n on(eventName: ConsumerEvents['REQUEST'] | ProducerEvents['REQUEST'], listener: (event: RequestEvent) => void): void;\n events: {\n REQUEST: ConsumerEvents['REQUEST'] | ProducerEvents['REQUEST'];\n };\n [EVENT_LISTENERS_SET]?: boolean;\n}\n\ninterface StandardAttributes<OP extends string = string> extends Attributes {\n [ATTR_MESSAGING_SYSTEM]: string;\n [ATTR_MESSAGING_OPERATION_NAME]: OP;\n [ATTR_ERROR_TYPE]?: string;\n}\ninterface TopicAttributes {\n [ATTR_MESSAGING_DESTINATION_NAME]: string;\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]?: string;\n}\n\ninterface ClientDurationAttributes extends StandardAttributes, Partial<TopicAttributes> {\n [ATTR_SERVER_ADDRESS]: string;\n [ATTR_SERVER_PORT]: number;\n [ATTR_MESSAGING_OPERATION_TYPE]?: string;\n}\ninterface SentMessagesAttributes extends StandardAttributes<'send'>, TopicAttributes {\n [ATTR_ERROR_TYPE]?: string;\n}\ntype ConsumedMessagesAttributes = StandardAttributes<'receive' | 'process'>;\ninterface MessageProcessDurationAttributes extends StandardAttributes<'process'>, TopicAttributes {\n [ATTR_MESSAGING_SYSTEM]: string;\n [ATTR_MESSAGING_OPERATION_NAME]: 'process';\n [ATTR_ERROR_TYPE]?: string;\n}\ntype RecordPendingMetric = (errorType?: string | undefined) => void;\n\nfunction prepareCounter<T extends Attributes>(meter: Counter<T>, value: number, attributes: T): RecordPendingMetric {\n return (errorType?: string | undefined) => {\n meter.add(value, {\n ...attributes,\n ...(errorType ? { [ATTR_ERROR_TYPE]: errorType } : {}),\n });\n };\n}\n\nfunction prepareDurationHistogram<T extends Attributes>(\n meter: Histogram<T>,\n value: number,\n attributes: T,\n): RecordPendingMetric {\n return (errorType?: string | undefined) => {\n meter.record((Date.now() - value) / 1000, {\n ...attributes,\n ...(errorType ? { [ATTR_ERROR_TYPE]: errorType } : {}),\n });\n };\n}\n\nconst HISTOGRAM_BUCKET_BOUNDARIES = [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10];\nexport class KafkaJsInstrumentation extends InstrumentationBase<KafkaJsInstrumentationConfig> {\n declare private _clientDuration: Histogram<ClientDurationAttributes>;\n declare private _sentMessages: Counter<SentMessagesAttributes>;\n declare private _consumedMessages: Counter<ConsumedMessagesAttributes>;\n declare private _processDuration: Histogram<MessageProcessDurationAttributes>;\n\n constructor(config: KafkaJsInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n override _updateMetricInstruments() {\n this._clientDuration = this.meter.createHistogram(METRIC_MESSAGING_CLIENT_OPERATION_DURATION, {\n advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES },\n });\n this._sentMessages = this.meter.createCounter(METRIC_MESSAGING_CLIENT_SENT_MESSAGES);\n this._consumedMessages = this.meter.createCounter(METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES);\n this._processDuration = this.meter.createHistogram(METRIC_MESSAGING_PROCESS_DURATION, {\n advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES },\n });\n }\n\n protected init() {\n const unpatch = (moduleExports: any) => {\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 if (isWrapped(newConsumer.run)) {\n instrumentation._unwrap(newConsumer, 'run');\n }\n\n instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());\n\n instrumentation._setKafkaEventListeners(newConsumer);\n\n return newConsumer;\n };\n };\n }\n\n private _setKafkaEventListeners(kafkaObj: KafkaEventEmitter) {\n if (kafkaObj[EVENT_LISTENERS_SET]) return;\n\n // The REQUEST Consumer event was added in kafkajs@1.5.0.\n if (kafkaObj.events?.REQUEST) {\n kafkaObj.on(kafkaObj.events.REQUEST, this._recordClientDurationMetric.bind(this));\n }\n\n kafkaObj[EVENT_LISTENERS_SET] = true;\n }\n\n private _recordClientDurationMetric(event: Pick<RequestEvent, 'payload'>) {\n const [address = '', port = '0'] = event.payload.broker.split(':');\n this._clientDuration.record(event.payload.duration / 1000, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: `${event.payload.apiName}`,\n [ATTR_SERVER_ADDRESS]: address,\n [ATTR_SERVER_PORT]: Number.parseInt(port, 10),\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 if (isWrapped(newProducer.sendBatch)) {\n instrumentation._unwrap(newProducer, 'sendBatch');\n }\n instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());\n\n if (isWrapped(newProducer.send)) {\n instrumentation._unwrap(newProducer, 'send');\n }\n instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());\n\n if (isWrapped(newProducer.transaction)) {\n instrumentation._unwrap(newProducer, 'transaction');\n }\n instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());\n\n instrumentation._setKafkaEventListeners(newProducer);\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 const instrumentation = this;\n return (original: ConsumerRunConfig['eachMessage']) => {\n return function eachMessage(this: unknown, ...args: Parameters<EachMessageHandler>): Promise<void> {\n const payload = args[0];\n const propagatedContext: Context = propagation.extract(\n ROOT_CONTEXT,\n payload.message.headers,\n bufferTextMapGetter,\n );\n const span = instrumentation._startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n ctx: propagatedContext,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const pendingMetrics: RecordPendingMetric[] = [\n prepareDurationHistogram(instrumentation._processDuration, Date.now(), {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n }),\n prepareCounter(instrumentation._consumedMessages, 1, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n }),\n ];\n\n const eachMessagePromise = context.with(trace.setSpan(propagatedContext, span), () => {\n return original!.apply(this, args);\n });\n return instrumentation._endSpansOnPromise([span], pendingMetrics, eachMessagePromise);\n };\n };\n }\n\n private _getConsumerEachBatchPatch() {\n return (original: ConsumerRunConfig['eachBatch']) => {\n const instrumentation = this;\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 const receivingSpan = instrumentation._startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n ctx: ROOT_CONTEXT,\n attributes: {\n [ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n });\n return context.with(trace.setSpan(context.active(), receivingSpan), () => {\n const startTime = Date.now();\n const spans: Span[] = [];\n const pendingMetrics: RecordPendingMetric[] = [\n prepareCounter(instrumentation._consumedMessages, payload.batch.messages.length, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n }),\n ];\n payload.batch.messages.forEach((message: any) => {\n const propagatedContext: Context = propagation.extract(ROOT_CONTEXT, message.headers, bufferTextMapGetter);\n const spanContext = trace.getSpan(propagatedContext)?.spanContext();\n let origSpanLink: Link | undefined;\n if (spanContext) {\n origSpanLink = {\n context: spanContext,\n };\n }\n spans.push(\n instrumentation._startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n link: origSpanLink,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n pendingMetrics.push(\n prepareDurationHistogram(instrumentation._processDuration, startTime, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'process',\n [ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n }),\n );\n });\n const batchMessagePromise: Promise<void> = original!.apply(this, args);\n spans.unshift(receivingSpan);\n return instrumentation._endSpansOnPromise(spans, pendingMetrics, 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 = instrumentation.tracer.startSpan('transaction');\n\n const transactionPromise = original.apply(this, args);\n\n transactionPromise\n .then((transaction: Transaction) => {\n const originalSend = transaction.send;\n transaction.send = function send(this: Transaction, ...args) {\n return context.with(trace.setSpan(context.active(), transactionSpan), () => {\n const patched = instrumentation._getSendPatch()(originalSend);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n transactionSpan.recordException(err);\n throw err;\n });\n });\n };\n\n const originalSendBatch = transaction.sendBatch;\n transaction.sendBatch = function sendBatch(this: Transaction, ...args) {\n return context.with(trace.setSpan(context.active(), transactionSpan), () => {\n const patched = instrumentation._getSendBatchPatch()(originalSendBatch);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n transactionSpan.recordException(err);\n throw err;\n });\n });\n };\n\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: SpanStatusCode.OK });\n });\n return instrumentation._endSpansOnPromise([transactionSpan], [], originCommitPromise);\n };\n\n const originalAbort = transaction.abort;\n transaction.abort = function abort(this: Transaction, ...args) {\n const originAbortPromise = originalAbort.apply(this, args);\n return instrumentation._endSpansOnPromise([transactionSpan], [], originAbortPromise);\n };\n })\n .catch((err: any) => {\n transactionSpan.setStatus({\n code: SpanStatusCode.ERROR,\n message: err?.message,\n });\n transactionSpan.recordException(err);\n transactionSpan.end();\n });\n\n return transactionPromise;\n };\n };\n }\n\n private _getSendBatchPatch() {\n const instrumentation = this;\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 const pendingMetrics: RecordPendingMetric[] = [];\n\n messages.forEach((topicMessage: any) => {\n topicMessage.messages.forEach((message: any) => {\n spans.push(instrumentation._startProducerSpan(topicMessage.topic, message));\n pendingMetrics.push(\n prepareCounter(instrumentation._sentMessages, 1, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_DESTINATION_NAME]: topicMessage.topic,\n ...(message.partition !== undefined\n ? {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(message.partition),\n }\n : {}),\n }),\n );\n });\n });\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return instrumentation._endSpansOnPromise(spans, pendingMetrics, origSendResult);\n };\n };\n }\n\n private _getSendPatch() {\n const instrumentation = this;\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 instrumentation._startProducerSpan(record.topic, message);\n });\n\n const pendingMetrics: RecordPendingMetric[] = record.messages.map((m: any) =>\n prepareCounter(instrumentation._sentMessages, 1, {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_DESTINATION_NAME]: record.topic,\n ...(m.partition !== undefined\n ? {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(m.partition),\n }\n : {}),\n }),\n );\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return instrumentation._endSpansOnPromise(spans, pendingMetrics, origSendResult);\n };\n };\n }\n\n private _endSpansOnPromise<T>(\n spans: Span[],\n pendingMetrics: RecordPendingMetric[],\n sendPromise: Promise<T>,\n ): Promise<T> {\n return Promise.resolve(sendPromise)\n .then(result => {\n pendingMetrics.forEach(m => m());\n return result;\n })\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 pendingMetrics.forEach(m => m(errorType));\n\n spans.forEach(span => {\n span.setAttribute(ATTR_ERROR_TYPE, errorType);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: errorMessage,\n });\n });\n\n throw reason;\n })\n .finally(() => {\n spans.forEach(span => span.end());\n });\n }\n\n private _startConsumerSpan({ topic, message, operationType, ctx, link, attributes }: ConsumerSpanOptions) {\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 const span = this.tracer.startSpan(\n `${operationName} ${topic}`,\n {\n kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SpanKind.CLIENT : SpanKind.CONSUMER,\n attributes: {\n ...attributes,\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_OPERATION_TYPE]: operationType,\n [ATTR_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 },\n links: link ? [link] : [],\n },\n ctx,\n );\n\n const { consumerHook } = this.getConfig();\n if (consumerHook && message) {\n safeExecuteInTheMiddle(\n () => consumerHook(span, { topic, message }),\n e => {\n if (e) this._diag.error('consumerHook error', e);\n },\n true,\n );\n }\n\n return span;\n }\n\n private _startProducerSpan(topic: string, message: Message) {\n const span = this.tracer.startSpan(`send ${topic}`, {\n kind: SpanKind.PRODUCER,\n attributes: {\n [ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [ATTR_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 [ATTR_MESSAGING_OPERATION_NAME]: 'send',\n [ATTR_MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,\n },\n });\n\n message.headers = message.headers ?? {};\n propagation.inject(trace.setSpan(context.active(), span), message.headers);\n\n const { producerHook } = this.getConfig();\n if (producerHook) {\n safeExecuteInTheMiddle(\n () => producerHook(span, { topic, message }),\n e => {\n if (e) this._diag.error('producerHook error', e);\n },\n true,\n );\n }\n\n return span;\n }\n}\n"],"names":["ATTR_ERROR_TYPE","InstrumentationBase","SDK_VERSION","METRIC_MESSAGING_CLIENT_OPERATION_DURATION","METRIC_MESSAGING_CLIENT_SENT_MESSAGES","METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES","METRIC_MESSAGING_PROCESS_DURATION","isWrapped","InstrumentationNodeModuleDefinition","instrumentation","EVENT_LISTENERS_SET","ATTR_MESSAGING_SYSTEM","MESSAGING_SYSTEM_VALUE_KAFKA","ATTR_MESSAGING_OPERATION_NAME","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","propagation","ROOT_CONTEXT","bufferTextMapGetter","MESSAGING_OPERATION_TYPE_VALUE_PROCESS","ATTR_MESSAGING_DESTINATION_PARTITION_ID","ATTR_MESSAGING_DESTINATION_NAME","context","trace","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","ATTR_MESSAGING_BATCH_MESSAGE_COUNT","transaction","args","SpanStatusCode","ERROR_TYPE_VALUE_OTHER","SpanKind","ATTR_MESSAGING_OPERATION_TYPE","ATTR_MESSAGING_KAFKA_MESSAGE_KEY","ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE","ATTR_MESSAGING_KAFKA_OFFSET","safeExecuteInTheMiddle","MESSAGING_OPERATION_TYPE_VALUE_SEND"],"mappings":";;;;;;;;;;AAiFA,MAAM,YAAA,GAAe,iCAAA;AAsCrB,SAAS,cAAA,CAAqC,KAAA,EAAmB,KAAA,EAAe,UAAA,EAAoC;AAClH,EAAA,OAAO,CAAC,SAAA,KAAmC;AACzC,IAAA,KAAA,CAAM,IAAI,KAAA,EAAO;AAAA,MACf,GAAG,UAAA;AAAA,MACH,GAAI,YAAY,EAAE,CAACA,mCAAe,GAAG,SAAA,KAAc;AAAC,KACrD,CAAA;AAAA,EACH,CAAA;AACF;AAEA,SAAS,wBAAA,CACP,KAAA,EACA,KAAA,EACA,UAAA,EACqB;AACrB,EAAA,OAAO,CAAC,SAAA,KAAmC;AACzC,IAAA,KAAA,CAAM,MAAA,CAAA,CAAQ,IAAA,CAAK,GAAA,EAAI,GAAI,SAAS,GAAA,EAAM;AAAA,MACxC,GAAG,UAAA;AAAA,MACH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CAAQ,KAAA,KAAU,OAAO,IAAA,GAAO,MAAA;AAAA,QACzF,CAACb,+CAAuC,GACtC,OAAA,CAAQ,cAAc,MAAA,GAAY,MAAA,CAAO,OAAA,CAAQ,SAAS,CAAA,GAAI,MAAA;AAAA,QAChE,CAACP,qCAA6B,GAAG,MAAA;AAAA,QACjC,CAACkB,qCAA6B,GAAGK;AAAA;AACnC,KACD,CAAA;AAED,IAAA,OAAA,CAAQ,OAAA,GAAU,OAAA,CAAQ,OAAA,IAAW,EAAC;AACtC,IAAApB,eAAA,CAAY,MAAA,CAAOO,UAAM,OAAA,CAAQD,WAAA,CAAQ,QAAO,EAAG,IAAI,CAAA,EAAG,OAAA,CAAQ,OAAO,CAAA;AAEzE,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,IAAA,CAAK,SAAA,EAAU;AACxC,IAAA,IAAI,YAAA,EAAc;AAChB,MAAAa,sCAAA;AAAA,QACE,MAAM,YAAA,CAAa,IAAA,EAAM,EAAE,KAAA,EAAO,SAAS,CAAA;AAAA,QAC3C,CAAA,CAAA,KAAK;AACH,UAAA,IAAI,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,sBAAsB,CAAC,CAAA;AAAA,QACjD,CAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-types.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/internal-types.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n
|
|
1
|
+
{"version":3,"file":"internal-types.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/internal-types.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 */\n/* eslint-disable */\n\nimport type { Consumer, Producer } from './kafkajs-types';\n\nexport const EVENT_LISTENERS_SET = Symbol('opentelemetry.instrumentation.kafkajs.eventListenersSet');\n\nexport interface ConsumerExtended extends Consumer {\n [EVENT_LISTENERS_SET]?: boolean; // flag to identify if the event listeners for instrumentation have been set\n}\n\nexport interface ProducerExtended extends Producer {\n [EVENT_LISTENERS_SET]?: boolean; // flag to identify if the event listeners for instrumentation have been set\n}\n"],"names":[],"mappings":";;AAaO,MAAM,mBAAA,0BAA6B,yDAAyD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propagator.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/propagator.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n
|
|
1
|
+
{"version":3,"file":"propagator.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/propagator.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 */\n/* eslint-disable */\n\nimport type { TextMapGetter } from '@opentelemetry/api';\n\n/*\nsame as open telemetry's `defaultTextMapGetter`,\nbut also handle case where header is buffer,\nadding toString() to make sure string is returned\n*/\nexport const bufferTextMapGetter: TextMapGetter = {\n get(carrier, key) {\n if (!carrier) {\n return undefined;\n }\n\n const keys = Object.keys(carrier);\n\n for (const carrierKey of keys) {\n if (carrierKey === key || carrierKey.toLowerCase() === key) {\n return carrier[carrierKey]?.toString();\n }\n }\n\n return undefined;\n },\n\n keys(carrier) {\n return carrier ? Object.keys(carrier) : [];\n },\n};\n"],"names":[],"mappings":";;AAiBO,MAAM,mBAAA,GAAqC;AAAA,EAChD,GAAA,CAAI,SAAS,GAAA,EAAK;AAChB,IAAA,IAAI,CAAC,OAAA,EAAS;AACZ,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA;AAEhC,IAAA,KAAA,MAAW,cAAc,IAAA,EAAM;AAC7B,MAAA,IAAI,UAAA,KAAe,GAAA,IAAO,UAAA,CAAW,WAAA,OAAkB,GAAA,EAAK;AAC1D,QAAA,OAAO,OAAA,CAAQ,UAAU,CAAA,EAAG,QAAA,EAAS;AAAA,MACvC;AAAA,IACF;AAEA,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AAAA,EAEA,KAAK,OAAA,EAAS;AACZ,IAAA,OAAO,OAAA,GAAU,MAAA,CAAO,IAAA,CAAK,OAAO,IAAI,EAAC;AAAA,EAC3C;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/kafka/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n
|
|
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 */\n/* eslint-disable */\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 number of messages sent, received, or processed in the scope of the batching operation.\n *\n * @example 0\n * @example 1\n * @example 2\n *\n * @note Instrumentations **SHOULD NOT** set `messaging.batch.message_count` on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations **SHOULD** use `messaging.batch.message_count` for batching APIs and **SHOULD NOT** use it for single-message APIs.\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_BATCH_MESSAGE_COUNT = 'messaging.batch.message_count' as const;\n\n/**\n * The message destination name\n *\n * @example MyQueue\n * @example MyTopic\n *\n * @note Destination name **SHOULD** uniquely identify a specific queue, topic or other entity within the broker. If\n * the broker doesn't have such notion, the destination name **SHOULD** uniquely identify the broker.\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_NAME = 'messaging.destination.name' as const;\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 * The system-specific name of the messaging operation.\n *\n * @example ack\n * @example nack\n * @example send\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_OPERATION_NAME = 'messaging.operation.name' as const;\n\n/**\n * A string identifying the type of the messaging operation.\n *\n * @note If a custom value is used, it **MUST** be of low cardinality.\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_OPERATION_TYPE = 'messaging.operation.type' as const;\n\n/**\n * The messaging system as identified by the client instrumentation.\n *\n * @note The actual messaging system may differ from the one known by the client. For example, when using Kafka client libraries to communicate with Azure Event Hubs, the `messaging.system` is set to `kafka` based on the instrumentation's best knowledge.\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_SYSTEM = 'messaging.system' as const;\n\n/**\n * Enum value \"process\" for attribute {@link ATTR_MESSAGING_OPERATION_TYPE}.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = 'process' as const;\n\n/**\n * Enum value \"receive\" for attribute {@link ATTR_MESSAGING_OPERATION_TYPE}.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = 'receive' as const;\n\n/**\n * Enum value \"send\" for attribute {@link ATTR_MESSAGING_OPERATION_TYPE}.\n */\nexport const MESSAGING_OPERATION_TYPE_VALUE_SEND = 'send' as const;\n\n/**\n * Enum value \"kafka\" for attribute {@link ATTR_MESSAGING_SYSTEM}.\n */\nexport const MESSAGING_SYSTEM_VALUE_KAFKA = 'kafka' as const;\n\n/**\n * Number of messages that were delivered to the application.\n *\n * @note Records the number of messages pulled from the broker or number of messages dispatched to the application in push-based scenarios.\n * The metric **SHOULD** be reported once per message delivery. For example, if receiving and processing operations are both instrumented for a single message delivery, this counter is incremented when the message is received and not reported when it is processed.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES = 'messaging.client.consumed.messages' as const;\n\n/**\n * Duration of messaging operation initiated by a producer or consumer client.\n *\n * @note This metric **SHOULD NOT** be used to report processing duration - processing duration is reported in `messaging.process.duration` metric.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_MESSAGING_CLIENT_OPERATION_DURATION = 'messaging.client.operation.duration' as const;\n\n/**\n * Number of messages producer attempted to send to the broker.\n *\n * @note This metric **MUST NOT** count messages that were created but haven't yet been sent.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_MESSAGING_CLIENT_SENT_MESSAGES = 'messaging.client.sent.messages' as const;\n\n/**\n * Duration of processing operation.\n *\n * @note This metric **MUST** be reported for operations with `messaging.operation.type` that matches `process`.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_MESSAGING_PROCESS_DURATION = 'messaging.process.duration' as const;\n"],"names":[],"mappings":";;AA2BO,MAAM,kCAAA,GAAqC;AAa3C,MAAM,+BAAA,GAAkC;AASxC,MAAM,uCAAA,GAA0C;AAWhD,MAAM,gCAAA,GAAmC;AAOzC,MAAM,sCAAA,GAAyC;AAS/C,MAAM,2BAAA,GAA8B;AAWpC,MAAM,6BAAA,GAAgC;AAQtC,MAAM,6BAAA,GAAgC;AAStC,MAAM,qBAAA,GAAwB;AAK9B,MAAM,sCAAA,GAAyC;AAK/C,MAAM,sCAAA,GAAyC;AAK/C,MAAM,mCAAA,GAAsC;AAK5C,MAAM,4BAAA,GAA+B;AAUrC,MAAM,yCAAA,GAA4C;AASlD,MAAM,0CAAA,GAA6C;AASnD,MAAM,qCAAA,GAAwC;AAS9C,MAAM,iCAAA,GAAoC;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,27 +5,12 @@ const core = require('@sentry/core');
|
|
|
5
5
|
const nodeCore = require('@sentry/node-core');
|
|
6
6
|
|
|
7
7
|
const INTEGRATION_NAME = "Knex";
|
|
8
|
-
const instrumentKnex = nodeCore.generateInstrumentOnce(
|
|
9
|
-
INTEGRATION_NAME,
|
|
10
|
-
() => new instrumentation.KnexInstrumentation({ requireParentSpan: true })
|
|
11
|
-
);
|
|
8
|
+
const instrumentKnex = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new instrumentation.KnexInstrumentation());
|
|
12
9
|
const _knexIntegration = (() => {
|
|
13
|
-
let instrumentationWrappedCallback;
|
|
14
10
|
return {
|
|
15
11
|
name: INTEGRATION_NAME,
|
|
16
12
|
setupOnce() {
|
|
17
|
-
|
|
18
|
-
instrumentationWrappedCallback = nodeCore.instrumentWhenWrapped(instrumentation);
|
|
19
|
-
},
|
|
20
|
-
setup(client) {
|
|
21
|
-
instrumentationWrappedCallback?.(
|
|
22
|
-
() => client.on("spanStart", (span) => {
|
|
23
|
-
const { data } = core.spanToJSON(span);
|
|
24
|
-
if ("knex.version" in data) {
|
|
25
|
-
span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, "auto.db.otel.knex");
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
);
|
|
13
|
+
instrumentKnex();
|
|
29
14
|
}
|
|
30
15
|
};
|
|
31
16
|
});
|
|
@@ -1 +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
|
|
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';\n\nconst INTEGRATION_NAME = 'Knex';\n\nexport const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());\n\nconst _knexIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKnex();\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":["generateInstrumentOnce","KnexInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,qCAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,cAAA,EAAe;AAAA,IACjB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,eAAA,GAAkBC,uBAAkB,gBAAgB;;;;;"}
|
|
@@ -1,61 +1,63 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const api = require('@opentelemetry/api');
|
|
4
|
-
const core = require('@sentry/core');
|
|
5
|
-
const constants = require('./constants.js');
|
|
6
4
|
const instrumentation = require('@opentelemetry/instrumentation');
|
|
5
|
+
const core = require('@sentry/core');
|
|
7
6
|
const InstrumentationNodeModuleFile = require('../../InstrumentationNodeModuleFile.js');
|
|
8
|
-
const utils = require('./utils.js');
|
|
9
|
-
const semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
10
7
|
const semconv = require('./semconv.js');
|
|
8
|
+
const utils = require('./utils.js');
|
|
11
9
|
|
|
12
10
|
const PACKAGE_NAME = "@sentry/instrumentation-knex";
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const ORIGIN = "auto.db.otel.knex";
|
|
12
|
+
const MODULE_NAME = "knex";
|
|
13
|
+
const SUPPORTED_VERSIONS = [
|
|
14
|
+
// use "lib/execution" for runner.js, "lib" for client.js as basepath, latest tested 0.95.6
|
|
15
|
+
">=0.22.0 <4",
|
|
16
|
+
// use "lib" as basepath
|
|
17
|
+
">=0.10.0 <0.18.0",
|
|
18
|
+
">=0.19.0 <0.22.0",
|
|
19
|
+
// use "src" as basepath
|
|
20
|
+
">=0.18.0 <0.19.0"
|
|
21
|
+
];
|
|
22
|
+
const MAX_QUERY_LENGTH = 1022;
|
|
23
|
+
const parentSpanSymbol = /* @__PURE__ */ Symbol("sentry.instrumentation-knex.parent-span");
|
|
18
24
|
class KnexInstrumentation extends instrumentation.InstrumentationBase {
|
|
19
25
|
constructor(config = {}) {
|
|
20
|
-
super(PACKAGE_NAME, core.SDK_VERSION,
|
|
21
|
-
this._semconvStability = instrumentation.semconvStabilityFromStr("database", process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
|
|
22
|
-
}
|
|
23
|
-
setConfig(config = {}) {
|
|
24
|
-
super.setConfig({ ...DEFAULT_CONFIG, ...config });
|
|
26
|
+
super(PACKAGE_NAME, core.SDK_VERSION, config);
|
|
25
27
|
}
|
|
26
28
|
init() {
|
|
27
|
-
const module = new instrumentation.InstrumentationNodeModuleDefinition(
|
|
29
|
+
const module = new instrumentation.InstrumentationNodeModuleDefinition(MODULE_NAME, SUPPORTED_VERSIONS);
|
|
28
30
|
module.files.push(
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
31
|
+
this._getClientNodeModuleFileInstrumentation("src"),
|
|
32
|
+
this._getClientNodeModuleFileInstrumentation("lib"),
|
|
33
|
+
this._getRunnerNodeModuleFileInstrumentation("src"),
|
|
34
|
+
this._getRunnerNodeModuleFileInstrumentation("lib"),
|
|
35
|
+
this._getRunnerNodeModuleFileInstrumentation("lib/execution")
|
|
34
36
|
);
|
|
35
37
|
return module;
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
_getRunnerNodeModuleFileInstrumentation(basePath) {
|
|
38
40
|
return new InstrumentationNodeModuleFile.InstrumentationNodeModuleFile(
|
|
39
41
|
`knex/${basePath}/runner.js`,
|
|
40
|
-
|
|
42
|
+
SUPPORTED_VERSIONS,
|
|
41
43
|
(Runner, moduleVersion) => {
|
|
42
|
-
this.
|
|
44
|
+
this._ensureWrapped(Runner.prototype, "query", this._createQueryWrapper(moduleVersion));
|
|
43
45
|
return Runner;
|
|
44
46
|
},
|
|
45
|
-
(Runner
|
|
47
|
+
(Runner) => {
|
|
46
48
|
this._unwrap(Runner.prototype, "query");
|
|
47
49
|
return Runner;
|
|
48
50
|
}
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
_getClientNodeModuleFileInstrumentation(basePath) {
|
|
52
54
|
return new InstrumentationNodeModuleFile.InstrumentationNodeModuleFile(
|
|
53
55
|
`knex/${basePath}/client.js`,
|
|
54
|
-
|
|
56
|
+
SUPPORTED_VERSIONS,
|
|
55
57
|
(Client) => {
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
58
|
+
this._ensureWrapped(Client.prototype, "queryBuilder", this._storeContext.bind(this));
|
|
59
|
+
this._ensureWrapped(Client.prototype, "schemaBuilder", this._storeContext.bind(this));
|
|
60
|
+
this._ensureWrapped(Client.prototype, "raw", this._storeContext.bind(this));
|
|
59
61
|
return Client;
|
|
60
62
|
},
|
|
61
63
|
(Client) => {
|
|
@@ -66,8 +68,7 @@ class KnexInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
66
68
|
}
|
|
67
69
|
);
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
const instrumentation$1 = this;
|
|
71
|
+
_createQueryWrapper(moduleVersion) {
|
|
71
72
|
return function wrapQuery(original) {
|
|
72
73
|
return function wrapped_logging_method(query) {
|
|
73
74
|
const config = this.client.config;
|
|
@@ -75,83 +76,54 @@ class KnexInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
75
76
|
const operation = query?.method;
|
|
76
77
|
const connectionString = config?.connection?.connectionString;
|
|
77
78
|
const name = config?.connection?.filename || config?.connection?.database || utils.extractDatabaseFromConnectionString(connectionString);
|
|
78
|
-
const { maxQueryLength } = instrumentation$1.getConfig();
|
|
79
79
|
const attributes = {
|
|
80
|
-
|
|
80
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
81
|
+
"knex.version": moduleVersion,
|
|
82
|
+
[semconv.ATTR_DB_SYSTEM]: utils.mapSystem(this.client.driverName),
|
|
83
|
+
[semconv.ATTR_DB_SQL_TABLE]: table,
|
|
84
|
+
[semconv.ATTR_DB_OPERATION]: operation,
|
|
85
|
+
[semconv.ATTR_DB_USER]: config?.connection?.user,
|
|
86
|
+
[semconv.ATTR_DB_NAME]: name,
|
|
87
|
+
[semconv.ATTR_NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),
|
|
88
|
+
[semconv.ATTR_NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),
|
|
89
|
+
[semconv.ATTR_NET_TRANSPORT]: config?.connection?.filename === ":memory:" ? "inproc" : void 0,
|
|
90
|
+
[semconv.ATTR_DB_STATEMENT]: utils.limitLength(query?.sql, MAX_QUERY_LENGTH)
|
|
81
91
|
};
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
[semconv.ATTR_DB_SYSTEM]: utils.mapSystem(this.client.driverName),
|
|
86
|
-
[semconv.ATTR_DB_SQL_TABLE]: table,
|
|
87
|
-
[semconv.ATTR_DB_OPERATION]: operation,
|
|
88
|
-
[semconv.ATTR_DB_USER]: config?.connection?.user,
|
|
89
|
-
[semconv.ATTR_DB_NAME]: name,
|
|
90
|
-
[semconv.ATTR_NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),
|
|
91
|
-
[semconv.ATTR_NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),
|
|
92
|
-
[semconv.ATTR_NET_TRANSPORT]: transport
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (instrumentation$1._semconvStability & instrumentation.SemconvStability.STABLE) {
|
|
96
|
-
Object.assign(attributes, {
|
|
97
|
-
[semanticConventions.ATTR_DB_SYSTEM_NAME]: utils.mapSystem(this.client.driverName),
|
|
98
|
-
[semanticConventions.ATTR_DB_COLLECTION_NAME]: table,
|
|
99
|
-
[semanticConventions.ATTR_DB_OPERATION_NAME]: operation,
|
|
100
|
-
[semanticConventions.ATTR_DB_NAMESPACE]: name,
|
|
101
|
-
[semanticConventions.ATTR_SERVER_ADDRESS]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),
|
|
102
|
-
[semanticConventions.ATTR_SERVER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString)
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (maxQueryLength) {
|
|
106
|
-
const queryText = utils.limitLength(query?.sql, maxQueryLength);
|
|
107
|
-
if (instrumentation$1._semconvStability & instrumentation.SemconvStability.STABLE) {
|
|
108
|
-
attributes[semanticConventions.ATTR_DB_QUERY_TEXT] = queryText;
|
|
109
|
-
}
|
|
110
|
-
if (instrumentation$1._semconvStability & instrumentation.SemconvStability.OLD) {
|
|
111
|
-
attributes[semconv.ATTR_DB_STATEMENT] = queryText;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const parentContext = this.builder[contextSymbol] || api.context.active();
|
|
115
|
-
const parentSpan = api.trace.getSpan(parentContext);
|
|
116
|
-
const hasActiveParent = parentSpan && api.trace.isSpanContextValid(parentSpan.spanContext());
|
|
117
|
-
if (instrumentation$1._config.requireParentSpan && !hasActiveParent) {
|
|
118
|
-
return original.bind(this)(...arguments);
|
|
119
|
-
}
|
|
120
|
-
const span = instrumentation$1.tracer.startSpan(
|
|
121
|
-
utils.getName(name, operation, table),
|
|
92
|
+
const parentSpan = this.builder[parentSpanSymbol] || core.getActiveSpan();
|
|
93
|
+
const args = arguments;
|
|
94
|
+
return core.startSpan(
|
|
122
95
|
{
|
|
96
|
+
name: utils.getName(name, operation, table),
|
|
123
97
|
kind: api.SpanKind.CLIENT,
|
|
124
|
-
attributes
|
|
98
|
+
attributes,
|
|
99
|
+
parentSpan,
|
|
100
|
+
onlyIfParent: true
|
|
125
101
|
},
|
|
126
|
-
|
|
102
|
+
(span) => (
|
|
103
|
+
// `Runner.query` returns a real, already-executing Promise, so it is safe to let
|
|
104
|
+
// `startSpan` await it and auto-end the span.
|
|
105
|
+
original.apply(this, args).catch((err) => {
|
|
106
|
+
const formatter = utils.getFormatter(this);
|
|
107
|
+
const fullQuery = formatter(query.sql, query.bindings || []);
|
|
108
|
+
const message = err.message.replace(`${fullQuery} - `, "");
|
|
109
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message });
|
|
110
|
+
throw err;
|
|
111
|
+
})
|
|
112
|
+
)
|
|
127
113
|
);
|
|
128
|
-
const spanContext = api.trace.setSpan(api.context.active(), span);
|
|
129
|
-
return api.context.with(spanContext, original, this, ...arguments).then((result) => {
|
|
130
|
-
span.end();
|
|
131
|
-
return result;
|
|
132
|
-
}).catch((err) => {
|
|
133
|
-
const formatter = utils.getFormatter(this);
|
|
134
|
-
const fullQuery = formatter(query.sql, query.bindings || []);
|
|
135
|
-
const message = err.message.replace(fullQuery + " - ", "");
|
|
136
|
-
const exc = utils.otelExceptionFromKnexError(err, message);
|
|
137
|
-
span.recordException(exc);
|
|
138
|
-
span.setStatus({ code: api.SpanStatusCode.ERROR, message });
|
|
139
|
-
span.end();
|
|
140
|
-
throw err;
|
|
141
|
-
});
|
|
142
114
|
};
|
|
143
115
|
};
|
|
144
116
|
}
|
|
145
|
-
|
|
117
|
+
_storeContext(original) {
|
|
146
118
|
return function wrapped_logging_method() {
|
|
147
119
|
const builder = original.apply(this, arguments);
|
|
148
|
-
Object.defineProperty(builder,
|
|
149
|
-
value:
|
|
120
|
+
Object.defineProperty(builder, parentSpanSymbol, {
|
|
121
|
+
value: core.getActiveSpan()
|
|
150
122
|
});
|
|
151
123
|
return builder;
|
|
152
124
|
};
|
|
153
125
|
}
|
|
154
|
-
|
|
126
|
+
_ensureWrapped(obj, methodName, wrapper) {
|
|
155
127
|
if (instrumentation.isWrapped(obj[methodName])) {
|
|
156
128
|
this._unwrap(obj, methodName);
|
|
157
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/knex/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\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 */\n/* eslint-disable */\n\nimport * as api from '@opentelemetry/api';\nimport { SDK_VERSION } from '@sentry/core';\nimport * as constants from './constants';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n isWrapped,\n SemconvStability,\n semconvStabilityFromStr,\n} from '@opentelemetry/instrumentation';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport * as utils from './utils';\nimport { KnexInstrumentationConfig } from './types';\nimport {\n ATTR_DB_COLLECTION_NAME,\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_SYSTEM_NAME,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DB_NAME,\n ATTR_DB_OPERATION,\n ATTR_DB_SQL_TABLE,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_DB_USER,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n ATTR_NET_TRANSPORT,\n} from './semconv';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-knex';\n\nconst contextSymbol = Symbol('opentelemetry.instrumentation-knex.context');\nconst DEFAULT_CONFIG: KnexInstrumentationConfig = {\n maxQueryLength: 1022,\n requireParentSpan: false,\n};\n\nexport class KnexInstrumentation extends InstrumentationBase<KnexInstrumentationConfig> {\n private _semconvStability: SemconvStability;\n\n constructor(config: KnexInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, { ...DEFAULT_CONFIG, ...config });\n\n this._semconvStability = semconvStabilityFromStr('database', process.env.OTEL_SEMCONV_STABILITY_OPT_IN);\n }\n\n override setConfig(config: KnexInstrumentationConfig = {}) {\n super.setConfig({ ...DEFAULT_CONFIG, ...config });\n }\n\n init() {\n const module = new InstrumentationNodeModuleDefinition(constants.MODULE_NAME, constants.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) {\n return new InstrumentationNodeModuleFile(\n `knex/${basePath}/runner.js`,\n constants.SUPPORTED_VERSIONS,\n (Runner: any, moduleVersion?: string) => {\n this.ensureWrapped(Runner.prototype, 'query', this.createQueryWrapper(moduleVersion));\n return Runner;\n },\n (Runner: any, _moduleVersion?: string) => {\n this._unwrap(Runner.prototype, 'query');\n return Runner;\n },\n );\n }\n\n private getClientNodeModuleFileInstrumentation(basePath: string) {\n return new InstrumentationNodeModuleFile(\n `knex/${basePath}/client.js`,\n constants.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 const instrumentation = this;\n\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 const { maxQueryLength } = instrumentation.getConfig();\n\n const attributes: api.Attributes = {\n 'knex.version': moduleVersion,\n };\n const transport = config?.connection?.filename === ':memory:' ? 'inproc' : undefined;\n\n if (instrumentation._semconvStability & SemconvStability.OLD) {\n Object.assign(attributes, {\n [ATTR_DB_SYSTEM]: utils.mapSystem(this.client.driverName),\n [ATTR_DB_SQL_TABLE]: table,\n [ATTR_DB_OPERATION]: operation,\n [ATTR_DB_USER]: config?.connection?.user,\n [ATTR_DB_NAME]: name,\n [ATTR_NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),\n [ATTR_NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),\n [ATTR_NET_TRANSPORT]: transport,\n });\n }\n if (instrumentation._semconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, {\n [ATTR_DB_SYSTEM_NAME]: utils.mapSystem(this.client.driverName),\n [ATTR_DB_COLLECTION_NAME]: table,\n [ATTR_DB_OPERATION_NAME]: operation,\n [ATTR_DB_NAMESPACE]: name,\n [ATTR_SERVER_ADDRESS]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),\n [ATTR_SERVER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),\n });\n }\n if (maxQueryLength) {\n const queryText = utils.limitLength(query?.sql, maxQueryLength);\n if (instrumentation._semconvStability & SemconvStability.STABLE) {\n attributes[ATTR_DB_QUERY_TEXT] = queryText;\n }\n if (instrumentation._semconvStability & SemconvStability.OLD) {\n attributes[ATTR_DB_STATEMENT] = queryText;\n }\n }\n\n const parentContext = this.builder[contextSymbol] || api.context.active();\n const parentSpan = api.trace.getSpan(parentContext);\n const hasActiveParent = parentSpan && api.trace.isSpanContextValid(parentSpan.spanContext());\n if (instrumentation._config.requireParentSpan && !hasActiveParent) {\n return original.bind(this)(...arguments);\n }\n\n const span = instrumentation.tracer.startSpan(\n utils.getName(name, operation, table),\n {\n kind: api.SpanKind.CLIENT,\n attributes,\n },\n parentContext,\n );\n const spanContext = api.trace.setSpan(api.context.active(), span);\n\n return api.context\n .with(spanContext, original, this, ...arguments)\n .then((result: unknown) => {\n span.end();\n return result;\n })\n .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 const exc = utils.otelExceptionFromKnexError(err, message);\n span.recordException(exc);\n span.setStatus({ code: api.SpanStatusCode.ERROR, message });\n span.end();\n throw err;\n });\n };\n };\n }\n\n private storeContext(original: Function) {\n return function wrapped_logging_method(this: any) {\n const builder = original.apply(this, arguments);\n Object.defineProperty(builder, contextSymbol, {\n value: api.context.active(),\n });\n return builder;\n };\n }\n\n ensureWrapped(obj: any, methodName: string, wrapper: (original: any) => any) {\n if (isWrapped(obj[methodName])) {\n this._unwrap(obj, methodName);\n }\n this._wrap(obj, methodName, wrapper);\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","semconvStabilityFromStr","InstrumentationNodeModuleDefinition","constants.MODULE_NAME","constants.SUPPORTED_VERSIONS","InstrumentationNodeModuleFile","instrumentation","utils.extractTableName","utils.extractDatabaseFromConnectionString","SemconvStability","ATTR_DB_SYSTEM","utils.mapSystem","ATTR_DB_SQL_TABLE","ATTR_DB_OPERATION","ATTR_DB_USER","ATTR_DB_NAME","ATTR_NET_PEER_NAME","utils.extractHostFromConnectionString","ATTR_NET_PEER_PORT","utils.extractPortFromConnectionString","ATTR_NET_TRANSPORT","ATTR_DB_SYSTEM_NAME","ATTR_DB_COLLECTION_NAME","ATTR_DB_OPERATION_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","utils.limitLength","ATTR_DB_QUERY_TEXT","ATTR_DB_STATEMENT","utils.getName","utils.getFormatter","utils.otelExceptionFromKnexError","isWrapped"],"mappings":";;;;;;;;;;;AAwDA,MAAM,YAAA,GAAe,8BAAA;AAErB,MAAM,aAAA,0BAAuB,4CAA4C,CAAA;AACzE,MAAM,cAAA,GAA4C;AAAA,EAChD,cAAA,EAAgB,IAAA;AAAA,EAChB,iBAAA,EAAmB;AACrB,CAAA;AAEO,MAAM,4BAA4BA,mCAAA,CAA+C;AAAA,EAGtF,WAAA,CAAY,MAAA,GAAoC,EAAC,EAAG;AAClD,IAAA,KAAA,CAAM,cAAcC,gBAAA,EAAa,EAAE,GAAG,cAAA,EAAgB,GAAG,QAAQ,CAAA;AAEj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,OAAA;AAAA,IACT,CAAA;AAAA,EACF;AAAA,EAEA,aAAA,CAAc,GAAA,EAAU,UAAA,EAAoB,OAAA,EAAiC;AAC3E,IAAA,IAAIC,yBAAA,CAAU,GAAA,CAAI,UAAU,CAAC,CAAA,EAAG;AAC9B,MAAA,IAAA,CAAK,OAAA,CAAQ,KAAK,UAAU,CAAA;AAAA,IAC9B;AACA,IAAA,IAAA,CAAK,KAAA,CAAM,GAAA,EAAK,UAAA,EAAY,OAAO,CAAA;AAAA,EACrC;AACF;;;;"}
|
|
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 { SpanKind } from '@opentelemetry/api';\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_STATUS_ERROR,\n startSpan,\n} from '@sentry/core';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport {\n ATTR_DB_NAME,\n ATTR_DB_OPERATION,\n ATTR_DB_SQL_TABLE,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_DB_USER,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n ATTR_NET_TRANSPORT,\n} 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 [ATTR_DB_SYSTEM]: utils.mapSystem(this.client.driverName),\n [ATTR_DB_SQL_TABLE]: table,\n [ATTR_DB_OPERATION]: operation,\n [ATTR_DB_USER]: config?.connection?.user,\n [ATTR_DB_NAME]: name,\n [ATTR_NET_PEER_NAME]: config?.connection?.host ?? utils.extractHostFromConnectionString(connectionString),\n [ATTR_NET_PEER_PORT]: config?.connection?.port ?? utils.extractPortFromConnectionString(connectionString),\n [ATTR_NET_TRANSPORT]: config?.connection?.filename === ':memory:' ? 'inproc' : undefined,\n [ATTR_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: SpanKind.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":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","utils.extractTableName","utils.extractDatabaseFromConnectionString","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","ATTR_DB_SYSTEM","utils.mapSystem","ATTR_DB_SQL_TABLE","ATTR_DB_OPERATION","ATTR_DB_USER","ATTR_DB_NAME","ATTR_NET_PEER_NAME","utils.extractHostFromConnectionString","ATTR_NET_PEER_PORT","utils.extractPortFromConnectionString","ATTR_NET_TRANSPORT","ATTR_DB_STATEMENT","utils.limitLength","getActiveSpan","startSpan","utils.getName","SpanKind","utils.getFormatter","SPAN_STATUS_ERROR","isWrapped"],"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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