@sentry/node 10.58.0 → 10.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/fs/index.js +3 -84
- package/build/cjs/integrations/fs/index.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/instrumentation.js +145 -175
- package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/index.js +0 -21
- package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js +0 -6
- package/build/cjs/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +33 -42
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/utils.js +3 -2
- package/build/cjs/integrations/tracing/connect/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/index.js +1 -15
- package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js +30 -18
- package/build/cjs/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/index.js +1 -51
- package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/enum.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
- package/build/cjs/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +67 -57
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js +28 -62
- package/build/cjs/integrations/tracing/graphql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js +0 -17
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +28 -45
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js +4 -9
- package/build/cjs/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +1 -0
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/index.js +2 -17
- package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +65 -93
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js +2 -0
- package/build/cjs/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/utils.js +2 -15
- package/build/cjs/integrations/tracing/knex/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/index.js +1 -24
- package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +29 -41
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/types.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/index.js +1 -42
- package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +12 -562
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js +151 -0
- package/build/cjs/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js +0 -4
- package/build/cjs/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js +153 -0
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/mongoose/index.js +1 -8
- package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +56 -203
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js +0 -4
- package/build/cjs/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js +19 -49
- package/build/cjs/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/index.js +1 -8
- package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +21 -59
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js +14 -33
- package/build/cjs/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/index.js +0 -4
- package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +51 -261
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js +0 -12
- package/build/cjs/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js +43 -167
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +89 -160
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +92 -231
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js +0 -2
- package/build/cjs/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/index.js +1 -25
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +25 -76
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/utils.js.map +1 -1
- package/build/cjs/sdk/diagnosticsChannelInjection.js +21 -0
- package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +19 -0
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/cjs/sdk/index.js +17 -1
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/fs/index.js +4 -85
- package/build/esm/integrations/fs/index.js.map +1 -1
- package/build/esm/integrations/fs/vendored/constants.js.map +1 -1
- package/build/esm/integrations/fs/vendored/instrumentation.js +147 -177
- package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/fs/vendored/utils.js.map +1 -1
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/connect/index.js +1 -22
- package/build/esm/integrations/tracing/connect/index.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js +1 -6
- package/build/esm/integrations/tracing/connect/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +36 -44
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/utils.js +3 -2
- package/build/esm/integrations/tracing/connect/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/index.js +3 -17
- package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js +31 -19
- package/build/esm/integrations/tracing/genericPool/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/index.js +3 -53
- package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/enum.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js +0 -2
- package/build/esm/integrations/tracing/graphql/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +69 -59
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/symbols.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/utils.js +29 -62
- package/build/esm/integrations/tracing/graphql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js +1 -18
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +30 -47
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/utils.js +5 -10
- package/build/esm/integrations/tracing/hapi/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +1 -0
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/propagator.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/knex/index.js +4 -19
- package/build/esm/integrations/tracing/knex/index.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +66 -94
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js +2 -1
- package/build/esm/integrations/tracing/knex/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/utils.js +3 -15
- package/build/esm/integrations/tracing/knex/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/koa/index.js +3 -26
- package/build/esm/integrations/tracing/koa/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +31 -43
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/types.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/index.js +3 -43
- package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +13 -563
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/internal-types.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/patches.js +143 -0
- package/build/esm/integrations/tracing/mongo/vendored/patches.js.map +1 -0
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js +1 -3
- package/build/esm/integrations/tracing/mongo/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/utils.js +146 -0
- package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/mongoose/index.js +2 -9
- package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +59 -206
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js +1 -3
- package/build/esm/integrations/tracing/mongoose/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js +20 -50
- package/build/esm/integrations/tracing/mongoose/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/index.js +2 -9
- package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +26 -64
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js +15 -34
- package/build/esm/integrations/tracing/mysql2/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/index.js +1 -5
- package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js +0 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/AttributeNames.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/enums/SpanNames.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +52 -262
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js +1 -7
- package/build/esm/integrations/tracing/postgres/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/utils.js +44 -165
- package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +92 -163
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-common.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +94 -233
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/semconv.js +1 -2
- package/build/esm/integrations/tracing/redis/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/index.js +3 -27
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +29 -79
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/utils.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/diagnosticsChannelInjection.js +17 -0
- package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +17 -0
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -0
- package/build/esm/sdk/index.js +17 -1
- package/build/esm/sdk/index.js.map +1 -1
- package/build/import-hook.mjs +6 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/fs/index.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/instrumentation.d.ts +6 -10
- package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/types.d.ts +10 -15
- package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/utils.d.ts +2 -2
- package/build/types/integrations/fs/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
- package/build/types/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts +5 -5
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
- package/build/types/integrations/tracing/connect/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts +1 -1
- package/build/types/integrations/tracing/connect/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/enum.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
- package/build/types/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts +7 -2
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts +4 -4
- package/build/types/integrations/tracing/graphql/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/symbols.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts +5 -43
- package/build/types/integrations/tracing/graphql/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts +8 -11
- package/build/types/integrations/tracing/graphql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts +3 -4
- package/build/types/integrations/tracing/hapi/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
- package/build/types/integrations/tracing/knex/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts +0 -6
- package/build/types/integrations/tracing/knex/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
- package/build/types/integrations/tracing/koa/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/types.d.ts +2 -39
- package/build/types/integrations/tracing/koa/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts +3 -3
- package/build/types/integrations/tracing/koa/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/index.d.ts +0 -4
- package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
- package/build/types/integrations/tracing/mongo/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types/integrations/tracing/mongo/vendored/patches.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
- package/build/types/integrations/tracing/mongo/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
- package/build/types/integrations/tracing/mongoose/vendored/mongoose-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
- package/build/types/integrations/tracing/mongoose/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
- package/build/types/integrations/tracing/mongoose/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
- package/build/types/integrations/tracing/mysql2/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/enums/SpanNames.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts +1 -9
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
- package/build/types/integrations/tracing/postgres/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/pg-pool-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/pg-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
- package/build/types/integrations/tracing/postgres/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts +2 -56
- package/build/types/integrations/tracing/postgres/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-common.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/types.d.ts +2 -36
- package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/utils.d.ts.map +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -0
- package/build/types/sdk/index.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +6 -10
- package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +10 -15
- package/build/types-ts3.8/integrations/fs/vendored/utils.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/connect/vendored/enums/AttributeNames.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/connect/vendored/instrumentation.d.ts +4 -4
- package/build/types-ts3.8/integrations/tracing/connect/vendored/internal-types.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/enums/AttributeNames.d.ts +1 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/instrumentation.d.ts +6 -1
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/internal-types.d.ts +3 -3
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/types.d.ts +4 -42
- package/build/types-ts3.8/integrations/tracing/graphql/vendored/utils.d.ts +6 -9
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/instrumentation.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/hapi/vendored/utils.d.ts +1 -2
- package/build/types-ts3.8/integrations/tracing/knex/vendored/instrumentation.d.ts +8 -10
- package/build/types-ts3.8/integrations/tracing/knex/vendored/semconv.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/knex/vendored/utils.d.ts +0 -6
- package/build/types-ts3.8/integrations/tracing/koa/vendored/internal-types.d.ts +4 -4
- package/build/types-ts3.8/integrations/tracing/koa/vendored/types.d.ts +1 -38
- package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/instrumentation.d.ts +4 -72
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/internal-types.d.ts +0 -59
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/patches.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/semconv.d.ts +0 -54
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/utils.d.ts +24 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose-types.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/mongoose.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/semconv.d.ts +0 -14
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/utils.d.ts +4 -6
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/instrumentation.d.ts +3 -6
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/utils.d.ts +3 -5
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/enums/AttributeNames.d.ts +0 -1
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/instrumentation.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/internal-types.d.ts +0 -2
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/semconv.d.ts +0 -50
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/types.d.ts +1 -55
- package/build/types-ts3.8/integrations/tracing/postgres/vendored/utils.d.ts +13 -26
- package/build/types-ts3.8/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts +3 -8
- package/build/types-ts3.8/integrations/tracing/redis/vendored/types.d.ts +2 -36
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/instrumentation.d.ts +3 -14
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +41 -0
- package/build/types-ts3.8/sdk/experimentalUseDiagnosticsChannelInjection.d.ts +34 -0
- package/package.json +20 -6
- package/build/cjs/integrations/tracing/knex/vendored/constants.js +0 -16
- package/build/cjs/integrations/tracing/knex/vendored/constants.js.map +0 -1
- package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js +0 -6
- package/build/cjs/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
- package/build/cjs/integrations/tracing/utils/sql-common.js +0 -43
- package/build/cjs/integrations/tracing/utils/sql-common.js.map +0 -1
- package/build/esm/integrations/tracing/knex/vendored/constants.js +0 -13
- package/build/esm/integrations/tracing/knex/vendored/constants.js.map +0 -1
- package/build/esm/integrations/tracing/postgres/vendored/internal-types.js +0 -4
- package/build/esm/integrations/tracing/postgres/vendored/internal-types.js.map +0 -1
- package/build/esm/integrations/tracing/utils/sql-common.js +0 -41
- package/build/esm/integrations/tracing/utils/sql-common.js.map +0 -1
- package/build/types/integrations/tracing/knex/vendored/constants.d.ts +0 -3
- package/build/types/integrations/tracing/knex/vendored/constants.d.ts.map +0 -1
- package/build/types/integrations/tracing/knex/vendored/types.d.ts +0 -8
- package/build/types/integrations/tracing/knex/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/mongo/vendored/types.d.ts +0 -51
- package/build/types/integrations/tracing/mongo/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
- package/build/types/integrations/tracing/mongoose/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
- package/build/types/integrations/tracing/mysql2/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/tedious/vendored/types.d.ts +0 -10
- package/build/types/integrations/tracing/tedious/vendored/types.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/tracing/knex/vendored/constants.d.ts +0 -3
- package/build/types-ts3.8/integrations/tracing/knex/vendored/types.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/mongo/vendored/types.d.ts +0 -51
- package/build/types-ts3.8/integrations/tracing/mongoose/vendored/types.d.ts +0 -36
- package/build/types-ts3.8/integrations/tracing/mysql2/vendored/types.d.ts +0 -18
- package/build/types-ts3.8/integrations/tracing/tedious/vendored/types.d.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/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":[],"mappings":";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AAA,OAAO;AAAA,QACL,MAAA;AAAA,QACA,QAAA;AAAA,QACA,SAAA;AAAA,QACA,YAAA;AAAA,QACA,cAAA;AAAA,QACA,aAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAEA,IAAA,MAAM,yBAAyB,aAAA,IAAiB,IAAA;AAGhD,IAAA,MAAM,0BAA0B,aAAA,IAAiB,oBAAA;AACjD,IAAA,aAAA,GAAgB,iBAAA;AAAA,MACd,IAAA,CAAK,MAAA;AAAA,MACL,MAAM,KAAK,SAAA,EAAU;AAAA,MACrB,uBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,UAAA,CAAW,MAAA,CAAO,cAAa,EAAU,IAAA,CAAK,QAAQ,MAAM,IAAA,CAAK,WAAW,CAAA;AAC5E,MAAA,UAAA,CAAW,MAAA,CAAO,iBAAgB,EAAU,IAAA,CAAK,QAAQ,MAAM,IAAA,CAAK,WAAW,CAAA;AAAA,IACjF;AAEA,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;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":[],"mappings":";;;;;;;;;;AAsEA,MAAM,YAAA,GAAe,iCAAA;AAErB,MAAM,MAAA,GAAS,2BAAA;AAEf,MAAM,cAAA,GAAqD;AAAA,EACzD,kBAAA,EAAoB;AACtB,CAAA;AAEA,MAAM,iBAAA,GAAoB,CAAC,cAAc,CAAA;AAElC,MAAM,+BAA+B,mBAAA,CAAwD;AAAA,EAClG,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,cAAc,WAAA,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,IAAI,mCAAA,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,CA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,eAAA,EAAgB,EAAU,MAAM,IAAA,CAAK,WAAW,CAAA;AAAA,IACpE;AAEA,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,cAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AACF;AAGA,SAAS,sCAAsC,IAAA,EAAkC;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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SPAN_STATUS_ERROR, withActiveSpan, startInactiveSpan } from '@sentry/core';
|
|
2
2
|
import { AllowedOperationTypes, TokenKind, SpanNames } from './enum.js';
|
|
3
3
|
import { AttributeNames } from './enums/AttributeNames.js';
|
|
4
4
|
import { OTEL_PATCHED_SYMBOL, OTEL_GRAPHQL_DATA_SYMBOL } from './symbols.js';
|
|
@@ -10,65 +10,44 @@ const isPromise = (value) => {
|
|
|
10
10
|
const isObjectLike = (value) => {
|
|
11
11
|
return typeof value == "object" && value !== null;
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
variable.forEach((value, idx) => {
|
|
16
|
-
addInputVariableAttribute(span, `${key}.${idx}`, value);
|
|
17
|
-
});
|
|
18
|
-
} else if (variable instanceof Object) {
|
|
19
|
-
Object.entries(variable).forEach(([nestedKey, value]) => {
|
|
20
|
-
addInputVariableAttribute(span, `${key}.${nestedKey}`, value);
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
span.setAttribute(`${AttributeNames.VARIABLES}${String(key)}`, variable);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function addInputVariableAttributes(span, variableValues) {
|
|
27
|
-
Object.entries(variableValues).forEach(([key, value]) => {
|
|
28
|
-
addInputVariableAttribute(span, key, value);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function addSpanSource(span, loc, allowValues, start, end) {
|
|
32
|
-
const source = getSourceFromLocation(loc, allowValues, start, end);
|
|
13
|
+
function addSpanSource(span, loc, start, end) {
|
|
14
|
+
const source = getSourceFromLocation(loc, start, end);
|
|
33
15
|
span.setAttribute(AttributeNames.SOURCE, source);
|
|
34
16
|
}
|
|
35
|
-
function createFieldIfNotExists(
|
|
17
|
+
function createFieldIfNotExists(contextValue, info, path) {
|
|
36
18
|
let field = getField(contextValue, path);
|
|
37
19
|
if (field) {
|
|
38
20
|
return { field, spanAdded: false };
|
|
39
21
|
}
|
|
40
|
-
const
|
|
41
|
-
const parentSpan = config.flatResolveSpans ? getRootSpan(contextValue) : getParentFieldSpan(contextValue, path);
|
|
22
|
+
const parentSpan = getParentFieldSpan(contextValue, path);
|
|
42
23
|
field = {
|
|
43
|
-
span: createResolverSpan(
|
|
24
|
+
span: createResolverSpan(contextValue, info, path, parentSpan)
|
|
44
25
|
};
|
|
45
26
|
addField(contextValue, path, field);
|
|
46
27
|
return { field, spanAdded: true };
|
|
47
28
|
}
|
|
48
|
-
function createResolverSpan(
|
|
29
|
+
function createResolverSpan(contextValue, info, path, parentSpan) {
|
|
49
30
|
const attributes = {
|
|
50
31
|
[AttributeNames.FIELD_NAME]: info.fieldName,
|
|
51
32
|
[AttributeNames.FIELD_PATH]: path.join("."),
|
|
52
33
|
[AttributeNames.FIELD_TYPE]: info.returnType.toString(),
|
|
53
34
|
[AttributeNames.PARENT_NAME]: info.parentType.name
|
|
54
35
|
};
|
|
55
|
-
const span =
|
|
56
|
-
`${SpanNames.RESOLVE} ${attributes[AttributeNames.FIELD_PATH]}`,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
parentSpan ? api.trace.setSpan(api.context.active(), parentSpan) : void 0
|
|
61
|
-
);
|
|
36
|
+
const span = startInactiveSpan({
|
|
37
|
+
name: `${SpanNames.RESOLVE} ${attributes[AttributeNames.FIELD_PATH]}`,
|
|
38
|
+
attributes,
|
|
39
|
+
parentSpan
|
|
40
|
+
});
|
|
62
41
|
const document = contextValue[OTEL_GRAPHQL_DATA_SYMBOL].source;
|
|
63
42
|
const fieldNode = info.fieldNodes.find((fieldNode2) => fieldNode2.kind === "Field");
|
|
64
43
|
if (fieldNode) {
|
|
65
|
-
addSpanSource(span, document.loc,
|
|
44
|
+
addSpanSource(span, document.loc, fieldNode.loc?.start, fieldNode.loc?.end);
|
|
66
45
|
}
|
|
67
46
|
return span;
|
|
68
47
|
}
|
|
69
48
|
function endSpan(span, error) {
|
|
70
49
|
if (error) {
|
|
71
|
-
span.
|
|
50
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });
|
|
72
51
|
}
|
|
73
52
|
span.end();
|
|
74
53
|
}
|
|
@@ -100,15 +79,11 @@ function getParentFieldSpan(contextValue, path) {
|
|
|
100
79
|
function getRootSpan(contextValue) {
|
|
101
80
|
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].span;
|
|
102
81
|
}
|
|
103
|
-
function pathToArray(
|
|
82
|
+
function pathToArray(path) {
|
|
104
83
|
const flattened = [];
|
|
105
84
|
let curr = path;
|
|
106
85
|
while (curr) {
|
|
107
|
-
|
|
108
|
-
if (mergeItems && typeof key === "number") {
|
|
109
|
-
key = "*";
|
|
110
|
-
}
|
|
111
|
-
flattened.push(String(key));
|
|
86
|
+
flattened.push(String(curr.key));
|
|
112
87
|
curr = curr.prev;
|
|
113
88
|
}
|
|
114
89
|
return flattened.reverse();
|
|
@@ -127,7 +102,7 @@ function repeatChar(char, to) {
|
|
|
127
102
|
return text;
|
|
128
103
|
}
|
|
129
104
|
const KindsToBeRemoved = [TokenKind.FLOAT, TokenKind.STRING, TokenKind.INT, TokenKind.BLOCK_STRING];
|
|
130
|
-
function getSourceFromLocation(loc,
|
|
105
|
+
function getSourceFromLocation(loc, inputStart, inputEnd) {
|
|
131
106
|
let source = "";
|
|
132
107
|
if (loc?.startToken) {
|
|
133
108
|
const start = typeof inputStart === "number" ? inputStart : loc.start;
|
|
@@ -147,7 +122,7 @@ function getSourceFromLocation(loc, allowValues = false, inputStart, inputEnd) {
|
|
|
147
122
|
}
|
|
148
123
|
let value = next.value || next.kind;
|
|
149
124
|
let space = "";
|
|
150
|
-
if (
|
|
125
|
+
if (KindsToBeRemoved.indexOf(next.kind) >= 0) {
|
|
151
126
|
value = "*";
|
|
152
127
|
}
|
|
153
128
|
if (next.kind === TokenKind.STRING) {
|
|
@@ -173,7 +148,7 @@ function getSourceFromLocation(loc, allowValues = false, inputStart, inputEnd) {
|
|
|
173
148
|
}
|
|
174
149
|
return source;
|
|
175
150
|
}
|
|
176
|
-
function wrapFields(type,
|
|
151
|
+
function wrapFields(type, getConfig) {
|
|
177
152
|
if (!type || type[OTEL_PATCHED_SYMBOL]) {
|
|
178
153
|
return;
|
|
179
154
|
}
|
|
@@ -185,12 +160,12 @@ function wrapFields(type, tracer, getConfig) {
|
|
|
185
160
|
return;
|
|
186
161
|
}
|
|
187
162
|
if (field.resolve) {
|
|
188
|
-
field.resolve = wrapFieldResolver(
|
|
163
|
+
field.resolve = wrapFieldResolver(getConfig, field.resolve);
|
|
189
164
|
}
|
|
190
165
|
if (field.type) {
|
|
191
166
|
const unwrappedTypes = unwrapType(field.type);
|
|
192
167
|
for (const unwrappedType of unwrappedTypes) {
|
|
193
|
-
wrapFields(unwrappedType,
|
|
168
|
+
wrapFields(unwrappedType, getConfig);
|
|
194
169
|
}
|
|
195
170
|
}
|
|
196
171
|
});
|
|
@@ -217,9 +192,8 @@ const handleResolveSpanError = (resolveSpan, err, shouldEndSpan) => {
|
|
|
217
192
|
if (!shouldEndSpan) {
|
|
218
193
|
return;
|
|
219
194
|
}
|
|
220
|
-
resolveSpan.recordException(err);
|
|
221
195
|
resolveSpan.setStatus({
|
|
222
|
-
code:
|
|
196
|
+
code: SPAN_STATUS_ERROR,
|
|
223
197
|
message: err.message
|
|
224
198
|
});
|
|
225
199
|
resolveSpan.end();
|
|
@@ -230,7 +204,7 @@ const handleResolveSpanSuccess = (resolveSpan, shouldEndSpan) => {
|
|
|
230
204
|
}
|
|
231
205
|
resolveSpan.end();
|
|
232
206
|
};
|
|
233
|
-
function wrapFieldResolver(
|
|
207
|
+
function wrapFieldResolver(getConfig, fieldResolver, isDefaultResolver = false) {
|
|
234
208
|
if (wrappedFieldResolver[OTEL_PATCHED_SYMBOL] || typeof fieldResolver !== "function") {
|
|
235
209
|
return fieldResolver;
|
|
236
210
|
}
|
|
@@ -248,18 +222,11 @@ function wrapFieldResolver(tracer, getConfig, fieldResolver, isDefaultResolver =
|
|
|
248
222
|
if (!contextValue[OTEL_GRAPHQL_DATA_SYMBOL]) {
|
|
249
223
|
return fieldResolver.call(this, source, args, contextValue, info);
|
|
250
224
|
}
|
|
251
|
-
const path = pathToArray(
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
span = getParentFieldSpan(contextValue, path);
|
|
257
|
-
} else {
|
|
258
|
-
const { field, spanAdded } = createFieldIfNotExists(tracer, getConfig, contextValue, info, path);
|
|
259
|
-
span = field.span;
|
|
260
|
-
shouldEndSpan = spanAdded;
|
|
261
|
-
}
|
|
262
|
-
return api.context.with(api.trace.setSpan(api.context.active(), span), () => {
|
|
225
|
+
const path = pathToArray(info?.path);
|
|
226
|
+
const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path);
|
|
227
|
+
const span = field.span;
|
|
228
|
+
const shouldEndSpan = spanAdded;
|
|
229
|
+
return withActiveSpan(span, () => {
|
|
263
230
|
try {
|
|
264
231
|
const res = fieldResolver.call(this, source, args, contextValue, info);
|
|
265
232
|
if (isPromise(res)) {
|
|
@@ -287,5 +254,5 @@ function wrapFieldResolver(tracer, getConfig, fieldResolver, isDefaultResolver =
|
|
|
287
254
|
return wrappedFieldResolver;
|
|
288
255
|
}
|
|
289
256
|
|
|
290
|
-
export {
|
|
257
|
+
export { addSpanSource, endSpan, getOperation, getSourceFromLocation, isPromise, wrapFieldResolver, wrapFields };
|
|
291
258
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/utils.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 type {\n DocumentNode,\n GraphQLFieldResolver,\n GraphQLObjectType,\n GraphQLOutputType,\n GraphQLResolveInfo,\n GraphQLType,\n GraphQLUnionType,\n Location,\n Maybe,\n Token,\n} from './graphql-types';\nimport * as api from '@opentelemetry/api';\nimport { AllowedOperationTypes, SpanNames, TokenKind } from './enum';\nimport { AttributeNames } from './enums/AttributeNames';\nimport { OTEL_GRAPHQL_DATA_SYMBOL, OTEL_PATCHED_SYMBOL } from './symbols';\nimport { GraphQLField, GraphQLPath, ObjectWithGraphQLData, OtelPatched } from './internal-types';\nimport { GraphQLInstrumentationParsedConfig } from './types';\n\nconst OPERATION_VALUES = Object.values(AllowedOperationTypes);\n\n// https://github.com/graphql/graphql-js/blob/main/src/jsutils/isPromise.ts\nexport const isPromise = (value: any): value is Promise<unknown> => {\n return typeof value?.then === 'function';\n};\n\n// https://github.com/graphql/graphql-js/blob/main/src/jsutils/isObjectLike.ts\nconst isObjectLike = (value: unknown): value is { [key: string]: unknown } => {\n return typeof value == 'object' && value !== null;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction addInputVariableAttribute(span: api.Span, key: string, variable: any) {\n if (Array.isArray(variable)) {\n variable.forEach((value, idx) => {\n addInputVariableAttribute(span, `${key}.${idx}`, value);\n });\n } else if (variable instanceof Object) {\n Object.entries(variable).forEach(([nestedKey, value]) => {\n addInputVariableAttribute(span, `${key}.${nestedKey}`, value);\n });\n } else {\n span.setAttribute(`${AttributeNames.VARIABLES}${String(key)}`, variable);\n }\n}\n\nexport function addInputVariableAttributes(span: api.Span, variableValues: { [key: string]: any }) {\n Object.entries(variableValues).forEach(([key, value]) => {\n addInputVariableAttribute(span, key, value);\n });\n}\n\nexport function addSpanSource(\n span: api.Span,\n loc?: Location,\n allowValues?: boolean,\n start?: number,\n end?: number,\n): void {\n const source = getSourceFromLocation(loc, allowValues, start, end);\n span.setAttribute(AttributeNames.SOURCE, source);\n}\n\nfunction createFieldIfNotExists(\n tracer: api.Tracer,\n getConfig: () => GraphQLInstrumentationParsedConfig,\n contextValue: any,\n info: GraphQLResolveInfo,\n path: string[],\n): {\n field: GraphQLField;\n spanAdded: boolean;\n} {\n let field = getField(contextValue, path);\n if (field) {\n return { field, spanAdded: false };\n }\n\n const config = getConfig();\n const parentSpan = config.flatResolveSpans ? getRootSpan(contextValue) : getParentFieldSpan(contextValue, path);\n\n field = {\n span: createResolverSpan(tracer, getConfig, contextValue, info, path, parentSpan),\n };\n\n addField(contextValue, path, field);\n\n return { field, spanAdded: true };\n}\n\nfunction createResolverSpan(\n tracer: api.Tracer,\n getConfig: () => GraphQLInstrumentationParsedConfig,\n contextValue: any,\n info: GraphQLResolveInfo,\n path: string[],\n parentSpan?: api.Span,\n): api.Span {\n const attributes: api.SpanAttributes = {\n [AttributeNames.FIELD_NAME]: info.fieldName,\n [AttributeNames.FIELD_PATH]: path.join('.'),\n [AttributeNames.FIELD_TYPE]: info.returnType.toString(),\n [AttributeNames.PARENT_NAME]: info.parentType.name,\n };\n\n const span = tracer.startSpan(\n `${SpanNames.RESOLVE} ${attributes[AttributeNames.FIELD_PATH]}`,\n {\n attributes,\n },\n parentSpan ? api.trace.setSpan(api.context.active(), parentSpan) : undefined,\n );\n\n const document = contextValue[OTEL_GRAPHQL_DATA_SYMBOL].source;\n const fieldNode = info.fieldNodes.find(fieldNode => fieldNode.kind === 'Field');\n\n if (fieldNode) {\n addSpanSource(span, document.loc, getConfig().allowValues, fieldNode.loc?.start, fieldNode.loc?.end);\n }\n\n return span;\n}\n\nexport function endSpan(span: api.Span, error?: Error): void {\n if (error) {\n span.recordException(error);\n }\n span.end();\n}\n\nexport function getOperation(document: DocumentNode, operationName?: Maybe<string>): DefinitionNodeLike | undefined {\n if (!document || !Array.isArray(document.definitions)) {\n return undefined;\n }\n\n if (operationName) {\n return document.definitions\n .filter(definition => OPERATION_VALUES.indexOf((definition as any)?.operation) !== -1)\n .find(definition => operationName === (definition as any)?.name?.value);\n } else {\n return document.definitions.find(definition => OPERATION_VALUES.indexOf((definition as any)?.operation) !== -1);\n }\n}\n\ntype DefinitionNodeLike = DocumentNode['definitions'][number];\n\nfunction addField(contextValue: any, path: string[], field: GraphQLField) {\n return (contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path.join('.')] = field);\n}\n\nfunction getField(contextValue: any, path: string[]): GraphQLField {\n return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path.join('.')];\n}\n\nfunction getParentFieldSpan(contextValue: any, path: string[]): api.Span {\n for (let i = path.length - 1; i > 0; i--) {\n const field = getField(contextValue, path.slice(0, i));\n\n if (field) {\n return field.span;\n }\n }\n\n return getRootSpan(contextValue);\n}\n\nfunction getRootSpan(contextValue: any): api.Span {\n return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].span;\n}\n\nfunction pathToArray(mergeItems: boolean, path: GraphQLPath): string[] {\n const flattened: string[] = [];\n let curr: GraphQLPath | undefined = path;\n while (curr) {\n let key = curr.key;\n\n if (mergeItems && typeof key === 'number') {\n key = '*';\n }\n flattened.push(String(key));\n curr = curr.prev;\n }\n return flattened.reverse();\n}\n\nfunction repeatBreak(i: number): string {\n return repeatChar('\\n', i);\n}\n\nfunction repeatSpace(i: number): string {\n return repeatChar(' ', i);\n}\n\nfunction repeatChar(char: string, to: number): string {\n let text = '';\n for (let i = 0; i < to; i++) {\n text += char;\n }\n return text;\n}\n\nconst KindsToBeRemoved: string[] = [TokenKind.FLOAT, TokenKind.STRING, TokenKind.INT, TokenKind.BLOCK_STRING];\n\nexport function getSourceFromLocation(\n loc?: Location,\n allowValues = false,\n inputStart?: number,\n inputEnd?: number,\n): string {\n let source = '';\n\n if (loc?.startToken) {\n const start = typeof inputStart === 'number' ? inputStart : loc.start;\n const end = typeof inputEnd === 'number' ? inputEnd : loc.end;\n\n let next: Token | null = loc.startToken.next;\n let previousLine: number | undefined = 1;\n while (next) {\n if (next.start < start) {\n next = next.next;\n previousLine = next?.line;\n continue;\n }\n if (next.end > end) {\n next = next.next;\n previousLine = next?.line;\n continue;\n }\n let value = next.value || next.kind;\n let space = '';\n if (!allowValues && KindsToBeRemoved.indexOf(next.kind) >= 0) {\n // value = repeatChar('*', value.length);\n value = '*';\n }\n if (next.kind === TokenKind.STRING) {\n value = `\"${value}\"`;\n }\n if (next.kind === TokenKind.EOF) {\n value = '';\n }\n if (next.line > previousLine!) {\n source += repeatBreak(next.line - previousLine!);\n previousLine = next.line;\n space = repeatSpace(next.column - 1);\n } else {\n if (next.line === next.prev?.line) {\n space = repeatSpace(next.start - (next.prev?.end || 0));\n }\n }\n source += space + value;\n if (next) {\n next = next.next!;\n }\n }\n }\n\n return source;\n}\n\nexport function wrapFields(\n type: Maybe<GraphQLObjectType & OtelPatched>,\n tracer: api.Tracer,\n getConfig: () => GraphQLInstrumentationParsedConfig,\n): void {\n if (!type || (type as any)[OTEL_PATCHED_SYMBOL]) {\n return;\n }\n const fields = type.getFields();\n\n (type as any)[OTEL_PATCHED_SYMBOL] = true;\n\n Object.keys(fields).forEach(key => {\n const field = fields[key];\n\n if (!field) {\n return;\n }\n\n if (field.resolve) {\n field.resolve = wrapFieldResolver(tracer, getConfig, field.resolve);\n }\n\n if (field.type) {\n const unwrappedTypes = unwrapType(field.type);\n for (const unwrappedType of unwrappedTypes) {\n wrapFields(unwrappedType as any, tracer, getConfig);\n }\n }\n });\n}\n\nfunction unwrapType(type: GraphQLOutputType): readonly GraphQLObjectType[] {\n // unwrap wrapping types (non-nullable and list types)\n if ('ofType' in type) {\n return unwrapType(type.ofType);\n }\n\n // unwrap union types\n if (isGraphQLUnionType(type)) {\n return type.getTypes();\n }\n\n // return object types\n if (isGraphQLObjectType(type)) {\n return [type];\n }\n\n return [];\n}\n\nfunction isGraphQLUnionType(type: GraphQLType): type is GraphQLUnionType {\n return 'getTypes' in type && typeof type.getTypes === 'function';\n}\n\nfunction isGraphQLObjectType(type: GraphQLType): type is GraphQLObjectType {\n return 'getFields' in type && typeof type.getFields === 'function';\n}\n\nconst handleResolveSpanError = (resolveSpan: api.Span, err: any, shouldEndSpan: boolean) => {\n if (!shouldEndSpan) {\n return;\n }\n resolveSpan.recordException(err);\n resolveSpan.setStatus({\n code: api.SpanStatusCode.ERROR,\n message: err.message,\n });\n resolveSpan.end();\n};\n\nconst handleResolveSpanSuccess = (resolveSpan: api.Span, shouldEndSpan: boolean) => {\n if (!shouldEndSpan) {\n return;\n }\n resolveSpan.end();\n};\n\nexport function wrapFieldResolver<TSource = any, TContext = any, TArgs = any>(\n tracer: api.Tracer,\n getConfig: () => GraphQLInstrumentationParsedConfig,\n fieldResolver: Maybe<GraphQLFieldResolver<TSource, TContext, TArgs> & OtelPatched>,\n isDefaultResolver = false,\n): GraphQLFieldResolver<TSource, TContext & ObjectWithGraphQLData, TArgs> & OtelPatched {\n if ((wrappedFieldResolver as OtelPatched)[OTEL_PATCHED_SYMBOL] || typeof fieldResolver !== 'function') {\n return fieldResolver!;\n }\n\n function wrappedFieldResolver(\n this: GraphQLFieldResolver<TSource, TContext, TArgs>,\n source: TSource,\n args: TArgs,\n contextValue: TContext & ObjectWithGraphQLData,\n info: GraphQLResolveInfo,\n ) {\n if (!fieldResolver) {\n return undefined;\n }\n const config = getConfig();\n\n // follows what graphql is doing to decide if this is a trivial resolver\n // for which we don't need to create a resolve span\n if (\n config.ignoreTrivialResolveSpans &&\n isDefaultResolver &&\n (isObjectLike(source) || typeof source === 'function')\n ) {\n const property = (source as any)[info.fieldName];\n // a function execution is not trivial and should be recorder.\n // property which is not a function is just a value and we don't want a \"resolve\" span for it\n if (typeof property !== 'function') {\n return fieldResolver.call(this, source, args, contextValue, info);\n }\n }\n\n if (!contextValue[OTEL_GRAPHQL_DATA_SYMBOL]) {\n return fieldResolver.call(this, source, args, contextValue, info);\n }\n const path = pathToArray(config.mergeItems, info && info.path);\n const depth = path.filter((item: any) => typeof item === 'string').length;\n\n let span: api.Span;\n let shouldEndSpan = false;\n if (config.depth >= 0 && config.depth < depth) {\n span = getParentFieldSpan(contextValue, path);\n } else {\n const { field, spanAdded } = createFieldIfNotExists(tracer, getConfig, contextValue, info, path);\n span = field.span;\n shouldEndSpan = spanAdded;\n }\n\n return api.context.with(api.trace.setSpan(api.context.active(), span), () => {\n try {\n const res = fieldResolver.call(this, source, args, contextValue, info);\n if (isPromise(res)) {\n return res.then(\n (r: any) => {\n handleResolveSpanSuccess(span, shouldEndSpan);\n return r;\n },\n (err: Error) => {\n handleResolveSpanError(span, err, shouldEndSpan);\n throw err;\n },\n );\n } else {\n handleResolveSpanSuccess(span, shouldEndSpan);\n return res;\n }\n } catch (err: any) {\n handleResolveSpanError(span, err, shouldEndSpan);\n throw err;\n }\n });\n }\n\n (wrappedFieldResolver as OtelPatched)[OTEL_PATCHED_SYMBOL] = true;\n\n return wrappedFieldResolver;\n}\n"],"names":["fieldNode"],"mappings":";;;;;AA0CA,MAAM,gBAAA,GAAmB,MAAA,CAAO,MAAA,CAAO,qBAAqB,CAAA;AAGrD,MAAM,SAAA,GAAY,CAAC,KAAA,KAA0C;AAClE,EAAA,OAAO,OAAO,OAAO,IAAA,KAAS,UAAA;AAChC;AAGA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAwD;AAC5E,EAAA,OAAO,OAAO,KAAA,IAAS,QAAA,IAAY,KAAA,KAAU,IAAA;AAC/C,CAAA;AAGA,SAAS,yBAAA,CAA0B,IAAA,EAAgB,GAAA,EAAa,QAAA,EAAe;AAC7E,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC3B,IAAA,QAAA,CAAS,OAAA,CAAQ,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC/B,MAAA,yBAAA,CAA0B,MAAM,CAAA,EAAG,GAAG,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uB,IAAA,EAAM,KAAK,aAAa,CAAA;AAC/C,cAAA,MAAM,GAAA;AAAA,YACR;AAAA,WACF;AAAA,QACF,CAAA,MAAO;AACL,UAAA,wBAAA,CAAyB,MAAM,aAAa,CAAA;AAC5C,UAAA,OAAO,GAAA;AAAA,QACT;AAAA,MACF,SAAS,GAAA,EAAU;AACjB,QAAA,sBAAA,CAAuB,IAAA,EAAM,KAAK,aAAa,CAAA;AAC/C,QAAA,MAAM,GAAA;AAAA,MACR;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAEA,EAAC,oBAAA,CAAqC,mBAAmB,CAAA,GAAI,IAAA;AAE7D,EAAA,OAAO,oBAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/graphql/vendored/utils.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 */\n\nimport type {\n DocumentNode,\n GraphQLFieldResolver,\n GraphQLObjectType,\n GraphQLOutputType,\n GraphQLResolveInfo,\n GraphQLType,\n GraphQLUnionType,\n Location,\n Maybe,\n Token,\n} from './graphql-types';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport { SPAN_STATUS_ERROR, startInactiveSpan, withActiveSpan } from '@sentry/core';\nimport { AllowedOperationTypes, SpanNames, TokenKind } from './enum';\nimport { AttributeNames } from './enums/AttributeNames';\nimport { OTEL_GRAPHQL_DATA_SYMBOL, OTEL_PATCHED_SYMBOL } from './symbols';\nimport type { GraphQLField, GraphQLPath, ObjectWithGraphQLData, OtelPatched } from './internal-types';\nimport type { GraphQLInstrumentationParsedConfig } from './types';\n\nconst OPERATION_VALUES = Object.values(AllowedOperationTypes);\n\n// https://github.com/graphql/graphql-js/blob/main/src/jsutils/isPromise.ts\nexport const isPromise = (value: any): value is Promise<unknown> => {\n return typeof value?.then === 'function';\n};\n\n// https://github.com/graphql/graphql-js/blob/main/src/jsutils/isObjectLike.ts\nconst isObjectLike = (value: unknown): value is { [key: string]: unknown } => {\n return typeof value == 'object' && value !== null;\n};\n\nexport function addSpanSource(span: Span, loc?: Location, start?: number, end?: number): void {\n const source = getSourceFromLocation(loc, start, end);\n span.setAttribute(AttributeNames.SOURCE, source);\n}\n\nfunction createFieldIfNotExists(\n contextValue: any,\n info: GraphQLResolveInfo,\n path: string[],\n): {\n field: GraphQLField;\n spanAdded: boolean;\n} {\n let field = getField(contextValue, path);\n if (field) {\n return { field, spanAdded: false };\n }\n\n const parentSpan = getParentFieldSpan(contextValue, path);\n\n field = {\n span: createResolverSpan(contextValue, info, path, parentSpan),\n };\n\n addField(contextValue, path, field);\n\n return { field, spanAdded: true };\n}\n\nfunction createResolverSpan(contextValue: any, info: GraphQLResolveInfo, path: string[], parentSpan?: Span): Span {\n const attributes: SpanAttributes = {\n [AttributeNames.FIELD_NAME]: info.fieldName,\n [AttributeNames.FIELD_PATH]: path.join('.'),\n [AttributeNames.FIELD_TYPE]: info.returnType.toString(),\n [AttributeNames.PARENT_NAME]: info.parentType.name,\n };\n\n const span = startInactiveSpan({\n name: `${SpanNames.RESOLVE} ${attributes[AttributeNames.FIELD_PATH]}`,\n attributes,\n parentSpan,\n });\n\n const document = contextValue[OTEL_GRAPHQL_DATA_SYMBOL].source;\n const fieldNode = info.fieldNodes.find(fieldNode => fieldNode.kind === 'Field');\n\n if (fieldNode) {\n addSpanSource(span, document.loc, fieldNode.loc?.start, fieldNode.loc?.end);\n }\n\n return span;\n}\n\nexport function endSpan(span: Span, error?: Error): void {\n if (error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });\n }\n span.end();\n}\n\nexport function getOperation(document: DocumentNode, operationName?: Maybe<string>): DefinitionNodeLike | undefined {\n if (!document || !Array.isArray(document.definitions)) {\n return undefined;\n }\n\n if (operationName) {\n return document.definitions\n .filter(definition => OPERATION_VALUES.indexOf(definition?.operation) !== -1)\n .find(definition => operationName === definition?.name?.value);\n } else {\n return document.definitions.find(definition => OPERATION_VALUES.indexOf(definition?.operation) !== -1);\n }\n}\n\ntype DefinitionNodeLike = DocumentNode['definitions'][number];\n\nfunction addField(contextValue: any, path: string[], field: GraphQLField) {\n return (contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path.join('.')] = field);\n}\n\nfunction getField(contextValue: any, path: string[]): GraphQLField {\n return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path.join('.')];\n}\n\nfunction getParentFieldSpan(contextValue: any, path: string[]): Span {\n for (let i = path.length - 1; i > 0; i--) {\n const field = getField(contextValue, path.slice(0, i));\n\n if (field) {\n return field.span;\n }\n }\n\n return getRootSpan(contextValue);\n}\n\nfunction getRootSpan(contextValue: any): Span {\n return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].span;\n}\n\nfunction pathToArray(path: GraphQLPath): string[] {\n const flattened: string[] = [];\n let curr: GraphQLPath | undefined = path;\n while (curr) {\n flattened.push(String(curr.key));\n curr = curr.prev;\n }\n return flattened.reverse();\n}\n\nfunction repeatBreak(i: number): string {\n return repeatChar('\\n', i);\n}\n\nfunction repeatSpace(i: number): string {\n return repeatChar(' ', i);\n}\n\nfunction repeatChar(char: string, to: number): string {\n let text = '';\n for (let i = 0; i < to; i++) {\n text += char;\n }\n return text;\n}\n\nconst KindsToBeRemoved: string[] = [TokenKind.FLOAT, TokenKind.STRING, TokenKind.INT, TokenKind.BLOCK_STRING];\n\nexport function getSourceFromLocation(loc?: Location, inputStart?: number, inputEnd?: number): string {\n let source = '';\n\n if (loc?.startToken) {\n const start = typeof inputStart === 'number' ? inputStart : loc.start;\n const end = typeof inputEnd === 'number' ? inputEnd : loc.end;\n\n let next: Token | null = loc.startToken.next;\n let previousLine: number | undefined = 1;\n while (next) {\n if (next.start < start) {\n next = next.next;\n previousLine = next?.line;\n continue;\n }\n if (next.end > end) {\n next = next.next;\n previousLine = next?.line;\n continue;\n }\n let value = next.value || next.kind;\n let space = '';\n if (KindsToBeRemoved.indexOf(next.kind) >= 0) {\n value = '*';\n }\n if (next.kind === TokenKind.STRING) {\n value = `\"${value}\"`;\n }\n if (next.kind === TokenKind.EOF) {\n value = '';\n }\n if (next.line > previousLine!) {\n source += repeatBreak(next.line - previousLine!);\n previousLine = next.line;\n space = repeatSpace(next.column - 1);\n } else {\n if (next.line === next.prev?.line) {\n space = repeatSpace(next.start - (next.prev?.end || 0));\n }\n }\n source += space + value;\n if (next) {\n next = next.next!;\n }\n }\n }\n\n return source;\n}\n\nexport function wrapFields(\n type: Maybe<GraphQLObjectType & OtelPatched>,\n getConfig: () => GraphQLInstrumentationParsedConfig,\n): void {\n if (!type || (type as any)[OTEL_PATCHED_SYMBOL]) {\n return;\n }\n const fields = type.getFields();\n\n (type as any)[OTEL_PATCHED_SYMBOL] = true;\n\n Object.keys(fields).forEach(key => {\n const field = fields[key];\n\n if (!field) {\n return;\n }\n\n if (field.resolve) {\n field.resolve = wrapFieldResolver(getConfig, field.resolve);\n }\n\n if (field.type) {\n const unwrappedTypes = unwrapType(field.type);\n for (const unwrappedType of unwrappedTypes) {\n wrapFields(unwrappedType as any, getConfig);\n }\n }\n });\n}\n\nfunction unwrapType(type: GraphQLOutputType): readonly GraphQLObjectType[] {\n // unwrap wrapping types (non-nullable and list types)\n if ('ofType' in type) {\n return unwrapType(type.ofType);\n }\n\n // unwrap union types\n if (isGraphQLUnionType(type)) {\n return type.getTypes();\n }\n\n // return object types\n if (isGraphQLObjectType(type)) {\n return [type];\n }\n\n return [];\n}\n\nfunction isGraphQLUnionType(type: GraphQLType): type is GraphQLUnionType {\n return 'getTypes' in type && typeof type.getTypes === 'function';\n}\n\nfunction isGraphQLObjectType(type: GraphQLType): type is GraphQLObjectType {\n return 'getFields' in type && typeof type.getFields === 'function';\n}\n\nconst handleResolveSpanError = (resolveSpan: Span, err: any, shouldEndSpan: boolean) => {\n if (!shouldEndSpan) {\n return;\n }\n resolveSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err.message,\n });\n resolveSpan.end();\n};\n\nconst handleResolveSpanSuccess = (resolveSpan: Span, shouldEndSpan: boolean) => {\n if (!shouldEndSpan) {\n return;\n }\n resolveSpan.end();\n};\n\nexport function wrapFieldResolver<TSource = any, TContext = any, TArgs = any>(\n getConfig: () => GraphQLInstrumentationParsedConfig,\n fieldResolver: Maybe<GraphQLFieldResolver<TSource, TContext, TArgs> & OtelPatched>,\n isDefaultResolver = false,\n): GraphQLFieldResolver<TSource, TContext & ObjectWithGraphQLData, TArgs> & OtelPatched {\n if ((wrappedFieldResolver as OtelPatched)[OTEL_PATCHED_SYMBOL] || typeof fieldResolver !== 'function') {\n return fieldResolver!;\n }\n\n function wrappedFieldResolver(\n this: GraphQLFieldResolver<TSource, TContext, TArgs>,\n source: TSource,\n args: TArgs,\n contextValue: TContext & ObjectWithGraphQLData,\n info: GraphQLResolveInfo,\n ) {\n if (!fieldResolver) {\n return undefined;\n }\n const config = getConfig();\n\n // follows what graphql is doing to decide if this is a trivial resolver\n // for which we don't need to create a resolve span\n if (\n config.ignoreTrivialResolveSpans &&\n isDefaultResolver &&\n (isObjectLike(source) || typeof source === 'function')\n ) {\n const property = (source as any)[info.fieldName];\n // a function execution is not trivial and should be recorder.\n // property which is not a function is just a value and we don't want a \"resolve\" span for it\n if (typeof property !== 'function') {\n return fieldResolver.call(this, source, args, contextValue, info);\n }\n }\n\n if (!contextValue[OTEL_GRAPHQL_DATA_SYMBOL]) {\n return fieldResolver.call(this, source, args, contextValue, info);\n }\n const path = pathToArray(info?.path);\n\n const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path);\n const span = field.span;\n const shouldEndSpan = spanAdded;\n\n return withActiveSpan(span, () => {\n try {\n const res = fieldResolver.call(this, source, args, contextValue, info);\n if (isPromise(res)) {\n return res.then(\n (r: any) => {\n handleResolveSpanSuccess(span, shouldEndSpan);\n return r;\n },\n (err: Error) => {\n handleResolveSpanError(span, err, shouldEndSpan);\n throw err;\n },\n );\n } else {\n handleResolveSpanSuccess(span, shouldEndSpan);\n return res;\n }\n } catch (err: any) {\n handleResolveSpanError(span, err, shouldEndSpan);\n throw err;\n }\n });\n }\n\n (wrappedFieldResolver as OtelPatched)[OTEL_PATCHED_SYMBOL] = true;\n\n return wrappedFieldResolver;\n}\n"],"names":["fieldNode"],"mappings":";;;;;AAgCA,MAAM,gBAAA,GAAmB,MAAA,CAAO,MAAA,CAAO,qBAAqB,CAAA;AAGrD,MAAM,SAAA,GAAY,CAAC,KAAA,KAA0C;AAClE,EAAA,OAAO,OAAO,OAAO,IAAA,KAAS,UAAA;AAChC;AAGA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAwD;AAC5E,EAAA,OAAO,OAAO,KAAA,IAAS,QAAA,IAAY,KAAA,KAAU,IAAA;AAC/C,CAAA;AAEO,SAAS,aAAA,CAAc,IAAA,EAAY,GAAA,EAAgB,KAAA,EAAgB,GAAA,EAAoB;AAC5F,EAAA,MAAM,MAAA,GAAS,qBAAA,CAAsB,GAAA,EAAK,KAAA,EAAO,GAAG,CAAA;AACpD,EAAA,IAAA,CAAK,YAAA,CAAa,cAAA,CAAe,MAAA,EAAQ,MAAM,CAAA;AACjD;AAEA,SAAS,sBAAA,CACP,YAAA,EACA,IAAA,EACA,IAAA,EAIA;AACA,EAAA,IAAI,KAAA,GAAQ,QAAA,CAAS,YAAA,EAAc,IAAI,CAAA;AACvC,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,KAAA,EAAM;AAAA,EACnC;AAEA,EAAA,MAAM,UAAA,GAAa,kBAAA,CAAmB,YAAA,EAAc,IAAI,CAAA;AAExD,EAAA,KA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,GAAA,CAAI,IAAA;AAAA,YACT,CAAC,CAAA,KAAW;AACV,cAAA,wBAAA,CAAyB,MAAM,aAAa,CAAA;AAC5C,cAAA,OAAO,CAAA;AAAA,YACT,CAAA;AAAA,YACA,CAAC,GAAA,KAAe;AACd,cAAA,sBAAA,CAAuB,IAAA,EAAM,KAAK,aAAa,CAAA;AAC/C,cAAA,MAAM,GAAA;AAAA,YACR;AAAA,WACF;AAAA,QACF,CAAA,MAAO;AACL,UAAA,wBAAA,CAAyB,MAAM,aAAa,CAAA;AAC5C,UAAA,OAAO,GAAA;AAAA,QACT;AAAA,MACF,SAAS,GAAA,EAAU;AACjB,QAAA,sBAAA,CAAuB,IAAA,EAAM,KAAK,aAAa,CAAA;AAC/C,QAAA,MAAM,GAAA;AAAA,MACR;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAEA,EAAC,oBAAA,CAAqC,mBAAmB,CAAA,GAAI,IAAA;AAE7D,EAAA,OAAO,oBAAA;AACT;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HapiInstrumentation } from './vendored/instrumentation.js';
|
|
2
|
-
import { defineIntegration, SDK_VERSION,
|
|
2
|
+
import { defineIntegration, SDK_VERSION, getIsolationScope, getDefaultIsolationScope, debug, captureException } from '@sentry/core';
|
|
3
3
|
import { generateInstrumentOnce, ensureIsWrapped } from '@sentry/node-core';
|
|
4
4
|
import { DEBUG_BUILD } from '../../../debug-build.js';
|
|
5
5
|
|
|
@@ -48,25 +48,8 @@ const hapiErrorPlugin = {
|
|
|
48
48
|
};
|
|
49
49
|
async function setupHapiErrorHandler(server) {
|
|
50
50
|
await server.register(hapiErrorPlugin);
|
|
51
|
-
const client = getClient();
|
|
52
|
-
if (client) {
|
|
53
|
-
client.on("spanStart", (span) => {
|
|
54
|
-
addHapiSpanAttributes(span);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
51
|
ensureIsWrapped(server.register, "hapi");
|
|
58
52
|
}
|
|
59
|
-
function addHapiSpanAttributes(span) {
|
|
60
|
-
const attributes = spanToJSON(span).data;
|
|
61
|
-
const type = attributes["hapi.type"];
|
|
62
|
-
if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
span.setAttributes({
|
|
66
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.otel.hapi",
|
|
67
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.hapi`
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
53
|
|
|
71
54
|
export { hapiErrorPlugin, hapiIntegration, instrumentHapi, setupHapiErrorHandler };
|
|
72
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/hapi/index.ts"],"sourcesContent":["import { HapiInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/hapi/index.ts"],"sourcesContent":["import { HapiInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n captureException,\n debug,\n defineIntegration,\n getDefaultIsolationScope,\n getIsolationScope,\n SDK_VERSION,\n} from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { Request, RequestEvent, Server } from './types';\n\nconst INTEGRATION_NAME = 'Hapi';\n\nexport const instrumentHapi = generateInstrumentOnce(INTEGRATION_NAME, () => new HapiInstrumentation());\n\nconst _hapiIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentHapi();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Hapi](https://hapi.dev/).\n *\n * If you also want to capture errors, you need to call `setupHapiErrorHandler(server)` after you set up your server.\n *\n * For more information, see the [hapi documentation](https://docs.sentry.io/platforms/javascript/guides/hapi/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.hapiIntegration()],\n * })\n * ```\n */\nexport const hapiIntegration = defineIntegration(_hapiIntegration);\n\nfunction isErrorEvent(event: unknown): event is RequestEvent {\n return !!(event && typeof event === 'object' && 'error' in event && event.error);\n}\n\nfunction sendErrorToSentry(errorData: object): void {\n captureException(errorData, {\n mechanism: {\n type: 'auto.function.hapi',\n handled: false,\n },\n });\n}\n\nexport const hapiErrorPlugin = {\n name: 'SentryHapiErrorPlugin',\n version: SDK_VERSION,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register: async function (serverArg: Record<any, any>) {\n const server = serverArg as unknown as Server;\n\n server.events.on({ name: 'request', channels: ['error'] }, (request: Request, event: RequestEvent) => {\n if (getIsolationScope() !== getDefaultIsolationScope()) {\n const route = request.route;\n if (route.path) {\n getIsolationScope().setTransactionName(`${route.method.toUpperCase()} ${route.path}`);\n }\n } else {\n DEBUG_BUILD &&\n debug.warn('Isolation scope is still the default isolation scope - skipping setting transactionName');\n }\n\n if (isErrorEvent(event)) {\n sendErrorToSentry(event.error);\n }\n });\n },\n};\n\n/**\n * Add a Hapi plugin to capture errors to Sentry.\n *\n * @param server The Hapi server to attach the error handler to\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Hapi = require('@hapi/hapi');\n *\n * const init = async () => {\n * const server = Hapi.server();\n *\n * // all your routes here\n *\n * await Sentry.setupHapiErrorHandler(server);\n *\n * await server.start();\n * };\n * ```\n */\nexport async function setupHapiErrorHandler(server: Server): Promise<void> {\n await server.register(hapiErrorPlugin);\n ensureIsWrapped(server.register, 'hapi');\n}\n"],"names":[],"mappings":";;;;;AAcA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,qBAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EA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KAAK,CAAA,EAAG;AACvB,QAAA,iBAAA,CAAkB,MAAM,KAAK,CAAA;AAAA,MAC/B;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AACF;AAuBA,eAAsB,sBAAsB,MAAA,EAA+B;AACzE,EAAA,MAAM,MAAA,CAAO,SAAS,eAAe,CAAA;AACrC,EAAA,eAAA,CAAgB,MAAA,CAAO,UAAU,MAAM,CAAA;AACzC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeNames.js","sources":["../../../../../../../src/integrations/tracing/hapi/vendored/enums/AttributeNames.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n
|
|
1
|
+
{"version":3,"file":"AttributeNames.js","sources":["../../../../../../../src/integrations/tracing/hapi/vendored/enums/AttributeNames.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-hapi\n * - Upstream version: @opentelemetry/instrumentation-hapi@0.64.0\n */\n/* eslint-disable */\n\nexport enum AttributeNames {\n HAPI_TYPE = 'hapi.type',\n PLUGIN_NAME = 'hapi.plugin.name',\n EXT_TYPE = 'server.ext.type',\n}\n"],"names":["AttributeNames"],"mappings":"AAUO,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,gBAAA,aAAA,CAAA,GAAc,kBAAA;AACd,EAAAA,gBAAA,UAAA,CAAA,GAAW,iBAAA;AAHD,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;;;;"}
|