@sentry/node 10.58.0 → 10.60.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 +3 -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/index.js +7 -8
- package/build/cjs/integrations/node-fetch/index.js.map +1 -1
- package/build/cjs/integrations/node-fetch/vendored/semconv.js +28 -0
- package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/node-fetch/vendored/undici.js +91 -127
- 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/index.js +1 -11
- package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js +45 -247
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js +4 -8
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js +113 -0
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -0
- 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/cjs/sdk/initOtel.js +2 -1
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/esm/index.js +2 -1
- 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/index.js +8 -9
- package/build/esm/integrations/node-fetch/index.js.map +1 -1
- package/build/esm/integrations/node-fetch/vendored/semconv.js +15 -0
- package/build/esm/integrations/node-fetch/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/node-fetch/vendored/undici.js +80 -116
- 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/index.js +2 -12
- package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js +47 -249
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js +3 -5
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/utils.js +107 -0
- package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -0
- 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/esm/sdk/initOtel.js +2 -1
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/import-hook.mjs +6 -0
- package/build/types/index.d.ts +2 -1
- 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/index.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/semconv.d.ts +13 -0
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/vendored/types.d.ts +2 -4
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts +6 -7
- 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/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts +3 -13
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +0 -32
- package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts +9 -28
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/knex/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/sdk/initOtel.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -1
- 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/node-fetch/vendored/semconv.d.ts +13 -0
- package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +2 -4
- package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +6 -7
- 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/kafka/vendored/instrumentation.d.ts +3 -13
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +0 -32
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/semconv.d.ts +9 -28
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
- 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 -7
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js +0 -6
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +0 -1
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js +0 -22
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +0 -1
- 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/kafka/vendored/internal-types.js +0 -4
- package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +0 -1
- package/build/esm/integrations/tracing/kafka/vendored/propagator.js +0 -20
- package/build/esm/integrations/tracing/kafka/vendored/propagator.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/kafka/vendored/internal-types.d.ts +0 -9
- package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +0 -1
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts +0 -3
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +0 -1
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts +0 -26
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts.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/integrations/tracing/utils/sql-common.d.ts +0 -3
- package/build/types/integrations/tracing/utils/sql-common.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/internal-types.d.ts +0 -9
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/propagator.d.ts +0 -3
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/types.d.ts +0 -26
- 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
- package/build/types-ts3.8/integrations/tracing/utils/sql-common.d.ts +0 -3
|
@@ -1,43 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { bufferTextMapGetter } from './propagator.js';
|
|
6
|
-
import { METRIC_MESSAGING_CLIENT_OPERATION_DURATION, METRIC_MESSAGING_CLIENT_SENT_MESSAGES, METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES, METRIC_MESSAGING_PROCESS_DURATION, MESSAGING_SYSTEM_VALUE_KAFKA, ATTR_MESSAGING_OPERATION_NAME, ATTR_MESSAGING_SYSTEM, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_DESTINATION_NAME, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, ATTR_MESSAGING_BATCH_MESSAGE_COUNT, ATTR_MESSAGING_KAFKA_OFFSET, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_OPERATION_TYPE, MESSAGING_OPERATION_TYPE_VALUE_SEND } from './semconv.js';
|
|
7
|
-
import { SDK_VERSION } from '@sentry/core';
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { SDK_VERSION, continueTrace, withActiveSpan, startNewTrace, startInactiveSpan, SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';
|
|
3
|
+
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_BATCH_MESSAGE_COUNT, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE } from './semconv.js';
|
|
4
|
+
import { getHeaderAsString, startConsumerSpan, endSpansOnPromise, getLinksFromHeaders, startProducerSpan } from './utils.js';
|
|
8
5
|
|
|
9
6
|
const PACKAGE_NAME = "@sentry/instrumentation-kafkajs";
|
|
10
|
-
function prepareCounter(meter, value, attributes) {
|
|
11
|
-
return (errorType) => {
|
|
12
|
-
meter.add(value, {
|
|
13
|
-
...attributes,
|
|
14
|
-
...errorType ? { [ATTR_ERROR_TYPE]: errorType } : {}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function prepareDurationHistogram(meter, value, attributes) {
|
|
19
|
-
return (errorType) => {
|
|
20
|
-
meter.record((Date.now() - value) / 1e3, {
|
|
21
|
-
...attributes,
|
|
22
|
-
...errorType ? { [ATTR_ERROR_TYPE]: errorType } : {}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const HISTOGRAM_BUCKET_BOUNDARIES = [5e-3, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10];
|
|
27
7
|
class KafkaJsInstrumentation extends InstrumentationBase {
|
|
28
8
|
constructor(config = {}) {
|
|
29
9
|
super(PACKAGE_NAME, SDK_VERSION, config);
|
|
30
10
|
}
|
|
31
|
-
_updateMetricInstruments() {
|
|
32
|
-
this._clientDuration = this.meter.createHistogram(METRIC_MESSAGING_CLIENT_OPERATION_DURATION, {
|
|
33
|
-
advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES }
|
|
34
|
-
});
|
|
35
|
-
this._sentMessages = this.meter.createCounter(METRIC_MESSAGING_CLIENT_SENT_MESSAGES);
|
|
36
|
-
this._consumedMessages = this.meter.createCounter(METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES);
|
|
37
|
-
this._processDuration = this.meter.createHistogram(METRIC_MESSAGING_PROCESS_DURATION, {
|
|
38
|
-
advice: { explicitBucketBoundaries: HISTOGRAM_BUCKET_BOUNDARIES }
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
11
|
init() {
|
|
42
12
|
const unpatch = (moduleExports) => {
|
|
43
13
|
if (isWrapped(moduleExports?.Kafka?.prototype.producer)) {
|
|
@@ -69,27 +39,10 @@ class KafkaJsInstrumentation extends InstrumentationBase {
|
|
|
69
39
|
instrumentation._unwrap(newConsumer, "run");
|
|
70
40
|
}
|
|
71
41
|
instrumentation._wrap(newConsumer, "run", instrumentation._getConsumerRunPatch());
|
|
72
|
-
instrumentation._setKafkaEventListeners(newConsumer);
|
|
73
42
|
return newConsumer;
|
|
74
43
|
};
|
|
75
44
|
};
|
|
76
45
|
}
|
|
77
|
-
_setKafkaEventListeners(kafkaObj) {
|
|
78
|
-
if (kafkaObj[EVENT_LISTENERS_SET]) return;
|
|
79
|
-
if (kafkaObj.events?.REQUEST) {
|
|
80
|
-
kafkaObj.on(kafkaObj.events.REQUEST, this._recordClientDurationMetric.bind(this));
|
|
81
|
-
}
|
|
82
|
-
kafkaObj[EVENT_LISTENERS_SET] = true;
|
|
83
|
-
}
|
|
84
|
-
_recordClientDurationMetric(event) {
|
|
85
|
-
const [address = "", port = "0"] = event.payload.broker.split(":");
|
|
86
|
-
this._clientDuration.record(event.payload.duration / 1e3, {
|
|
87
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
88
|
-
[ATTR_MESSAGING_OPERATION_NAME]: `${event.payload.apiName}`,
|
|
89
|
-
[ATTR_SERVER_ADDRESS]: address,
|
|
90
|
-
[ATTR_SERVER_PORT]: Number.parseInt(port, 10)
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
46
|
_getProducerPatch() {
|
|
94
47
|
const instrumentation = this;
|
|
95
48
|
return (original) => {
|
|
@@ -107,7 +60,6 @@ class KafkaJsInstrumentation extends InstrumentationBase {
|
|
|
107
60
|
instrumentation._unwrap(newProducer, "transaction");
|
|
108
61
|
}
|
|
109
62
|
instrumentation._wrap(newProducer, "transaction", instrumentation._getProducerTransactionPatch());
|
|
110
|
-
instrumentation._setKafkaEventListeners(newProducer);
|
|
111
63
|
return newProducer;
|
|
112
64
|
};
|
|
113
65
|
};
|
|
@@ -134,103 +86,60 @@ class KafkaJsInstrumentation extends InstrumentationBase {
|
|
|
134
86
|
};
|
|
135
87
|
}
|
|
136
88
|
_getConsumerEachMessagePatch() {
|
|
137
|
-
const instrumentation = this;
|
|
138
89
|
return (original) => {
|
|
139
90
|
return function eachMessage(...args) {
|
|
140
91
|
const payload = args[0];
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
prepareDurationHistogram(instrumentation._processDuration, Date.now(), {
|
|
157
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
158
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "process",
|
|
159
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,
|
|
160
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition)
|
|
161
|
-
}),
|
|
162
|
-
prepareCounter(instrumentation._consumedMessages, 1, {
|
|
163
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
164
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "process",
|
|
165
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: payload.topic,
|
|
166
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition)
|
|
167
|
-
})
|
|
168
|
-
];
|
|
169
|
-
const eachMessagePromise = context.with(trace.setSpan(propagatedContext, span), () => {
|
|
170
|
-
return original.apply(this, args);
|
|
92
|
+
const sentryTrace = getHeaderAsString(payload.message.headers, "sentry-trace");
|
|
93
|
+
const baggage = getHeaderAsString(payload.message.headers, "baggage");
|
|
94
|
+
return continueTrace({ sentryTrace, baggage }, () => {
|
|
95
|
+
const span = startConsumerSpan({
|
|
96
|
+
topic: payload.topic,
|
|
97
|
+
message: payload.message,
|
|
98
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
99
|
+
attributes: {
|
|
100
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition)
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const eachMessagePromise = withActiveSpan(span, () => {
|
|
104
|
+
return original.apply(this, args);
|
|
105
|
+
});
|
|
106
|
+
return endSpansOnPromise([span], eachMessagePromise);
|
|
171
107
|
});
|
|
172
|
-
return instrumentation._endSpansOnPromise([span], pendingMetrics, eachMessagePromise);
|
|
173
108
|
};
|
|
174
109
|
};
|
|
175
110
|
}
|
|
176
111
|
_getConsumerEachBatchPatch() {
|
|
177
112
|
return (original) => {
|
|
178
|
-
const instrumentation = this;
|
|
179
113
|
return function eachBatch(...args) {
|
|
180
114
|
const payload = args[0];
|
|
181
|
-
const receivingSpan =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
return context.with(trace.setSpan(context.active(), receivingSpan), () => {
|
|
192
|
-
const startTime = Date.now();
|
|
193
|
-
const spans = [];
|
|
194
|
-
const pendingMetrics = [
|
|
195
|
-
prepareCounter(instrumentation._consumedMessages, payload.batch.messages.length, {
|
|
196
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
197
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "process",
|
|
198
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,
|
|
115
|
+
const receivingSpan = startNewTrace(
|
|
116
|
+
() => startConsumerSpan({
|
|
117
|
+
topic: payload.batch.topic,
|
|
118
|
+
message: void 0,
|
|
119
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,
|
|
120
|
+
attributes: {
|
|
121
|
+
[ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
|
|
199
122
|
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
200
|
-
})
|
|
201
|
-
];
|
|
202
|
-
payload.batch.messages.forEach((message) => {
|
|
203
|
-
const propagatedContext = propagation.extract(ROOT_CONTEXT, message.headers, bufferTextMapGetter);
|
|
204
|
-
const spanContext = trace.getSpan(propagatedContext)?.spanContext();
|
|
205
|
-
let origSpanLink;
|
|
206
|
-
if (spanContext) {
|
|
207
|
-
origSpanLink = {
|
|
208
|
-
context: spanContext
|
|
209
|
-
};
|
|
210
123
|
}
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
return withActiveSpan(receivingSpan, () => {
|
|
127
|
+
const spans = [receivingSpan];
|
|
128
|
+
payload.batch.messages.forEach((message) => {
|
|
211
129
|
spans.push(
|
|
212
|
-
|
|
130
|
+
startConsumerSpan({
|
|
213
131
|
topic: payload.batch.topic,
|
|
214
132
|
message,
|
|
215
133
|
operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
216
|
-
|
|
134
|
+
links: getLinksFromHeaders(message.headers),
|
|
217
135
|
attributes: {
|
|
218
136
|
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
219
137
|
}
|
|
220
138
|
})
|
|
221
139
|
);
|
|
222
|
-
pendingMetrics.push(
|
|
223
|
-
prepareDurationHistogram(instrumentation._processDuration, startTime, {
|
|
224
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
225
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "process",
|
|
226
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: payload.batch.topic,
|
|
227
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
228
|
-
})
|
|
229
|
-
);
|
|
230
140
|
});
|
|
231
141
|
const batchMessagePromise = original.apply(this, args);
|
|
232
|
-
spans
|
|
233
|
-
return instrumentation._endSpansOnPromise(spans, pendingMetrics, batchMessagePromise);
|
|
142
|
+
return endSpansOnPromise(spans, batchMessagePromise);
|
|
234
143
|
});
|
|
235
144
|
};
|
|
236
145
|
};
|
|
@@ -239,33 +148,31 @@ class KafkaJsInstrumentation extends InstrumentationBase {
|
|
|
239
148
|
const instrumentation = this;
|
|
240
149
|
return (original) => {
|
|
241
150
|
return function transaction(...args) {
|
|
242
|
-
const transactionSpan =
|
|
151
|
+
const transactionSpan = startInactiveSpan({ name: "transaction" });
|
|
243
152
|
const transactionPromise = original.apply(this, args);
|
|
244
153
|
transactionPromise.then((transaction2) => {
|
|
245
154
|
const originalSend = transaction2.send;
|
|
246
155
|
transaction2.send = function send(...args2) {
|
|
247
|
-
return
|
|
156
|
+
return withActiveSpan(transactionSpan, () => {
|
|
248
157
|
const patched = instrumentation._getSendPatch()(originalSend);
|
|
249
158
|
return patched.apply(this, args2).catch((err) => {
|
|
250
159
|
transactionSpan.setStatus({
|
|
251
|
-
code:
|
|
160
|
+
code: SPAN_STATUS_ERROR,
|
|
252
161
|
message: err?.message
|
|
253
162
|
});
|
|
254
|
-
transactionSpan.recordException(err);
|
|
255
163
|
throw err;
|
|
256
164
|
});
|
|
257
165
|
});
|
|
258
166
|
};
|
|
259
167
|
const originalSendBatch = transaction2.sendBatch;
|
|
260
168
|
transaction2.sendBatch = function sendBatch(...args2) {
|
|
261
|
-
return
|
|
169
|
+
return withActiveSpan(transactionSpan, () => {
|
|
262
170
|
const patched = instrumentation._getSendBatchPatch()(originalSendBatch);
|
|
263
171
|
return patched.apply(this, args2).catch((err) => {
|
|
264
172
|
transactionSpan.setStatus({
|
|
265
|
-
code:
|
|
173
|
+
code: SPAN_STATUS_ERROR,
|
|
266
174
|
message: err?.message
|
|
267
175
|
});
|
|
268
|
-
transactionSpan.recordException(err);
|
|
269
176
|
throw err;
|
|
270
177
|
});
|
|
271
178
|
});
|
|
@@ -273,21 +180,20 @@ class KafkaJsInstrumentation extends InstrumentationBase {
|
|
|
273
180
|
const originalCommit = transaction2.commit;
|
|
274
181
|
transaction2.commit = function commit(...args2) {
|
|
275
182
|
const originCommitPromise = originalCommit.apply(this, args2).then(() => {
|
|
276
|
-
transactionSpan.setStatus({ code:
|
|
183
|
+
transactionSpan.setStatus({ code: SPAN_STATUS_OK });
|
|
277
184
|
});
|
|
278
|
-
return
|
|
185
|
+
return endSpansOnPromise([transactionSpan], originCommitPromise);
|
|
279
186
|
};
|
|
280
187
|
const originalAbort = transaction2.abort;
|
|
281
188
|
transaction2.abort = function abort(...args2) {
|
|
282
189
|
const originAbortPromise = originalAbort.apply(this, args2);
|
|
283
|
-
return
|
|
190
|
+
return endSpansOnPromise([transactionSpan], originAbortPromise);
|
|
284
191
|
};
|
|
285
192
|
}).catch((err) => {
|
|
286
193
|
transactionSpan.setStatus({
|
|
287
|
-
code:
|
|
194
|
+
code: SPAN_STATUS_ERROR,
|
|
288
195
|
message: err?.message
|
|
289
196
|
});
|
|
290
|
-
transactionSpan.recordException(err);
|
|
291
197
|
transactionSpan.end();
|
|
292
198
|
});
|
|
293
199
|
return transactionPromise;
|
|
@@ -295,141 +201,33 @@ class KafkaJsInstrumentation extends InstrumentationBase {
|
|
|
295
201
|
};
|
|
296
202
|
}
|
|
297
203
|
_getSendBatchPatch() {
|
|
298
|
-
const instrumentation = this;
|
|
299
204
|
return (original) => {
|
|
300
205
|
return function sendBatch(...args) {
|
|
301
206
|
const batch = args[0];
|
|
302
207
|
const messages = batch.topicMessages || [];
|
|
303
208
|
const spans = [];
|
|
304
|
-
const pendingMetrics = [];
|
|
305
209
|
messages.forEach((topicMessage) => {
|
|
306
210
|
topicMessage.messages.forEach((message) => {
|
|
307
|
-
spans.push(
|
|
308
|
-
pendingMetrics.push(
|
|
309
|
-
prepareCounter(instrumentation._sentMessages, 1, {
|
|
310
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
311
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "send",
|
|
312
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: topicMessage.topic,
|
|
313
|
-
...message.partition !== void 0 ? {
|
|
314
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(message.partition)
|
|
315
|
-
} : {}
|
|
316
|
-
})
|
|
317
|
-
);
|
|
211
|
+
spans.push(startProducerSpan(topicMessage.topic, message));
|
|
318
212
|
});
|
|
319
213
|
});
|
|
320
214
|
const origSendResult = original.apply(this, args);
|
|
321
|
-
return
|
|
215
|
+
return endSpansOnPromise(spans, origSendResult);
|
|
322
216
|
};
|
|
323
217
|
};
|
|
324
218
|
}
|
|
325
219
|
_getSendPatch() {
|
|
326
|
-
const instrumentation = this;
|
|
327
220
|
return (original) => {
|
|
328
221
|
return function send(...args) {
|
|
329
222
|
const record = args[0];
|
|
330
223
|
const spans = record.messages.map((message) => {
|
|
331
|
-
return
|
|
224
|
+
return startProducerSpan(record.topic, message);
|
|
332
225
|
});
|
|
333
|
-
const pendingMetrics = record.messages.map(
|
|
334
|
-
(m) => prepareCounter(instrumentation._sentMessages, 1, {
|
|
335
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
336
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "send",
|
|
337
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: record.topic,
|
|
338
|
-
...m.partition !== void 0 ? {
|
|
339
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(m.partition)
|
|
340
|
-
} : {}
|
|
341
|
-
})
|
|
342
|
-
);
|
|
343
226
|
const origSendResult = original.apply(this, args);
|
|
344
|
-
return
|
|
227
|
+
return endSpansOnPromise(spans, origSendResult);
|
|
345
228
|
};
|
|
346
229
|
};
|
|
347
230
|
}
|
|
348
|
-
_endSpansOnPromise(spans, pendingMetrics, sendPromise) {
|
|
349
|
-
return Promise.resolve(sendPromise).then((result) => {
|
|
350
|
-
pendingMetrics.forEach((m) => m());
|
|
351
|
-
return result;
|
|
352
|
-
}).catch((reason) => {
|
|
353
|
-
let errorMessage;
|
|
354
|
-
let errorType = ERROR_TYPE_VALUE_OTHER;
|
|
355
|
-
if (typeof reason === "string" || reason === void 0) {
|
|
356
|
-
errorMessage = reason;
|
|
357
|
-
} else if (typeof reason === "object" && Object.prototype.hasOwnProperty.call(reason, "message")) {
|
|
358
|
-
errorMessage = reason.message;
|
|
359
|
-
errorType = reason.constructor.name;
|
|
360
|
-
}
|
|
361
|
-
pendingMetrics.forEach((m) => m(errorType));
|
|
362
|
-
spans.forEach((span) => {
|
|
363
|
-
span.setAttribute(ATTR_ERROR_TYPE, errorType);
|
|
364
|
-
span.setStatus({
|
|
365
|
-
code: SpanStatusCode.ERROR,
|
|
366
|
-
message: errorMessage
|
|
367
|
-
});
|
|
368
|
-
});
|
|
369
|
-
throw reason;
|
|
370
|
-
}).finally(() => {
|
|
371
|
-
spans.forEach((span) => span.end());
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
_startConsumerSpan({ topic, message, operationType, ctx, link, attributes }) {
|
|
375
|
-
const operationName = operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? "poll" : operationType;
|
|
376
|
-
const span = this.tracer.startSpan(
|
|
377
|
-
`${operationName} ${topic}`,
|
|
378
|
-
{
|
|
379
|
-
kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SpanKind.CLIENT : SpanKind.CONSUMER,
|
|
380
|
-
attributes: {
|
|
381
|
-
...attributes,
|
|
382
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
383
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: topic,
|
|
384
|
-
[ATTR_MESSAGING_OPERATION_TYPE]: operationType,
|
|
385
|
-
[ATTR_MESSAGING_OPERATION_NAME]: operationName,
|
|
386
|
-
[ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : void 0,
|
|
387
|
-
[ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : void 0,
|
|
388
|
-
[ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset
|
|
389
|
-
},
|
|
390
|
-
links: link ? [link] : []
|
|
391
|
-
},
|
|
392
|
-
ctx
|
|
393
|
-
);
|
|
394
|
-
const { consumerHook } = this.getConfig();
|
|
395
|
-
if (consumerHook && message) {
|
|
396
|
-
safeExecuteInTheMiddle(
|
|
397
|
-
() => consumerHook(span, { topic, message }),
|
|
398
|
-
(e) => {
|
|
399
|
-
if (e) this._diag.error("consumerHook error", e);
|
|
400
|
-
},
|
|
401
|
-
true
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
return span;
|
|
405
|
-
}
|
|
406
|
-
_startProducerSpan(topic, message) {
|
|
407
|
-
const span = this.tracer.startSpan(`send ${topic}`, {
|
|
408
|
-
kind: SpanKind.PRODUCER,
|
|
409
|
-
attributes: {
|
|
410
|
-
[ATTR_MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
411
|
-
[ATTR_MESSAGING_DESTINATION_NAME]: topic,
|
|
412
|
-
[ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : void 0,
|
|
413
|
-
[ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : void 0,
|
|
414
|
-
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: message.partition !== void 0 ? String(message.partition) : void 0,
|
|
415
|
-
[ATTR_MESSAGING_OPERATION_NAME]: "send",
|
|
416
|
-
[ATTR_MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
message.headers = message.headers ?? {};
|
|
420
|
-
propagation.inject(trace.setSpan(context.active(), span), message.headers);
|
|
421
|
-
const { producerHook } = this.getConfig();
|
|
422
|
-
if (producerHook) {
|
|
423
|
-
safeExecuteInTheMiddle(
|
|
424
|
-
() => producerHook(span, { topic, message }),
|
|
425
|
-
(e) => {
|
|
426
|
-
if (e) this._diag.error("producerHook error", e);
|
|
427
|
-
},
|
|
428
|
-
true
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
return span;
|
|
432
|
-
}
|
|
433
231
|
}
|
|
434
232
|
|
|
435
233
|
export { KafkaJsInstrumentation };
|
|
@@ -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);\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,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 * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs\n * - Cross-broker trace propagation uses Sentry's `getTraceData`/`continueTrace` instead of the OTel\n * propagator, so the vendored `bufferTextMapGetter` propagator is gone\n * - Dropped the OTel metrics (no MeterProvider is wired up) and, with them, the `network.request`\n * event listeners they relied on; origin is folded into span creation instead of `index.ts` hooks\n */\n\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Span } from '@sentry/core';\nimport {\n continueTrace,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n SPAN_STATUS_OK,\n startInactiveSpan,\n startNewTrace,\n withActiveSpan,\n} from '@sentry/core';\nimport type {\n Consumer,\n ConsumerRunConfig,\n EachBatchHandler,\n EachMessageHandler,\n Kafka,\n KafkaMessage,\n Producer,\n RecordMetadata,\n Transaction,\n} from './kafkajs-types';\nimport {\n ATTR_MESSAGING_BATCH_MESSAGE_COUNT,\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n} from './semconv';\nimport {\n endSpansOnPromise,\n getHeaderAsString,\n getLinksFromHeaders,\n startConsumerSpan,\n startProducerSpan,\n} from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-kafkajs';\n\nexport class KafkaJsInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init(): InstrumentationNodeModuleDefinition {\n const unpatch = (moduleExports: any): void => {\n if (isWrapped(moduleExports?.Kafka?.prototype.producer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'producer');\n }\n if (isWrapped(moduleExports?.Kafka?.prototype.consumer)) {\n this._unwrap(moduleExports.Kafka.prototype, 'consumer');\n }\n };\n\n const module = new InstrumentationNodeModuleDefinition(\n 'kafkajs',\n ['>=0.3.0 <3'],\n (moduleExports: any) => {\n unpatch(moduleExports);\n this._wrap(moduleExports?.Kafka?.prototype, 'producer', this._getProducerPatch());\n this._wrap(moduleExports?.Kafka?.prototype, 'consumer', this._getConsumerPatch());\n\n return moduleExports;\n },\n unpatch,\n );\n return module;\n }\n\n private _getConsumerPatch() {\n const instrumentation = this;\n return (original: Kafka['consumer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['consumer']>) {\n const newConsumer: Consumer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newConsumer.run)) {\n instrumentation._unwrap(newConsumer, 'run');\n }\n\n instrumentation._wrap(newConsumer, 'run', instrumentation._getConsumerRunPatch());\n\n return newConsumer;\n };\n };\n }\n\n private _getProducerPatch() {\n const instrumentation = this;\n return (original: Kafka['producer']) => {\n return function consumer(this: Kafka, ...args: Parameters<Kafka['producer']>) {\n const newProducer: Producer = original.apply(this, args);\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.sendBatch)) {\n instrumentation._unwrap(newProducer, 'sendBatch');\n }\n instrumentation._wrap(newProducer, 'sendBatch', instrumentation._getSendBatchPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.send)) {\n instrumentation._unwrap(newProducer, 'send');\n }\n instrumentation._wrap(newProducer, 'send', instrumentation._getSendPatch());\n\n // oxlint-disable-next-line typescript/unbound-method -- property check, the method is never called\n if (isWrapped(newProducer.transaction)) {\n instrumentation._unwrap(newProducer, 'transaction');\n }\n instrumentation._wrap(newProducer, 'transaction', instrumentation._getProducerTransactionPatch());\n\n return newProducer;\n };\n };\n }\n\n private _getConsumerRunPatch() {\n const instrumentation = this;\n return (original: Consumer['run']) => {\n return function run(this: Consumer, ...args: Parameters<Consumer['run']>): ReturnType<Consumer['run']> {\n const config = args[0];\n if (config?.eachMessage) {\n if (isWrapped(config.eachMessage)) {\n instrumentation._unwrap(config, 'eachMessage');\n }\n instrumentation._wrap(config, 'eachMessage', instrumentation._getConsumerEachMessagePatch());\n }\n if (config?.eachBatch) {\n if (isWrapped(config.eachBatch)) {\n instrumentation._unwrap(config, 'eachBatch');\n }\n instrumentation._wrap(config, 'eachBatch', instrumentation._getConsumerEachBatchPatch());\n }\n return original.call(this, config);\n };\n };\n }\n\n private _getConsumerEachMessagePatch() {\n return (original: ConsumerRunConfig['eachMessage']) => {\n return function eachMessage(this: unknown, ...args: Parameters<EachMessageHandler>): Promise<void> {\n const payload = args[0];\n const sentryTrace = getHeaderAsString(payload.message.headers, 'sentry-trace');\n const baggage = getHeaderAsString(payload.message.headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n return continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const eachMessagePromise = withActiveSpan(span, () => {\n return original!.apply(this, args);\n });\n return endSpansOnPromise([span], eachMessagePromise);\n });\n };\n };\n }\n\n private _getConsumerEachBatchPatch() {\n return (original: ConsumerRunConfig['eachBatch']) => {\n return function eachBatch(this: unknown, ...args: Parameters<EachBatchHandler>): Promise<void> {\n const payload = args[0];\n // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#topic-with-multiple-consumers\n // A batch pull aggregates messages from many producers, so the receiving span is a fresh root\n // trace and each processed message links back to its own producer span.\n const receivingSpan = startNewTrace(() =>\n startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n attributes: {\n [ATTR_MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n\n return withActiveSpan(receivingSpan, () => {\n const spans: Span[] = [receivingSpan];\n payload.batch.messages.forEach((message: KafkaMessage) => {\n spans.push(\n startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n links: getLinksFromHeaders(message.headers),\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n });\n const batchMessagePromise: Promise<void> = original!.apply(this, args);\n return endSpansOnPromise(spans, batchMessagePromise);\n });\n };\n };\n }\n\n private _getProducerTransactionPatch() {\n const instrumentation = this;\n return (original: Producer['transaction']) => {\n return function transaction(\n this: Producer,\n ...args: Parameters<Producer['transaction']>\n ): ReturnType<Producer['transaction']> {\n const transactionSpan = startInactiveSpan({ name: 'transaction' });\n\n const transactionPromise = original.apply(this, args);\n\n transactionPromise\n .then((transaction: Transaction) => {\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSend = transaction.send;\n transaction.send = function send(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendPatch()(originalSend);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalSendBatch = transaction.sendBatch;\n transaction.sendBatch = function sendBatch(this: Transaction, ...args) {\n return withActiveSpan(transactionSpan, () => {\n const patched = instrumentation._getSendBatchPatch()(originalSendBatch);\n return patched.apply(this, args).catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n throw err;\n });\n });\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalCommit = transaction.commit;\n transaction.commit = function commit(this: Transaction, ...args) {\n const originCommitPromise = originalCommit.apply(this, args).then(() => {\n transactionSpan.setStatus({ code: SPAN_STATUS_OK });\n });\n return endSpansOnPromise([transactionSpan], originCommitPromise);\n };\n\n // oxlint-disable-next-line typescript/unbound-method -- re-bound below via `.apply(this, args)`\n const originalAbort = transaction.abort;\n transaction.abort = function abort(this: Transaction, ...args) {\n const originAbortPromise = originalAbort.apply(this, args);\n return endSpansOnPromise([transactionSpan], originAbortPromise);\n };\n })\n .catch((err: any) => {\n transactionSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err?.message,\n });\n transactionSpan.end();\n });\n\n return transactionPromise;\n };\n };\n }\n\n private _getSendBatchPatch() {\n return (original: Producer['sendBatch'] | Transaction['sendBatch']) => {\n return function sendBatch(\n this: Producer | Transaction,\n ...args: Parameters<Producer['sendBatch']>\n ): ReturnType<Producer['sendBatch']> {\n const batch = args[0];\n const messages = batch.topicMessages || [];\n\n const spans: Span[] = [];\n\n messages.forEach((topicMessage: any) => {\n topicMessage.messages.forEach((message: any) => {\n spans.push(startProducerSpan(topicMessage.topic, message));\n });\n });\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n\n private _getSendPatch() {\n return (original: Producer['send'] | Transaction['send']) => {\n return function send(\n this: Producer | Transaction,\n ...args: Parameters<Producer['send']>\n ): ReturnType<Producer['send']> {\n const record = args[0];\n const spans: Span[] = record.messages.map((message: any) => {\n return startProducerSpan(record.topic, message);\n });\n\n const origSendResult: Promise<RecordMetadata[]> = original.apply(this, args);\n return endSpansOnPromise(spans, origSendResult);\n };\n };\n }\n}\n"],"names":["transaction","args"],"mappings":";;;;;AAoDA,MAAM,YAAA,GAAe,iCAAA;AAEd,MAAM,+BAA+B,mBAAA,CAA2C;AAAA,EAC9E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU,IAAA,GAA4C;AACpD,IAAA,MAAM,OAAA,GAAU,CAAC,aAAA,KAA6B;AAC5C,MAAA,IAAI,SAAA,CAAU,aAAA,EAAe,KAAA,EAAO,SAAA,CAAU,QAAQ,CAAA,EAAG;AACvD,QAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,KAAA,CAAM,SAAA,EAAW,UAAU,CAAA;AAAA,MACxD;AACA,MAAA,IAAI,SAAA,CAAU,aAAA,EAAe,KAAA,EAAO,SAAA,CAAU,QAAQ,CAAA,EAAG;AACvD,QAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,KAAA,CAAM,SAAA,EAAW,UAAU,CAAA;AAAA,MACxD;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,SAAS,IAAI,mCAAA;AAAA,MACjB,SAAA;AAAA,MACA,CAAC,YAAY,CAAA;AAAA,MACb,CAAC,aAAA,KAAuB;AACtB,QAAA,OAAA,CAAQ,aAAa,CAAA;AACrB,QAAA,IAAA,CAAK,MAAM,aAAA,EAAe,KAAA,EAAO,WAAW,UAAA,EAAY,IAAA,CAAK,mBAAmB,CAAA;AAChF,QAAA,IAAA,CAAK,MAAM,aAAA,EAAe,KAAA,EAAO,WAAW,UAAA,EAAY,IAAA,CAAK,mBAAmB,CAAA;AAEhF,QAAA,OAAO,aAAA;AAAA,MACT,CAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,OAAO,MAAA;AAAA,EACT;A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,CAAM,IAAA,CAAK,iBAAA,CAAkB,YAAA,CAAa,KAAA,EAAO,OAAO,CAAC,CAAA;AAAA,UAC3D,CAAC,CAAA;AAAA,QACH,CAAC,CAAA;AACD,QAAA,MAAM,cAAA,GAA4C,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC3E,QAAA,OAAO,iBAAA,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEQ,aAAA,GAAgB;AACtB,IAAA,OAAO,CAAC,QAAA,KAAqD;AAC3D,MAAA,OAAO,SAAS,QAEX,IAAA,EAC2B;AAC9B,QAAA,MAAM,MAAA,GAAS,KAAK,CAAC,CAAA;AACrB,QAAA,MAAM,KAAA,GAAgB,MAAA,CAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,KAAiB;AAC1D,UAAA,OAAO,iBAAA,CAAkB,MAAA,CAAO,KAAA,EAAO,OAAO,CAAA;AAAA,QAChD,CAAC,CAAA;AAED,QAAA,MAAM,cAAA,GAA4C,QAAA,CAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAC3E,QAAA,OAAO,iBAAA,CAAkB,OAAO,cAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
|
|
@@ -11,10 +11,8 @@ const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = "process";
|
|
|
11
11
|
const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = "receive";
|
|
12
12
|
const MESSAGING_OPERATION_TYPE_VALUE_SEND = "send";
|
|
13
13
|
const MESSAGING_SYSTEM_VALUE_KAFKA = "kafka";
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const METRIC_MESSAGING_CLIENT_SENT_MESSAGES = "messaging.client.sent.messages";
|
|
17
|
-
const METRIC_MESSAGING_PROCESS_DURATION = "messaging.process.duration";
|
|
14
|
+
const ATTR_ERROR_TYPE = "error.type";
|
|
15
|
+
const ERROR_TYPE_VALUE_OTHER = "_OTHER";
|
|
18
16
|
|
|
19
|
-
export { ATTR_MESSAGING_BATCH_MESSAGE_COUNT, ATTR_MESSAGING_DESTINATION_NAME, ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_OFFSET, ATTR_MESSAGING_OPERATION_NAME, ATTR_MESSAGING_OPERATION_TYPE, ATTR_MESSAGING_SYSTEM, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, MESSAGING_OPERATION_TYPE_VALUE_SEND, MESSAGING_SYSTEM_VALUE_KAFKA
|
|
17
|
+
export { ATTR_ERROR_TYPE, ATTR_MESSAGING_BATCH_MESSAGE_COUNT, ATTR_MESSAGING_DESTINATION_NAME, ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_OFFSET, ATTR_MESSAGING_OPERATION_NAME, ATTR_MESSAGING_OPERATION_TYPE, ATTR_MESSAGING_SYSTEM, ERROR_TYPE_VALUE_OTHER, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, MESSAGING_OPERATION_TYPE_VALUE_SEND, MESSAGING_SYSTEM_VALUE_KAFKA };
|
|
20
18
|
//# sourceMappingURL=semconv.js.map
|
|
@@ -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 * - Metric semantic conventions dropped; `error.type` inlined from `@opentelemetry/semantic-conventions`\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The 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 * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_ERROR_TYPE}. A fallback error value to be used when\n * the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = '_OTHER' as const;\n"],"names":[],"mappings":"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,eAAA,GAAkB;AAMxB,MAAM,sBAAA,GAAyB;;;;"}
|