@sentry/node 10.57.0 → 10.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/fs/index.js +3 -84
- package/build/cjs/integrations/fs/index.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/instrumentation.js +145 -175
- package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/index.js +0 -21
- package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js +0 -6
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +33 -42
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/utils.js +3 -2
- package/build/cjs/integrations/tracing/connect/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/index.js +2 -22
- package/build/cjs/integrations/tracing/dataloader/index.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js +93 -120
- 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 +37 -37
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/index.js +1 -51
- package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/enum.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +67 -57
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js +28 -62
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js +0 -17
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +28 -45
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js +4 -9
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +1 -0
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/index.js +2 -17
- package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +65 -93
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js +2 -0
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/utils.js +2 -15
- package/build/cjs/integrations/tracing/knex/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/index.js +1 -24
- package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +29 -41
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/index.js +1 -42
- package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +12 -562
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js +151 -0
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -4
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js +153 -0
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/mongoose/index.js +1 -8
- package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +56 -203
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -4
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +19 -49
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/index.js +1 -8
- package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +21 -59
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +14 -33
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/index.js +0 -4
- package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +51 -261
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js +43 -167
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/index.js +1 -1
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +89 -160
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +92 -231
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -2
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/index.js +1 -25
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +25 -76
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/utils.js.map +1 -1
- package/build/cjs/sdk/diagnosticsChannelInjection.js +21 -0
- package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +19 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/index.js +17 -1
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/fs/index.js +4 -85
- package/build/esm/integrations/fs/index.js.map +1 -1
- package/build/esm/integrations/fs/vendored/constants.js.map +1 -1
- package/build/esm/integrations/fs/vendored/instrumentation.js +147 -177
- package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/fs/vendored/utils.js.map +1 -1
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/connect/index.js +1 -22
- package/build/esm/integrations/tracing/connect/index.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js +1 -6
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +36 -44
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/utils.js +3 -2
- package/build/esm/integrations/tracing/connect/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/index.js +4 -24
- package/build/esm/integrations/tracing/dataloader/index.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js +95 -122
- 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 +38 -38
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/index.js +3 -53
- package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/enum.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +69 -59
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/utils.js +29 -62
- package/build/esm/integrations/tracing/graphql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js +1 -18
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +30 -47
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/utils.js +5 -10
- package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +1 -0
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/knex/index.js +4 -19
- package/build/esm/integrations/tracing/knex/index.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +66 -94
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js +2 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/utils.js +3 -15
- package/build/esm/integrations/tracing/knex/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/koa/index.js +3 -26
- package/build/esm/integrations/tracing/koa/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +31 -43
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/index.js +3 -43
- package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +13 -563
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/patches.js +143 -0
- package/build/esm/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -3
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/utils.js +146 -0
- package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/mongoose/index.js +2 -9
- package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +59 -206
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -3
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js +20 -50
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/index.js +2 -9
- package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +26 -64
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js +15 -34
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/index.js +1 -5
- package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +52 -262
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/utils.js +44 -165
- package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/index.js +1 -1
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +92 -163
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +94 -233
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -2
- package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/index.js +3 -27
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +29 -79
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/utils.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/diagnosticsChannelInjection.js +17 -0
- package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +17 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/index.js +17 -1
- package/build/esm/sdk/index.js.map +1 -1
- package/build/import-hook.mjs +6 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/fs/index.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/instrumentation.d.ts +6 -10
- package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/types.d.ts +10 -15
- package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/utils.d.ts +2 -2
- package/build/types/integrations/fs/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts +5 -5
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts +1 -1
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts +2 -5
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/types.d.ts +20 -8
- 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/generic-pool-types.d.ts +1 -1
- package/build/types/integrations/tracing/genericPool/vendored/generic-pool-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts +2 -1
- package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/enum.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts +7 -2
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts +4 -4
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts +5 -43
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts +8 -11
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts +3 -4
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts +0 -6
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/types.d.ts +2 -39
- package/build/types/integrations/tracing/koa/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts +3 -3
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/index.d.ts +0 -4
- package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types/integrations/tracing/mongo/vendored/patches.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts +1 -9
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts +2 -56
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/types.d.ts +2 -36
- package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/utils.d.ts.map +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/index.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +6 -10
- package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +10 -15
- package/build/types-ts3.8/integrations/fs/vendored/utils.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/connect/vendored/instrumentation.d.ts +4 -4
- package/build/types-ts3.8/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/dataloader/vendored/instrumentation.d.ts +2 -5
- package/build/types-ts3.8/integrations/tracing/dataloader/vendored/types.d.ts +20 -8
- package/build/types-ts3.8/integrations/tracing/genericPool/vendored/generic-pool-types.d.ts +1 -1
- package/build/types-ts3.8/integrations/tracing/genericPool/vendored/instrumentation.d.ts +2 -1
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/instrumentation.d.ts +6 -1
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/internal-types.d.ts +3 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/types.d.ts +4 -42
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/utils.d.ts +6 -9
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/utils.d.ts +1 -2
- package/build/types-ts3.8/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
- package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/knex/vendored/utils.d.ts +0 -6
- package/build/types-ts3.8/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
- package/build/types-ts3.8/integrations/tracing/koa/vendored/types.d.ts +1 -38
- package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/instrumentation.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/types.d.ts +1 -55
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
- package/build/types-ts3.8/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/redis/vendored/types.d.ts +2 -36
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
- package/package.json +20 -6
- package/build/cjs/integrations/tracing/knex/vendored/constants.js +0 -16
- package/build/cjs/integrations/tracing/knex/vendored/constants.js.map +0 -1
- package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js +0 -6
- package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
- package/build/cjs/integrations/tracing/utils/sql-common.js +0 -43
- package/build/cjs/integrations/tracing/utils/sql-common.js.map +0 -1
- package/build/esm/integrations/tracing/knex/vendored/constants.js +0 -13
- package/build/esm/integrations/tracing/knex/vendored/constants.js.map +0 -1
- package/build/esm/integrations/tracing/postgres/vendored/internal-types.js +0 -4
- package/build/esm/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
- package/build/esm/integrations/tracing/utils/sql-common.js +0 -41
- package/build/esm/integrations/tracing/utils/sql-common.js.map +0 -1
- package/build/types/integrations/tracing/dataloader/vendored/dataloader-types.d.ts +0 -14
- package/build/types/integrations/tracing/dataloader/vendored/dataloader-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-ts3.8/integrations/tracing/dataloader/vendored/dataloader-types.d.ts +0 -14
- package/build/types-ts3.8/integrations/tracing/knex/vendored/constants.d.ts +0 -3
- package/build/types-ts3.8/integrations/tracing/knex/vendored/types.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/types.d.ts +0 -51
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/types.d.ts +0 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const api = require('@opentelemetry/api');
|
|
4
3
|
const instrumentation = require('@opentelemetry/instrumentation');
|
|
5
4
|
const InstrumentationNodeModuleFile = require('../../InstrumentationNodeModuleFile.js');
|
|
6
5
|
const _enum = require('./enum.js');
|
|
@@ -9,12 +8,11 @@ const symbols = require('./symbols.js');
|
|
|
9
8
|
const internalTypes = require('./internal-types.js');
|
|
10
9
|
const utils = require('./utils.js');
|
|
11
10
|
const core = require('@sentry/core');
|
|
11
|
+
const opentelemetry = require('@sentry/opentelemetry');
|
|
12
12
|
|
|
13
13
|
const PACKAGE_NAME = "@sentry/instrumentation-graphql";
|
|
14
|
+
const ORIGIN = "auto.graphql.otel.graphql";
|
|
14
15
|
const DEFAULT_CONFIG = {
|
|
15
|
-
mergeItems: false,
|
|
16
|
-
depth: -1,
|
|
17
|
-
allowValues: false,
|
|
18
16
|
ignoreResolveSpans: false
|
|
19
17
|
};
|
|
20
18
|
const supportedVersions = [">=14.0.0 <17"];
|
|
@@ -127,7 +125,7 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
127
125
|
span,
|
|
128
126
|
fields: {}
|
|
129
127
|
};
|
|
130
|
-
return
|
|
128
|
+
return core.withActiveSpan(span, () => {
|
|
131
129
|
return instrumentation.safeExecuteInTheMiddle(
|
|
132
130
|
() => {
|
|
133
131
|
return original.apply(this, [processedArgs]);
|
|
@@ -141,7 +139,6 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
141
139
|
};
|
|
142
140
|
}
|
|
143
141
|
_handleExecutionResult(span, err, result) {
|
|
144
|
-
const config = this.getConfig();
|
|
145
142
|
if (result === void 0 || err) {
|
|
146
143
|
utils.endSpan(span, err);
|
|
147
144
|
return;
|
|
@@ -149,40 +146,55 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
149
146
|
if (utils.isPromise(result)) {
|
|
150
147
|
result.then(
|
|
151
148
|
(resultData) => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
this._executeResponseHook(span, resultData);
|
|
149
|
+
this._updateSpanFromResult(span, resultData);
|
|
150
|
+
utils.endSpan(span);
|
|
157
151
|
},
|
|
158
152
|
(error) => {
|
|
159
153
|
utils.endSpan(span, error);
|
|
160
154
|
}
|
|
161
155
|
);
|
|
162
156
|
} else {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
this._executeResponseHook(span, result);
|
|
157
|
+
this._updateSpanFromResult(span, result);
|
|
158
|
+
utils.endSpan(span);
|
|
168
159
|
}
|
|
169
160
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Applies Sentry-specific span mutations based on the GraphQL execution result:
|
|
163
|
+
* - Marks the execute span as errored if the result contains errors (and no status was set yet)
|
|
164
|
+
* - Optionally renames the containing root span to include the GraphQL operation name(s)
|
|
165
|
+
*/
|
|
166
|
+
_updateSpanFromResult(span, result) {
|
|
167
|
+
if (result.errors?.length && !core.spanToJSON(span).status) {
|
|
168
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR });
|
|
169
|
+
}
|
|
170
|
+
if (!this.getConfig().useOperationNameForRootSpan) {
|
|
173
171
|
return;
|
|
174
172
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
const attributes = core.spanToJSON(span).data;
|
|
174
|
+
const operationType = attributes[AttributeNames.AttributeNames.OPERATION_TYPE];
|
|
175
|
+
const operationName = attributes[AttributeNames.AttributeNames.OPERATION_NAME];
|
|
176
|
+
if (!operationType) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const rootSpan = core.getRootSpan(span);
|
|
180
|
+
const rootSpanAttributes = core.spanToJSON(rootSpan).data;
|
|
181
|
+
const existingOperations = rootSpanAttributes[opentelemetry.SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];
|
|
182
|
+
const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;
|
|
183
|
+
if (Array.isArray(existingOperations)) {
|
|
184
|
+
existingOperations.push(newOperation);
|
|
185
|
+
rootSpan.setAttribute(opentelemetry.SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);
|
|
186
|
+
} else if (typeof existingOperations === "string") {
|
|
187
|
+
rootSpan.setAttribute(opentelemetry.SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);
|
|
188
|
+
} else {
|
|
189
|
+
rootSpan.setAttribute(opentelemetry.SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);
|
|
190
|
+
}
|
|
191
|
+
if (!core.spanToJSON(rootSpan).data["original-description"]) {
|
|
192
|
+
rootSpan.setAttribute("original-description", core.spanToJSON(rootSpan).description);
|
|
193
|
+
}
|
|
194
|
+
rootSpan.updateName(
|
|
195
|
+
`${core.spanToJSON(rootSpan).data["original-description"]} (${getGraphqlOperationNamesFromAttribute(
|
|
196
|
+
existingOperations
|
|
197
|
+
)})`
|
|
186
198
|
);
|
|
187
199
|
}
|
|
188
200
|
_patchParse() {
|
|
@@ -202,9 +214,8 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
202
214
|
};
|
|
203
215
|
}
|
|
204
216
|
_parse(obj, original, source, options) {
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
return api.context.with(api.trace.setSpan(api.context.active(), span), () => {
|
|
217
|
+
const span = core.startInactiveSpan({ name: _enum.SpanNames.PARSE });
|
|
218
|
+
return core.withActiveSpan(span, () => {
|
|
208
219
|
return instrumentation.safeExecuteInTheMiddle(
|
|
209
220
|
() => {
|
|
210
221
|
return original.call(obj, source, options);
|
|
@@ -215,7 +226,7 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
215
226
|
if (!operation) {
|
|
216
227
|
span.updateName(_enum.SpanNames.SCHEMA_PARSE);
|
|
217
228
|
} else if (result.loc) {
|
|
218
|
-
utils.addSpanSource(span, result.loc
|
|
229
|
+
utils.addSpanSource(span, result.loc);
|
|
219
230
|
}
|
|
220
231
|
}
|
|
221
232
|
utils.endSpan(span, err);
|
|
@@ -224,30 +235,26 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
224
235
|
});
|
|
225
236
|
}
|
|
226
237
|
_validate(obj, original, schema, documentAST, rules, typeInfo, options) {
|
|
227
|
-
const span =
|
|
228
|
-
return
|
|
238
|
+
const span = core.startInactiveSpan({ name: _enum.SpanNames.VALIDATE });
|
|
239
|
+
return core.withActiveSpan(span, () => {
|
|
229
240
|
return instrumentation.safeExecuteInTheMiddle(
|
|
230
241
|
() => {
|
|
231
242
|
return original.call(obj, schema, documentAST, rules, options, typeInfo);
|
|
232
243
|
},
|
|
233
|
-
(err,
|
|
244
|
+
(err, _errors) => {
|
|
234
245
|
if (!documentAST.loc) {
|
|
235
246
|
span.updateName(_enum.SpanNames.SCHEMA_VALIDATE);
|
|
236
247
|
}
|
|
237
|
-
if (errors && errors.length) {
|
|
238
|
-
span.recordException({
|
|
239
|
-
name: AttributeNames.AttributeNames.ERROR_VALIDATION_NAME,
|
|
240
|
-
message: JSON.stringify(errors)
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
248
|
utils.endSpan(span, err);
|
|
244
249
|
}
|
|
245
250
|
);
|
|
246
251
|
});
|
|
247
252
|
}
|
|
248
253
|
_createExecuteSpan(operation, processedArgs) {
|
|
249
|
-
const
|
|
250
|
-
|
|
254
|
+
const span = core.startInactiveSpan({
|
|
255
|
+
name: _enum.SpanNames.EXECUTE,
|
|
256
|
+
attributes: { [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN }
|
|
257
|
+
});
|
|
251
258
|
if (operation) {
|
|
252
259
|
const { operation: operationType, name: nameNode } = operation;
|
|
253
260
|
span.setAttribute(AttributeNames.AttributeNames.OPERATION_TYPE, operationType);
|
|
@@ -267,10 +274,7 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
267
274
|
span.setAttribute(AttributeNames.AttributeNames.OPERATION_NAME, operationName);
|
|
268
275
|
}
|
|
269
276
|
if (processedArgs.document?.loc) {
|
|
270
|
-
utils.addSpanSource(span, processedArgs.document.loc
|
|
271
|
-
}
|
|
272
|
-
if (processedArgs.variableValues && config.allowValues) {
|
|
273
|
-
utils.addInputVariableAttributes(span, processedArgs.variableValues);
|
|
277
|
+
utils.addSpanSource(span, processedArgs.document.loc);
|
|
274
278
|
}
|
|
275
279
|
return span;
|
|
276
280
|
}
|
|
@@ -292,15 +296,10 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
292
296
|
}
|
|
293
297
|
const isUsingDefaultResolver = fieldResolver == null;
|
|
294
298
|
const fieldResolverForExecute = fieldResolver ?? defaultFieldResolved;
|
|
295
|
-
fieldResolver = utils.wrapFieldResolver(
|
|
296
|
-
this.tracer,
|
|
297
|
-
() => this.getConfig(),
|
|
298
|
-
fieldResolverForExecute,
|
|
299
|
-
isUsingDefaultResolver
|
|
300
|
-
);
|
|
299
|
+
fieldResolver = utils.wrapFieldResolver(() => this.getConfig(), fieldResolverForExecute, isUsingDefaultResolver);
|
|
301
300
|
if (schema) {
|
|
302
|
-
utils.wrapFields(schema.getQueryType(),
|
|
303
|
-
utils.wrapFields(schema.getMutationType(),
|
|
301
|
+
utils.wrapFields(schema.getQueryType(), () => this.getConfig());
|
|
302
|
+
utils.wrapFields(schema.getMutationType(), () => this.getConfig());
|
|
304
303
|
}
|
|
305
304
|
return {
|
|
306
305
|
schema,
|
|
@@ -314,6 +313,17 @@ class GraphQLInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
314
313
|
};
|
|
315
314
|
}
|
|
316
315
|
}
|
|
316
|
+
function getGraphqlOperationNamesFromAttribute(attr) {
|
|
317
|
+
if (Array.isArray(attr)) {
|
|
318
|
+
const sorted = attr.slice().sort();
|
|
319
|
+
if (sorted.length <= 5) {
|
|
320
|
+
return sorted.join(", ");
|
|
321
|
+
} else {
|
|
322
|
+
return `${sorted.slice(0, 5).join(", ")}, +${sorted.length - 5}`;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return `${attr}`;
|
|
326
|
+
}
|
|
317
327
|
|
|
318
328
|
exports.GraphQLInstrumentation = GraphQLInstrumentation;
|
|
319
329
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n * - Types from `graphql` package inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments\n */\n/* eslint-disable */\n\nimport { context, trace } from '@opentelemetry/api';\nimport {\n isWrapped,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport type {\n DefinitionNode,\n DocumentNode,\n ExecutionArgs,\n ExecutionResult,\n GraphQLError,\n GraphQLFieldResolver,\n GraphQLSchema,\n GraphQLTypeResolver,\n OperationDefinitionNode,\n ParseOptions,\n PromiseOrValue,\n Source,\n TypeInfo,\n ValidationRule,\n} from './graphql-types';\nimport type { Maybe } from './graphql-types';\nimport { SpanNames } from './enum';\nimport { AttributeNames } from './enums/AttributeNames';\nimport { OTEL_GRAPHQL_DATA_SYMBOL } from './symbols';\n\nimport {\n executeFunctionWithObj,\n executeArgumentsArray,\n executeType,\n parseType,\n validateType,\n OtelExecutionArgs,\n ObjectWithGraphQLData,\n OPERATION_NOT_SUPPORTED,\n} from './internal-types';\nimport {\n addInputVariableAttributes,\n addSpanSource,\n endSpan,\n getOperation,\n isPromise,\n wrapFieldResolver,\n wrapFields,\n} from './utils';\n\nimport { SDK_VERSION } from '@sentry/core';\nimport * as api from '@opentelemetry/api';\nimport { GraphQLInstrumentationConfig, GraphQLInstrumentationParsedConfig } from './types';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-graphql';\n\nconst DEFAULT_CONFIG: GraphQLInstrumentationParsedConfig = {\n mergeItems: false,\n depth: -1,\n allowValues: false,\n ignoreResolveSpans: false,\n};\n\nconst supportedVersions = ['>=14.0.0 <17'];\n\nexport class GraphQLInstrumentation extends InstrumentationBase<GraphQLInstrumentationParsedConfig> {\n constructor(config: GraphQLInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, { ...DEFAULT_CONFIG, ...config });\n }\n\n override setConfig(config: GraphQLInstrumentationConfig = {}) {\n super.setConfig({ ...DEFAULT_CONFIG, ...config });\n }\n\n protected init() {\n const module = new InstrumentationNodeModuleDefinition('graphql', supportedVersions);\n module.files.push(this._addPatchingExecute());\n module.files.push(this._addPatchingParser());\n module.files.push(this._addPatchingValidate());\n\n return module;\n }\n\n private _addPatchingExecute(): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n 'graphql/execution/execute.js',\n supportedVersions,\n // cannot make it work with appropriate type as execute function has 2\n //types and/cannot import function but only types\n (moduleExports: any) => {\n if (isWrapped(moduleExports.execute)) {\n this._unwrap(moduleExports, 'execute');\n }\n this._wrap(moduleExports, 'execute', this._patchExecute(moduleExports.defaultFieldResolver));\n return moduleExports;\n },\n moduleExports => {\n if (moduleExports) {\n this._unwrap(moduleExports, 'execute');\n }\n },\n );\n }\n\n private _addPatchingParser(): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n 'graphql/language/parser.js',\n supportedVersions,\n (moduleExports: { parse: parseType; [key: string]: any }) => {\n if (isWrapped(moduleExports.parse)) {\n this._unwrap(moduleExports, 'parse');\n }\n this._wrap(moduleExports, 'parse', this._patchParse());\n return moduleExports;\n },\n (moduleExports: { parse: parseType; [key: string]: any }) => {\n if (moduleExports) {\n this._unwrap(moduleExports, 'parse');\n }\n },\n );\n }\n\n private _addPatchingValidate(): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n 'graphql/validation/validate.js',\n supportedVersions,\n moduleExports => {\n if (isWrapped(moduleExports.validate)) {\n this._unwrap(moduleExports, 'validate');\n }\n this._wrap(moduleExports, 'validate', this._patchValidate());\n return moduleExports;\n },\n moduleExports => {\n if (moduleExports) {\n this._unwrap(moduleExports, 'validate');\n }\n },\n );\n }\n\n private _patchExecute(defaultFieldResolved: GraphQLFieldResolver<any, any>): (original: executeType) => executeType {\n const instrumentation = this;\n return function execute(original) {\n return function patchExecute(this: executeType): PromiseOrValue<ExecutionResult> {\n let processedArgs: OtelExecutionArgs;\n\n // case when apollo server is used for example\n if (arguments.length >= 2) {\n const args = arguments as unknown as executeArgumentsArray;\n processedArgs = instrumentation._wrapExecuteArgs(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4],\n args[5],\n args[6],\n args[7],\n defaultFieldResolved,\n );\n } else {\n const args = arguments[0] as ExecutionArgs;\n processedArgs = instrumentation._wrapExecuteArgs(\n args.schema,\n args.document,\n args.rootValue,\n args.contextValue,\n args.variableValues,\n args.operationName,\n args.fieldResolver,\n args.typeResolver,\n defaultFieldResolved,\n );\n }\n\n const operation = getOperation(processedArgs.document, processedArgs.operationName);\n\n const span = instrumentation._createExecuteSpan(operation, processedArgs);\n\n processedArgs.contextValue[OTEL_GRAPHQL_DATA_SYMBOL] = {\n source: processedArgs.document\n ? processedArgs.document || (processedArgs.document as ObjectWithGraphQLData)[OTEL_GRAPHQL_DATA_SYMBOL]\n : undefined,\n span,\n fields: {},\n };\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddle<PromiseOrValue<ExecutionResult>>(\n () => {\n return (original as executeFunctionWithObj).apply(this, [processedArgs]);\n },\n (err, result) => {\n instrumentation._handleExecutionResult(span, err, result);\n },\n );\n });\n };\n };\n }\n\n private _handleExecutionResult(span: api.Span, err?: Error, result?: PromiseOrValue<ExecutionResult>) {\n const config = this.getConfig();\n if (result === undefined || err) {\n endSpan(span, err);\n return;\n }\n\n if (isPromise(result)) {\n (result as Promise<ExecutionResult>).then(\n resultData => {\n if (typeof config.responseHook !== 'function') {\n endSpan(span);\n return;\n }\n this._executeResponseHook(span, resultData);\n },\n error => {\n endSpan(span, error);\n },\n );\n } else {\n if (typeof config.responseHook !== 'function') {\n endSpan(span);\n return;\n }\n this._executeResponseHook(span, result as ExecutionResult);\n }\n }\n\n private _executeResponseHook(span: api.Span, result: ExecutionResult) {\n const { responseHook } = this.getConfig();\n if (!responseHook) {\n return;\n }\n\n safeExecuteInTheMiddle(\n () => {\n responseHook(span, result);\n },\n err => {\n if (err) {\n this._diag.error('Error running response hook', err);\n }\n\n endSpan(span, undefined);\n },\n true,\n );\n }\n\n private _patchParse(): (original: parseType) => parseType {\n const instrumentation = this;\n return function parse(original) {\n return function patchParse(this: parseType, source: string | Source, options?: ParseOptions): DocumentNode {\n return instrumentation._parse(this, original, source, options);\n };\n };\n }\n\n private _patchValidate(): (original: validateType) => validateType {\n const instrumentation = this;\n return function validate(original: validateType) {\n return function patchValidate(\n this: validateType,\n schema: GraphQLSchema,\n documentAST: DocumentNode,\n rules?: ReadonlyArray<ValidationRule>,\n options?: { maxErrors?: number },\n typeInfo?: TypeInfo,\n ): ReadonlyArray<GraphQLError> {\n return instrumentation._validate(this, original, schema, documentAST, rules, typeInfo, options);\n };\n };\n }\n\n private _parse(obj: parseType, original: parseType, source: string | Source, options?: ParseOptions): DocumentNode {\n const config = this.getConfig();\n const span = this.tracer.startSpan(SpanNames.PARSE);\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddle<DocumentNode & ObjectWithGraphQLData>(\n () => {\n return original.call(obj, source, options);\n },\n (err, result) => {\n if (result) {\n const operation = getOperation(result);\n if (!operation) {\n span.updateName(SpanNames.SCHEMA_PARSE);\n } else if (result.loc) {\n addSpanSource(span, result.loc, config.allowValues);\n }\n }\n endSpan(span, err);\n },\n );\n });\n }\n\n private _validate(\n obj: validateType,\n original: validateType,\n schema: GraphQLSchema,\n documentAST: DocumentNode,\n rules?: ReadonlyArray<ValidationRule>,\n typeInfo?: TypeInfo,\n options?: { maxErrors?: number },\n ): ReadonlyArray<GraphQLError> {\n const span = this.tracer.startSpan(SpanNames.VALIDATE, {});\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddle<ReadonlyArray<GraphQLError>>(\n () => {\n return original.call(obj, schema, documentAST, rules, options, typeInfo);\n },\n (err, errors) => {\n if (!documentAST.loc) {\n span.updateName(SpanNames.SCHEMA_VALIDATE);\n }\n if (errors && errors.length) {\n span.recordException({\n name: AttributeNames.ERROR_VALIDATION_NAME,\n message: JSON.stringify(errors),\n });\n }\n endSpan(span, err);\n },\n );\n });\n }\n\n private _createExecuteSpan(operation: DefinitionNode | undefined, processedArgs: ExecutionArgs): api.Span {\n const config = this.getConfig();\n\n const span = this.tracer.startSpan(SpanNames.EXECUTE, {});\n if (operation) {\n const { operation: operationType, name: nameNode } = operation as OperationDefinitionNode;\n\n span.setAttribute(AttributeNames.OPERATION_TYPE, operationType);\n\n const operationName = nameNode?.value;\n\n // https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/instrumentation/graphql/\n // > The span name MUST be of the format <graphql.operation.type> <graphql.operation.name> provided that graphql.operation.type and graphql.operation.name are available.\n // > If graphql.operation.name is not available, the span SHOULD be named <graphql.operation.type>.\n if (operationName) {\n span.setAttribute(AttributeNames.OPERATION_NAME, operationName);\n span.updateName(`${operationType} ${operationName}`);\n } else {\n span.updateName(operationType);\n }\n } else {\n let operationName = ' ';\n if (processedArgs.operationName) {\n operationName = ` \"${processedArgs.operationName}\" `;\n }\n operationName = OPERATION_NOT_SUPPORTED.replace('$operationName$', operationName);\n span.setAttribute(AttributeNames.OPERATION_NAME, operationName);\n }\n\n if (processedArgs.document?.loc) {\n addSpanSource(span, processedArgs.document.loc, config.allowValues);\n }\n\n if (processedArgs.variableValues && config.allowValues) {\n addInputVariableAttributes(span, processedArgs.variableValues);\n }\n\n return span;\n }\n\n private _wrapExecuteArgs(\n schema: GraphQLSchema,\n document: DocumentNode,\n rootValue: any,\n contextValue: any,\n variableValues: Maybe<{ [key: string]: any }>,\n operationName: Maybe<string>,\n fieldResolver: Maybe<GraphQLFieldResolver<any, any>>,\n typeResolver: Maybe<GraphQLTypeResolver<any, any>>,\n defaultFieldResolved: GraphQLFieldResolver<any, any>,\n ): OtelExecutionArgs {\n if (!contextValue) {\n contextValue = {};\n }\n\n if (contextValue[OTEL_GRAPHQL_DATA_SYMBOL] || this.getConfig().ignoreResolveSpans) {\n return {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n };\n }\n\n const isUsingDefaultResolver = fieldResolver == null;\n // follows graphql implementation here:\n // https://github.com/graphql/graphql-js/blob/0b7daed9811731362c71900e12e5ea0d1ecc7f1f/src/execution/execute.ts#L494\n const fieldResolverForExecute = fieldResolver ?? defaultFieldResolved;\n fieldResolver = wrapFieldResolver(\n this.tracer,\n () => this.getConfig(),\n fieldResolverForExecute,\n isUsingDefaultResolver,\n );\n\n if (schema) {\n wrapFields(schema.getQueryType() as any, this.tracer, () => this.getConfig());\n wrapFields(schema.getMutationType() as any, this.tracer, () => this.getConfig());\n }\n\n return {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","isWrapped","instrumentation","getOperation","OTEL_GRAPHQL_DATA_SYMBOL","context","trace","safeExecuteInTheMiddle","endSpan","isPromise","SpanNames","addSpanSource","AttributeNames","OPERATION_NOT_SUPPORTED","addInputVariableAttributes","wrapFieldResolver","wrapFields"],"mappings":";;;;;;;;;;;;AA4EA,MAAM,YAAA,GAAe,iCAAA;AAErB,MAAM,cAAA,GAAqD;AAAA,EACzD,UAAA,EAAY,KAAA;AAAA,EACZ,KAAA,EAAO,EAAA;AAAA,EACP,WAAA,EAAa,KAAA;AAAA,EACb,kBAAA,EAAoB;AACtB,CAAA;AAEA,MAAM,iBAAA,GAAoB,CAAC,cAAc,CAAA;AAElC,MAAM,+BAA+BA,mCAAA,CAAwD;AAAA,EAClG,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,cAAcC,gBAAA,EAAa,EAAE,GAAG,cAAA,EAAgB,GAAG,QAAQ,CAAA;AAAA,EACnE;AAAA,EAES,SAAA,CAAU,MAAA,GAAuC,EAAC,EAAG;AAC5D,IAAA,KAAA,CAAM,UAAU,EAAE,GAAG,cAAA,EAAgB,GAAG,QAAQ,CAAA;AAAA,EAClD;AAAA,EAEU,IAAA,GAAO;AACf,IAAA,MAAM,MAAA,GAAS,IAAIC,mDAAA,CAAoC,SAAA,EAAW,iBAAiB,CAAA;AACnF,IAAA,MAAA,CAAO,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,mBAAA,EAAqB,CAAA;AAC5C,IAAA,MAAA,CAAO,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,k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;AAAA,MACA,cAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n * - Types from `graphql` package inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments\n * - Span lifecycle migrated from the OpenTelemetry tracer to the @sentry/core span API\n * - `auto.graphql.otel.graphql` origin baked into the execute span (previously set via a Sentry responseHook)\n * - The generic `responseHook` config was removed; its Sentry-specific logic (error status + root span renaming\n * via `useOperationNameForRootSpan`) is now applied directly when the execution result is handled\n */\n\n/* oxlint-disable max-lines */\n\nimport {\n isWrapped,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';\nimport type {\n DefinitionNode,\n DocumentNode,\n ExecutionArgs,\n ExecutionResult,\n GraphQLError,\n GraphQLFieldResolver,\n GraphQLSchema,\n GraphQLTypeResolver,\n OperationDefinitionNode,\n ParseOptions,\n PromiseOrValue,\n Source,\n TypeInfo,\n ValidationRule,\n} from './graphql-types';\nimport type { Maybe } from './graphql-types';\nimport { SpanNames } from './enum';\nimport { AttributeNames } from './enums/AttributeNames';\nimport { OTEL_GRAPHQL_DATA_SYMBOL } from './symbols';\n\nimport {\n type executeFunctionWithObj,\n type executeArgumentsArray,\n type executeType,\n type parseType,\n type validateType,\n type OtelExecutionArgs,\n type ObjectWithGraphQLData,\n OPERATION_NOT_SUPPORTED,\n} from './internal-types';\nimport { addSpanSource, endSpan, getOperation, isPromise, wrapFieldResolver, wrapFields } from './utils';\n\nimport type { Span, SpanAttributeValue } from '@sentry/core';\nimport {\n getRootSpan,\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n spanToJSON,\n startInactiveSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '@sentry/opentelemetry';\nimport type { GraphQLInstrumentationConfig, GraphQLInstrumentationParsedConfig } from './types';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-graphql';\n\nconst ORIGIN = 'auto.graphql.otel.graphql';\n\nconst DEFAULT_CONFIG: GraphQLInstrumentationParsedConfig = {\n ignoreResolveSpans: false,\n};\n\nconst supportedVersions = ['>=14.0.0 <17'];\n\nexport class GraphQLInstrumentation extends InstrumentationBase<GraphQLInstrumentationParsedConfig> {\n constructor(config: GraphQLInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, { ...DEFAULT_CONFIG, ...config });\n }\n\n override setConfig(config: GraphQLInstrumentationConfig = {}) {\n super.setConfig({ ...DEFAULT_CONFIG, ...config });\n }\n\n protected init() {\n const module = new InstrumentationNodeModuleDefinition('graphql', supportedVersions);\n module.files.push(this._addPatchingExecute());\n module.files.push(this._addPatchingParser());\n module.files.push(this._addPatchingValidate());\n\n return module;\n }\n\n private _addPatchingExecute(): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n 'graphql/execution/execute.js',\n supportedVersions,\n // cannot make it work with appropriate type as execute function has 2\n //types and/cannot import function but only types\n (moduleExports: any) => {\n if (isWrapped(moduleExports.execute)) {\n this._unwrap(moduleExports, 'execute');\n }\n this._wrap(moduleExports, 'execute', this._patchExecute(moduleExports.defaultFieldResolver));\n return moduleExports;\n },\n moduleExports => {\n if (moduleExports) {\n this._unwrap(moduleExports, 'execute');\n }\n },\n );\n }\n\n private _addPatchingParser(): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n 'graphql/language/parser.js',\n supportedVersions,\n (moduleExports: { parse: parseType; [key: string]: any }) => {\n if (isWrapped(moduleExports.parse)) {\n this._unwrap(moduleExports, 'parse');\n }\n this._wrap(moduleExports, 'parse', this._patchParse());\n return moduleExports;\n },\n (moduleExports: { parse: parseType; [key: string]: any }) => {\n if (moduleExports) {\n this._unwrap(moduleExports, 'parse');\n }\n },\n );\n }\n\n private _addPatchingValidate(): InstrumentationNodeModuleFile {\n return new InstrumentationNodeModuleFile(\n 'graphql/validation/validate.js',\n supportedVersions,\n moduleExports => {\n if (isWrapped(moduleExports.validate)) {\n this._unwrap(moduleExports, 'validate');\n }\n this._wrap(moduleExports, 'validate', this._patchValidate());\n return moduleExports;\n },\n moduleExports => {\n if (moduleExports) {\n this._unwrap(moduleExports, 'validate');\n }\n },\n );\n }\n\n private _patchExecute(defaultFieldResolved: GraphQLFieldResolver<any, any>): (original: executeType) => executeType {\n const instrumentation = this;\n return function execute(original) {\n return function patchExecute(this: executeType): PromiseOrValue<ExecutionResult> {\n let processedArgs: OtelExecutionArgs;\n\n // case when apollo server is used for example\n if (arguments.length >= 2) {\n const args = arguments as unknown as executeArgumentsArray;\n processedArgs = instrumentation._wrapExecuteArgs(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4],\n args[5],\n args[6],\n args[7],\n defaultFieldResolved,\n );\n } else {\n const args = arguments[0] as ExecutionArgs;\n processedArgs = instrumentation._wrapExecuteArgs(\n args.schema,\n args.document,\n args.rootValue,\n args.contextValue,\n args.variableValues,\n args.operationName,\n args.fieldResolver,\n args.typeResolver,\n defaultFieldResolved,\n );\n }\n\n const operation = getOperation(processedArgs.document, processedArgs.operationName);\n\n const span = instrumentation._createExecuteSpan(operation, processedArgs);\n\n processedArgs.contextValue[OTEL_GRAPHQL_DATA_SYMBOL] = {\n source: processedArgs.document\n ? processedArgs.document || (processedArgs.document as ObjectWithGraphQLData)[OTEL_GRAPHQL_DATA_SYMBOL]\n : undefined,\n span,\n fields: {},\n };\n\n return withActiveSpan(span, () => {\n return safeExecuteInTheMiddle<PromiseOrValue<ExecutionResult>>(\n () => {\n return (original as executeFunctionWithObj).apply(this, [processedArgs]);\n },\n (err, result) => {\n instrumentation._handleExecutionResult(span, err, result);\n },\n );\n });\n };\n };\n }\n\n private _handleExecutionResult(span: Span, err?: Error, result?: PromiseOrValue<ExecutionResult>) {\n if (result === undefined || err) {\n endSpan(span, err);\n return;\n }\n\n if (isPromise(result)) {\n result.then(\n resultData => {\n this._updateSpanFromResult(span, resultData);\n endSpan(span);\n },\n error => {\n endSpan(span, error);\n },\n );\n } else {\n this._updateSpanFromResult(span, result);\n endSpan(span);\n }\n }\n\n /**\n * Applies Sentry-specific span mutations based on the GraphQL execution result:\n * - Marks the execute span as errored if the result contains errors (and no status was set yet)\n * - Optionally renames the containing root span to include the GraphQL operation name(s)\n */\n private _updateSpanFromResult(span: Span, result: ExecutionResult): void {\n // We want to ensure spans are marked as errored if there are errors in the result\n // We only do that if the span is not already marked with a status\n if (result.errors?.length && !spanToJSON(span).status) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n }\n\n if (!this.getConfig().useOperationNameForRootSpan) {\n return;\n }\n\n const attributes = spanToJSON(span).data;\n\n // If operation.name is not set, we fall back to use operation.type only\n const operationType = attributes[AttributeNames.OPERATION_TYPE];\n const operationName = attributes[AttributeNames.OPERATION_NAME];\n\n if (!operationType) {\n return;\n }\n\n const rootSpan = getRootSpan(span);\n const rootSpanAttributes = spanToJSON(rootSpan).data;\n\n const existingOperations = rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION] || [];\n\n const newOperation = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n\n // We keep track of each operation on the root span\n // This can either be a string, or an array of strings (if there are multiple operations)\n if (Array.isArray(existingOperations)) {\n (existingOperations as string[]).push(newOperation);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, existingOperations);\n } else if (typeof existingOperations === 'string') {\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, [existingOperations, newOperation]);\n } else {\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION, newOperation);\n }\n\n if (!spanToJSON(rootSpan).data['original-description']) {\n rootSpan.setAttribute('original-description', spanToJSON(rootSpan).description);\n }\n // Important for e.g. @sentry/aws-serverless because this would otherwise overwrite the name again\n rootSpan.updateName(\n `${spanToJSON(rootSpan).data['original-description']} (${getGraphqlOperationNamesFromAttribute(\n existingOperations,\n )})`,\n );\n }\n\n private _patchParse(): (original: parseType) => parseType {\n const instrumentation = this;\n return function parse(original) {\n return function patchParse(this: parseType, source: string | Source, options?: ParseOptions): DocumentNode {\n return instrumentation._parse(this, original, source, options);\n };\n };\n }\n\n private _patchValidate(): (original: validateType) => validateType {\n const instrumentation = this;\n return function validate(original: validateType) {\n return function patchValidate(\n this: validateType,\n schema: GraphQLSchema,\n documentAST: DocumentNode,\n rules?: ReadonlyArray<ValidationRule>,\n options?: { maxErrors?: number },\n typeInfo?: TypeInfo,\n ): ReadonlyArray<GraphQLError> {\n return instrumentation._validate(this, original, schema, documentAST, rules, typeInfo, options);\n };\n };\n }\n\n private _parse(obj: parseType, original: parseType, source: string | Source, options?: ParseOptions): DocumentNode {\n const span = startInactiveSpan({ name: SpanNames.PARSE });\n\n return withActiveSpan(span, () => {\n return safeExecuteInTheMiddle<DocumentNode & ObjectWithGraphQLData>(\n () => {\n return original.call(obj, source, options);\n },\n (err, result) => {\n if (result) {\n const operation = getOperation(result);\n if (!operation) {\n span.updateName(SpanNames.SCHEMA_PARSE);\n } else if (result.loc) {\n addSpanSource(span, result.loc);\n }\n }\n endSpan(span, err);\n },\n );\n });\n }\n\n private _validate(\n obj: validateType,\n original: validateType,\n schema: GraphQLSchema,\n documentAST: DocumentNode,\n rules?: ReadonlyArray<ValidationRule>,\n typeInfo?: TypeInfo,\n options?: { maxErrors?: number },\n ): ReadonlyArray<GraphQLError> {\n const span = startInactiveSpan({ name: SpanNames.VALIDATE });\n\n return withActiveSpan(span, () => {\n return safeExecuteInTheMiddle<ReadonlyArray<GraphQLError>>(\n () => {\n return original.call(obj, schema, documentAST, rules, options, typeInfo);\n },\n (err, _errors) => {\n if (!documentAST.loc) {\n span.updateName(SpanNames.SCHEMA_VALIDATE);\n }\n endSpan(span, err);\n },\n );\n });\n }\n\n private _createExecuteSpan(operation: DefinitionNode | undefined, processedArgs: ExecutionArgs): Span {\n const span = startInactiveSpan({\n name: SpanNames.EXECUTE,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN },\n });\n if (operation) {\n const { operation: operationType, name: nameNode } = operation as OperationDefinitionNode;\n\n span.setAttribute(AttributeNames.OPERATION_TYPE, operationType);\n\n const operationName = nameNode?.value;\n\n // https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/instrumentation/graphql/\n // > The span name MUST be of the format <graphql.operation.type> <graphql.operation.name> provided that graphql.operation.type and graphql.operation.name are available.\n // > If graphql.operation.name is not available, the span SHOULD be named <graphql.operation.type>.\n if (operationName) {\n span.setAttribute(AttributeNames.OPERATION_NAME, operationName);\n span.updateName(`${operationType} ${operationName}`);\n } else {\n span.updateName(operationType);\n }\n } else {\n let operationName = ' ';\n if (processedArgs.operationName) {\n operationName = ` \"${processedArgs.operationName}\" `;\n }\n operationName = OPERATION_NOT_SUPPORTED.replace('$operationName$', operationName);\n span.setAttribute(AttributeNames.OPERATION_NAME, operationName);\n }\n\n if (processedArgs.document?.loc) {\n addSpanSource(span, processedArgs.document.loc);\n }\n\n return span;\n }\n\n private _wrapExecuteArgs(\n schema: GraphQLSchema,\n document: DocumentNode,\n rootValue: any,\n contextValue: any,\n variableValues: Maybe<{ [key: string]: any }>,\n operationName: Maybe<string>,\n fieldResolver: Maybe<GraphQLFieldResolver<any, any>>,\n typeResolver: Maybe<GraphQLTypeResolver<any, any>>,\n defaultFieldResolved: GraphQLFieldResolver<any, any>,\n ): OtelExecutionArgs {\n if (!contextValue) {\n // oxlint-disable-next-line no-param-reassign\n contextValue = {};\n }\n\n if (contextValue[OTEL_GRAPHQL_DATA_SYMBOL] || this.getConfig().ignoreResolveSpans) {\n return {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n };\n }\n\n const isUsingDefaultResolver = fieldResolver == null;\n // follows graphql implementation here:\n // https://github.com/graphql/graphql-js/blob/0b7daed9811731362c71900e12e5ea0d1ecc7f1f/src/execution/execute.ts#L494\n const fieldResolverForExecute = fieldResolver ?? defaultFieldResolved;\n // oxlint-disable-next-line no-param-reassign\n fieldResolver = wrapFieldResolver(() => this.getConfig(), fieldResolverForExecute, isUsingDefaultResolver);\n\n if (schema) {\n wrapFields(schema.getQueryType() as any, () => this.getConfig());\n wrapFields(schema.getMutationType() as any, () => this.getConfig());\n }\n\n return {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n };\n }\n}\n\n// copy from packages/opentelemetry/utils\nfunction getGraphqlOperationNamesFromAttribute(attr: SpanAttributeValue): string {\n if (Array.isArray(attr)) {\n // oxlint-disable-next-line typescript/require-array-sort-compare\n const sorted = attr.slice().sort();\n\n // Up to 5 items, we just add all of them\n if (sorted.length <= 5) {\n return sorted.join(', ');\n } else {\n // Else, we add the first 5 and the diff of other operations\n return `${sorted.slice(0, 5).join(', ')}, +${sorted.length - 5}`;\n }\n }\n\n return `${attr}`;\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","isWrapped","instrumentation","getOperation","OTEL_GRAPHQL_DATA_SYMBOL","withActiveSpan","safeExecuteInTheMiddle","endSpan","isPromise","spanToJSON","SPAN_STATUS_ERROR","AttributeNames","getRootSpan","SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPER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C;AAC/E,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,EAAG;AAEvB,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,EAAM,CAAE,IAAA,EAAK;AAGjC,IAAA,IAAI,MAAA,CAAO,UAAU,CAAA,EAAG;AACtB,MAAA,OAAO,MAAA,CAAO,KAAK,IAAI,CAAA;AAAA,IACzB,CAAA,MAAO;AAEL,MAAA,OAAO,CAAA,EAAG,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,GAAA,EAAM,MAAA,CAAO,MAAA,GAAS,CAAC,CAAA,CAAA;AAAA,IAChE;AAAA,EACF;AAEA,EAAA,OAAO,GAAG,IAAI,CAAA,CAAA;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-types.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/internal-types.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n
|
|
1
|
+
{"version":3,"file":"internal-types.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/internal-types.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n * - Types from `graphql` package inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments\n */\n\nimport type { Span } from '@sentry/core';\nimport type {\n DocumentNode,\n ExecutionArgs,\n ExecutionResult,\n GraphQLError,\n GraphQLFieldResolver,\n GraphQLSchema,\n GraphQLTypeResolver,\n Maybe,\n ParseOptions,\n PromiseOrValue,\n Source,\n TypeInfo,\n ValidationRule,\n} from './graphql-types';\nimport type { OTEL_GRAPHQL_DATA_SYMBOL, OTEL_PATCHED_SYMBOL } from './symbols';\n\nexport type { Maybe } from './graphql-types';\n\nexport const OPERATION_NOT_SUPPORTED = 'Operation$operationName$not' + ' supported';\n\nexport type executeFunctionWithObj = (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>;\n\nexport type executeArgumentsArray = [\n GraphQLSchema,\n DocumentNode,\n any,\n any,\n Maybe<{ [key: string]: any }>,\n Maybe<string>,\n Maybe<GraphQLFieldResolver<any, any>>,\n Maybe<GraphQLTypeResolver<any, any>>,\n];\n\nexport type executeFunctionWithArgs = (\n schema: GraphQLSchema,\n document: DocumentNode,\n rootValue?: any,\n contextValue?: any,\n variableValues?: Maybe<{ [key: string]: any }>,\n operationName?: Maybe<string>,\n fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,\n typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,\n) => PromiseOrValue<ExecutionResult>;\n\nexport interface OtelExecutionArgs {\n schema: GraphQLSchema;\n document: DocumentNode & ObjectWithGraphQLData;\n rootValue?: any;\n contextValue?: any & ObjectWithGraphQLData;\n variableValues?: Maybe<{ [key: string]: any }>;\n operationName?: Maybe<string>;\n fieldResolver?: Maybe<GraphQLFieldResolver<any, any> & OtelPatched>;\n typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;\n}\n\nexport type executeType = executeFunctionWithObj | executeFunctionWithArgs;\n\nexport type parseType = (source: string | Source, options?: ParseOptions) => DocumentNode;\n\nexport type validateType = (\n schema: GraphQLSchema,\n documentAST: DocumentNode,\n rules?: ReadonlyArray<ValidationRule>,\n options?: { maxErrors?: number },\n typeInfo?: TypeInfo,\n) => ReadonlyArray<GraphQLError>;\n\nexport interface GraphQLField {\n span: Span;\n}\n\ninterface OtelGraphQLData {\n source?: any;\n span: Span;\n fields: { [key: string]: GraphQLField };\n}\n\nexport interface ObjectWithGraphQLData {\n [OTEL_GRAPHQL_DATA_SYMBOL]?: OtelGraphQLData;\n}\n\nexport interface OtelPatched {\n [OTEL_PATCHED_SYMBOL]?: boolean;\n}\n\nexport interface GraphQLPath {\n prev: GraphQLPath | undefined;\n key: string | number;\n /**\n * optional as it didn't exist yet in ver 14\n */\n typename?: string | undefined;\n}\n"],"names":[],"mappings":";;AA+BO,MAAM,uBAAA,GAA0B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/symbols.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n
|
|
1
|
+
{"version":3,"file":"symbols.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/symbols.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-graphql\n * - Upstream version: @opentelemetry/instrumentation-graphql@0.66.0\n */\n\nexport const OTEL_PATCHED_SYMBOL = Symbol.for('opentelemetry.patched');\n\nexport const OTEL_GRAPHQL_DATA_SYMBOL = Symbol.for('opentelemetry.graphql_data');\n"],"names":[],"mappings":";;AASO,MAAM,mBAAA,mBAAsB,MAAA,CAAO,GAAA,CAAI,uBAAuB;AAE9D,MAAM,wBAAA,mBAA2B,MAAA,CAAO,GAAA,CAAI,4BAA4B;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
4
|
const _enum = require('./enum.js');
|
|
5
5
|
const AttributeNames = require('./enums/AttributeNames.js');
|
|
6
6
|
const symbols = require('./symbols.js');
|
|
@@ -12,65 +12,44 @@ const isPromise = (value) => {
|
|
|
12
12
|
const isObjectLike = (value) => {
|
|
13
13
|
return typeof value == "object" && value !== null;
|
|
14
14
|
};
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
variable.forEach((value, idx) => {
|
|
18
|
-
addInputVariableAttribute(span, `${key}.${idx}`, value);
|
|
19
|
-
});
|
|
20
|
-
} else if (variable instanceof Object) {
|
|
21
|
-
Object.entries(variable).forEach(([nestedKey, value]) => {
|
|
22
|
-
addInputVariableAttribute(span, `${key}.${nestedKey}`, value);
|
|
23
|
-
});
|
|
24
|
-
} else {
|
|
25
|
-
span.setAttribute(`${AttributeNames.AttributeNames.VARIABLES}${String(key)}`, variable);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function addInputVariableAttributes(span, variableValues) {
|
|
29
|
-
Object.entries(variableValues).forEach(([key, value]) => {
|
|
30
|
-
addInputVariableAttribute(span, key, value);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function addSpanSource(span, loc, allowValues, start, end) {
|
|
34
|
-
const source = getSourceFromLocation(loc, allowValues, start, end);
|
|
15
|
+
function addSpanSource(span, loc, start, end) {
|
|
16
|
+
const source = getSourceFromLocation(loc, start, end);
|
|
35
17
|
span.setAttribute(AttributeNames.AttributeNames.SOURCE, source);
|
|
36
18
|
}
|
|
37
|
-
function createFieldIfNotExists(
|
|
19
|
+
function createFieldIfNotExists(contextValue, info, path) {
|
|
38
20
|
let field = getField(contextValue, path);
|
|
39
21
|
if (field) {
|
|
40
22
|
return { field, spanAdded: false };
|
|
41
23
|
}
|
|
42
|
-
const
|
|
43
|
-
const parentSpan = config.flatResolveSpans ? getRootSpan(contextValue) : getParentFieldSpan(contextValue, path);
|
|
24
|
+
const parentSpan = getParentFieldSpan(contextValue, path);
|
|
44
25
|
field = {
|
|
45
|
-
span: createResolverSpan(
|
|
26
|
+
span: createResolverSpan(contextValue, info, path, parentSpan)
|
|
46
27
|
};
|
|
47
28
|
addField(contextValue, path, field);
|
|
48
29
|
return { field, spanAdded: true };
|
|
49
30
|
}
|
|
50
|
-
function createResolverSpan(
|
|
31
|
+
function createResolverSpan(contextValue, info, path, parentSpan) {
|
|
51
32
|
const attributes = {
|
|
52
33
|
[AttributeNames.AttributeNames.FIELD_NAME]: info.fieldName,
|
|
53
34
|
[AttributeNames.AttributeNames.FIELD_PATH]: path.join("."),
|
|
54
35
|
[AttributeNames.AttributeNames.FIELD_TYPE]: info.returnType.toString(),
|
|
55
36
|
[AttributeNames.AttributeNames.PARENT_NAME]: info.parentType.name
|
|
56
37
|
};
|
|
57
|
-
const span =
|
|
58
|
-
`${_enum.SpanNames.RESOLVE} ${attributes[AttributeNames.AttributeNames.FIELD_PATH]}`,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
parentSpan ? api.trace.setSpan(api.context.active(), parentSpan) : void 0
|
|
63
|
-
);
|
|
38
|
+
const span = core.startInactiveSpan({
|
|
39
|
+
name: `${_enum.SpanNames.RESOLVE} ${attributes[AttributeNames.AttributeNames.FIELD_PATH]}`,
|
|
40
|
+
attributes,
|
|
41
|
+
parentSpan
|
|
42
|
+
});
|
|
64
43
|
const document = contextValue[symbols.OTEL_GRAPHQL_DATA_SYMBOL].source;
|
|
65
44
|
const fieldNode = info.fieldNodes.find((fieldNode2) => fieldNode2.kind === "Field");
|
|
66
45
|
if (fieldNode) {
|
|
67
|
-
addSpanSource(span, document.loc,
|
|
46
|
+
addSpanSource(span, document.loc, fieldNode.loc?.start, fieldNode.loc?.end);
|
|
68
47
|
}
|
|
69
48
|
return span;
|
|
70
49
|
}
|
|
71
50
|
function endSpan(span, error) {
|
|
72
51
|
if (error) {
|
|
73
|
-
span.
|
|
52
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: error.message });
|
|
74
53
|
}
|
|
75
54
|
span.end();
|
|
76
55
|
}
|
|
@@ -102,15 +81,11 @@ function getParentFieldSpan(contextValue, path) {
|
|
|
102
81
|
function getRootSpan(contextValue) {
|
|
103
82
|
return contextValue[symbols.OTEL_GRAPHQL_DATA_SYMBOL].span;
|
|
104
83
|
}
|
|
105
|
-
function pathToArray(
|
|
84
|
+
function pathToArray(path) {
|
|
106
85
|
const flattened = [];
|
|
107
86
|
let curr = path;
|
|
108
87
|
while (curr) {
|
|
109
|
-
|
|
110
|
-
if (mergeItems && typeof key === "number") {
|
|
111
|
-
key = "*";
|
|
112
|
-
}
|
|
113
|
-
flattened.push(String(key));
|
|
88
|
+
flattened.push(String(curr.key));
|
|
114
89
|
curr = curr.prev;
|
|
115
90
|
}
|
|
116
91
|
return flattened.reverse();
|
|
@@ -129,7 +104,7 @@ function repeatChar(char, to) {
|
|
|
129
104
|
return text;
|
|
130
105
|
}
|
|
131
106
|
const KindsToBeRemoved = [_enum.TokenKind.FLOAT, _enum.TokenKind.STRING, _enum.TokenKind.INT, _enum.TokenKind.BLOCK_STRING];
|
|
132
|
-
function getSourceFromLocation(loc,
|
|
107
|
+
function getSourceFromLocation(loc, inputStart, inputEnd) {
|
|
133
108
|
let source = "";
|
|
134
109
|
if (loc?.startToken) {
|
|
135
110
|
const start = typeof inputStart === "number" ? inputStart : loc.start;
|
|
@@ -149,7 +124,7 @@ function getSourceFromLocation(loc, allowValues = false, inputStart, inputEnd) {
|
|
|
149
124
|
}
|
|
150
125
|
let value = next.value || next.kind;
|
|
151
126
|
let space = "";
|
|
152
|
-
if (
|
|
127
|
+
if (KindsToBeRemoved.indexOf(next.kind) >= 0) {
|
|
153
128
|
value = "*";
|
|
154
129
|
}
|
|
155
130
|
if (next.kind === _enum.TokenKind.STRING) {
|
|
@@ -175,7 +150,7 @@ function getSourceFromLocation(loc, allowValues = false, inputStart, inputEnd) {
|
|
|
175
150
|
}
|
|
176
151
|
return source;
|
|
177
152
|
}
|
|
178
|
-
function wrapFields(type,
|
|
153
|
+
function wrapFields(type, getConfig) {
|
|
179
154
|
if (!type || type[symbols.OTEL_PATCHED_SYMBOL]) {
|
|
180
155
|
return;
|
|
181
156
|
}
|
|
@@ -187,12 +162,12 @@ function wrapFields(type, tracer, getConfig) {
|
|
|
187
162
|
return;
|
|
188
163
|
}
|
|
189
164
|
if (field.resolve) {
|
|
190
|
-
field.resolve = wrapFieldResolver(
|
|
165
|
+
field.resolve = wrapFieldResolver(getConfig, field.resolve);
|
|
191
166
|
}
|
|
192
167
|
if (field.type) {
|
|
193
168
|
const unwrappedTypes = unwrapType(field.type);
|
|
194
169
|
for (const unwrappedType of unwrappedTypes) {
|
|
195
|
-
wrapFields(unwrappedType,
|
|
170
|
+
wrapFields(unwrappedType, getConfig);
|
|
196
171
|
}
|
|
197
172
|
}
|
|
198
173
|
});
|
|
@@ -219,9 +194,8 @@ const handleResolveSpanError = (resolveSpan, err, shouldEndSpan) => {
|
|
|
219
194
|
if (!shouldEndSpan) {
|
|
220
195
|
return;
|
|
221
196
|
}
|
|
222
|
-
resolveSpan.recordException(err);
|
|
223
197
|
resolveSpan.setStatus({
|
|
224
|
-
code:
|
|
198
|
+
code: core.SPAN_STATUS_ERROR,
|
|
225
199
|
message: err.message
|
|
226
200
|
});
|
|
227
201
|
resolveSpan.end();
|
|
@@ -232,7 +206,7 @@ const handleResolveSpanSuccess = (resolveSpan, shouldEndSpan) => {
|
|
|
232
206
|
}
|
|
233
207
|
resolveSpan.end();
|
|
234
208
|
};
|
|
235
|
-
function wrapFieldResolver(
|
|
209
|
+
function wrapFieldResolver(getConfig, fieldResolver, isDefaultResolver = false) {
|
|
236
210
|
if (wrappedFieldResolver[symbols.OTEL_PATCHED_SYMBOL] || typeof fieldResolver !== "function") {
|
|
237
211
|
return fieldResolver;
|
|
238
212
|
}
|
|
@@ -250,18 +224,11 @@ function wrapFieldResolver(tracer, getConfig, fieldResolver, isDefaultResolver =
|
|
|
250
224
|
if (!contextValue[symbols.OTEL_GRAPHQL_DATA_SYMBOL]) {
|
|
251
225
|
return fieldResolver.call(this, source, args, contextValue, info);
|
|
252
226
|
}
|
|
253
|
-
const path = pathToArray(
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
span = getParentFieldSpan(contextValue, path);
|
|
259
|
-
} else {
|
|
260
|
-
const { field, spanAdded } = createFieldIfNotExists(tracer, getConfig, contextValue, info, path);
|
|
261
|
-
span = field.span;
|
|
262
|
-
shouldEndSpan = spanAdded;
|
|
263
|
-
}
|
|
264
|
-
return api.context.with(api.trace.setSpan(api.context.active(), span), () => {
|
|
227
|
+
const path = pathToArray(info?.path);
|
|
228
|
+
const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path);
|
|
229
|
+
const span = field.span;
|
|
230
|
+
const shouldEndSpan = spanAdded;
|
|
231
|
+
return core.withActiveSpan(span, () => {
|
|
265
232
|
try {
|
|
266
233
|
const res = fieldResolver.call(this, source, args, contextValue, info);
|
|
267
234
|
if (isPromise(res)) {
|
|
@@ -289,7 +256,6 @@ function wrapFieldResolver(tracer, getConfig, fieldResolver, isDefaultResolver =
|
|
|
289
256
|
return wrappedFieldResolver;
|
|
290
257
|
}
|
|
291
258
|
|
|
292
|
-
exports.addInputVariableAttributes = addInputVariableAttributes;
|
|
293
259
|
exports.addSpanSource = addSpanSource;
|
|
294
260
|
exports.endSpan = endSpan;
|
|
295
261
|
exports.getOperation = getOperation;
|