@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,12 +1,95 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isTracingSuppressed, suppressTracing } from '@opentelemetry/core';
|
|
1
|
+
import { context } from '@opentelemetry/api';
|
|
3
2
|
import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
|
|
4
|
-
import { SDK_VERSION } from '@sentry/core';
|
|
5
|
-
import { SYNC_FUNCTIONS, CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS } from './constants.js';
|
|
3
|
+
import { SDK_VERSION, startInactiveSpan, suppressTracing, SPAN_STATUS_ERROR, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, startSpan } from '@sentry/core';
|
|
6
4
|
import { promisify } from 'util';
|
|
5
|
+
import { SYNC_FUNCTIONS, CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS } from './constants.js';
|
|
7
6
|
import { indexFs } from './utils.js';
|
|
8
7
|
|
|
9
8
|
const PACKAGE_NAME = "@sentry/instrumentation-fs";
|
|
9
|
+
const SPAN_ORIGIN = "auto.file.fs";
|
|
10
|
+
const SPAN_OP = "file";
|
|
11
|
+
const FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ["rename", "renameSync"];
|
|
12
|
+
const FS_OPERATIONS_WITH_SRC_DEST = ["copyFile", "cp", "copyFileSync", "cpSync"];
|
|
13
|
+
const FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH = ["link", "linkSync"];
|
|
14
|
+
const FS_OPERATIONS_WITH_PREFIX = ["mkdtemp", "mkdtempSync"];
|
|
15
|
+
const FS_OPERATIONS_WITH_TARGET_PATH = ["symlink", "symlinkSync"];
|
|
16
|
+
const FS_OPERATIONS_WITH_PATH_ARG = [
|
|
17
|
+
"access",
|
|
18
|
+
"appendFile",
|
|
19
|
+
"chmod",
|
|
20
|
+
"chown",
|
|
21
|
+
"exists",
|
|
22
|
+
"mkdir",
|
|
23
|
+
"lchown",
|
|
24
|
+
"lstat",
|
|
25
|
+
"lutimes",
|
|
26
|
+
"open",
|
|
27
|
+
"opendir",
|
|
28
|
+
"readdir",
|
|
29
|
+
"readFile",
|
|
30
|
+
"readlink",
|
|
31
|
+
"realpath",
|
|
32
|
+
"realpath.native",
|
|
33
|
+
"rm",
|
|
34
|
+
"rmdir",
|
|
35
|
+
"stat",
|
|
36
|
+
"truncate",
|
|
37
|
+
"unlink",
|
|
38
|
+
"utimes",
|
|
39
|
+
"writeFile",
|
|
40
|
+
"accessSync",
|
|
41
|
+
"appendFileSync",
|
|
42
|
+
"chmodSync",
|
|
43
|
+
"chownSync",
|
|
44
|
+
"existsSync",
|
|
45
|
+
"lchownSync",
|
|
46
|
+
"lstatSync",
|
|
47
|
+
"lutimesSync",
|
|
48
|
+
"opendirSync",
|
|
49
|
+
"mkdirSync",
|
|
50
|
+
"openSync",
|
|
51
|
+
"readdirSync",
|
|
52
|
+
"readFileSync",
|
|
53
|
+
"readlinkSync",
|
|
54
|
+
"realpathSync",
|
|
55
|
+
"realpathSync.native",
|
|
56
|
+
"rmdirSync",
|
|
57
|
+
"rmSync",
|
|
58
|
+
"statSync",
|
|
59
|
+
"truncateSync",
|
|
60
|
+
"unlinkSync",
|
|
61
|
+
"utimesSync",
|
|
62
|
+
"writeFileSync"
|
|
63
|
+
];
|
|
64
|
+
function getSpanAttributes(functionName, args, config) {
|
|
65
|
+
const attributes = {
|
|
66
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: SPAN_OP,
|
|
67
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN
|
|
68
|
+
};
|
|
69
|
+
if (!config.recordFilePaths) {
|
|
70
|
+
return attributes;
|
|
71
|
+
}
|
|
72
|
+
if (typeof args[0] === "string" && FS_OPERATIONS_WITH_PATH_ARG.includes(functionName)) {
|
|
73
|
+
attributes["path_argument"] = args[0];
|
|
74
|
+
} else if (typeof args[0] === "string" && typeof args[1] === "string") {
|
|
75
|
+
if (FS_OPERATIONS_WITH_TARGET_PATH.includes(functionName)) {
|
|
76
|
+
attributes["target_argument"] = args[0];
|
|
77
|
+
attributes["path_argument"] = args[1];
|
|
78
|
+
} else if (FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH.includes(functionName)) {
|
|
79
|
+
attributes["existing_path_argument"] = args[0];
|
|
80
|
+
attributes["new_path_argument"] = args[1];
|
|
81
|
+
} else if (FS_OPERATIONS_WITH_SRC_DEST.includes(functionName)) {
|
|
82
|
+
attributes["src_argument"] = args[0];
|
|
83
|
+
attributes["dest_argument"] = args[1];
|
|
84
|
+
} else if (FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH.includes(functionName)) {
|
|
85
|
+
attributes["old_path_argument"] = args[0];
|
|
86
|
+
attributes["new_path_argument"] = args[1];
|
|
87
|
+
}
|
|
88
|
+
} else if (typeof args[0] === "string" && FS_OPERATIONS_WITH_PREFIX.includes(functionName)) {
|
|
89
|
+
attributes["prefix_argument"] = args[0];
|
|
90
|
+
}
|
|
91
|
+
return attributes;
|
|
92
|
+
}
|
|
10
93
|
function patchedFunctionWithOriginalProperties(patchedFunction, original) {
|
|
11
94
|
return Object.assign(patchedFunction, original);
|
|
12
95
|
}
|
|
@@ -33,11 +116,7 @@ class FsInstrumentation extends InstrumentationBase {
|
|
|
33
116
|
this._unwrap(objectToPatch, functionNameToPatch);
|
|
34
117
|
}
|
|
35
118
|
if (fName === "exists") {
|
|
36
|
-
this._wrap(
|
|
37
|
-
objectToPatch,
|
|
38
|
-
functionNameToPatch,
|
|
39
|
-
this._patchExistsCallbackFunction.bind(this, fName)
|
|
40
|
-
);
|
|
119
|
+
this._wrap(objectToPatch, functionNameToPatch, this._patchExistsCallbackFunction.bind(this, fName));
|
|
41
120
|
continue;
|
|
42
121
|
}
|
|
43
122
|
this._wrap(objectToPatch, functionNameToPatch, this._patchCallbackFunction.bind(this, fName));
|
|
@@ -97,131 +176,70 @@ class FsInstrumentation extends InstrumentationBase {
|
|
|
97
176
|
_patchSyncFunction(functionName, original) {
|
|
98
177
|
const instrumentation = this;
|
|
99
178
|
const patchedFunction = function(...args) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
const res = api.context.with(suppressTracing(api.trace.setSpan(activeContext, span)), original, this, ...args);
|
|
112
|
-
instrumentation._runEndHook(functionName, { args, span });
|
|
113
|
-
return res;
|
|
114
|
-
} catch (error) {
|
|
115
|
-
span.recordException(error);
|
|
116
|
-
span.setStatus({
|
|
117
|
-
message: error.message,
|
|
118
|
-
code: api.SpanStatusCode.ERROR
|
|
119
|
-
});
|
|
120
|
-
instrumentation._runEndHook(functionName, { args, span, error });
|
|
121
|
-
throw error;
|
|
122
|
-
} finally {
|
|
123
|
-
span.end();
|
|
124
|
-
}
|
|
179
|
+
const config = instrumentation.getConfig();
|
|
180
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
181
|
+
return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, (span) => {
|
|
182
|
+
try {
|
|
183
|
+
return suppressTracing(() => original.apply(this, args));
|
|
184
|
+
} catch (error) {
|
|
185
|
+
recordError(span, error, config);
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
125
189
|
};
|
|
126
190
|
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
127
191
|
}
|
|
128
192
|
_patchCallbackFunction(functionName, original) {
|
|
129
193
|
const instrumentation = this;
|
|
130
194
|
const patchedFunction = function(...args) {
|
|
131
|
-
const
|
|
132
|
-
if (!instrumentation._shouldTrace(activeContext)) {
|
|
133
|
-
return original.apply(this, args);
|
|
134
|
-
}
|
|
135
|
-
if (instrumentation._runCreateHook(functionName, {
|
|
136
|
-
args
|
|
137
|
-
}) === false) {
|
|
138
|
-
return api.context.with(suppressTracing(activeContext), original, this, ...args);
|
|
139
|
-
}
|
|
195
|
+
const config = instrumentation.getConfig();
|
|
140
196
|
const lastIdx = args.length - 1;
|
|
141
197
|
const cb = args[lastIdx];
|
|
142
|
-
if (typeof cb
|
|
143
|
-
const span = instrumentation.tracer.startSpan(`fs ${functionName}`);
|
|
144
|
-
args[lastIdx] = api.context.bind(activeContext, function(error) {
|
|
145
|
-
if (error) {
|
|
146
|
-
span.recordException(error);
|
|
147
|
-
span.setStatus({
|
|
148
|
-
message: error.message,
|
|
149
|
-
code: api.SpanStatusCode.ERROR
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
instrumentation._runEndHook(functionName, {
|
|
153
|
-
args,
|
|
154
|
-
span,
|
|
155
|
-
error
|
|
156
|
-
});
|
|
157
|
-
span.end();
|
|
158
|
-
return cb.apply(this, arguments);
|
|
159
|
-
});
|
|
160
|
-
try {
|
|
161
|
-
return api.context.with(suppressTracing(api.trace.setSpan(activeContext, span)), original, this, ...args);
|
|
162
|
-
} catch (error) {
|
|
163
|
-
span.recordException(error);
|
|
164
|
-
span.setStatus({
|
|
165
|
-
message: error.message,
|
|
166
|
-
code: api.SpanStatusCode.ERROR
|
|
167
|
-
});
|
|
168
|
-
instrumentation._runEndHook(functionName, {
|
|
169
|
-
args,
|
|
170
|
-
span,
|
|
171
|
-
error
|
|
172
|
-
});
|
|
173
|
-
span.end();
|
|
174
|
-
throw error;
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
198
|
+
if (typeof cb !== "function") {
|
|
177
199
|
return original.apply(this, args);
|
|
178
200
|
}
|
|
201
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
202
|
+
const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });
|
|
203
|
+
args[lastIdx] = context.bind(context.active(), function(...cbArgs) {
|
|
204
|
+
const error = cbArgs[0];
|
|
205
|
+
if (error) {
|
|
206
|
+
recordError(span, error, config);
|
|
207
|
+
}
|
|
208
|
+
span.end();
|
|
209
|
+
return cb.apply(this, cbArgs);
|
|
210
|
+
});
|
|
211
|
+
try {
|
|
212
|
+
return suppressTracing(() => original.apply(this, args));
|
|
213
|
+
} catch (error) {
|
|
214
|
+
recordError(span, error, config);
|
|
215
|
+
span.end();
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
179
218
|
};
|
|
180
219
|
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
181
220
|
}
|
|
182
221
|
_patchExistsCallbackFunction(functionName, original) {
|
|
183
222
|
const instrumentation = this;
|
|
184
223
|
const patchedFunction = function(...args) {
|
|
185
|
-
const
|
|
186
|
-
if (!instrumentation._shouldTrace(activeContext)) {
|
|
187
|
-
return original.apply(this, args);
|
|
188
|
-
}
|
|
189
|
-
if (instrumentation._runCreateHook(functionName, {
|
|
190
|
-
args
|
|
191
|
-
}) === false) {
|
|
192
|
-
return api.context.with(suppressTracing(activeContext), original, this, ...args);
|
|
193
|
-
}
|
|
224
|
+
const config = instrumentation.getConfig();
|
|
194
225
|
const lastIdx = args.length - 1;
|
|
195
226
|
const cb = args[lastIdx];
|
|
196
|
-
if (typeof cb
|
|
197
|
-
const span = instrumentation.tracer.startSpan(`fs ${functionName}`);
|
|
198
|
-
args[lastIdx] = api.context.bind(activeContext, function() {
|
|
199
|
-
instrumentation._runEndHook(functionName, {
|
|
200
|
-
args,
|
|
201
|
-
span
|
|
202
|
-
});
|
|
203
|
-
span.end();
|
|
204
|
-
return cb.apply(this, arguments);
|
|
205
|
-
});
|
|
206
|
-
try {
|
|
207
|
-
return api.context.with(suppressTracing(api.trace.setSpan(activeContext, span)), original, this, ...args);
|
|
208
|
-
} catch (error) {
|
|
209
|
-
span.recordException(error);
|
|
210
|
-
span.setStatus({
|
|
211
|
-
message: error.message,
|
|
212
|
-
code: api.SpanStatusCode.ERROR
|
|
213
|
-
});
|
|
214
|
-
instrumentation._runEndHook(functionName, {
|
|
215
|
-
args,
|
|
216
|
-
span,
|
|
217
|
-
error
|
|
218
|
-
});
|
|
219
|
-
span.end();
|
|
220
|
-
throw error;
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
227
|
+
if (typeof cb !== "function") {
|
|
223
228
|
return original.apply(this, args);
|
|
224
229
|
}
|
|
230
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
231
|
+
const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });
|
|
232
|
+
args[lastIdx] = context.bind(context.active(), function(...cbArgs) {
|
|
233
|
+
span.end();
|
|
234
|
+
return cb.apply(this, cbArgs);
|
|
235
|
+
});
|
|
236
|
+
try {
|
|
237
|
+
return suppressTracing(() => original.apply(this, args));
|
|
238
|
+
} catch (error) {
|
|
239
|
+
recordError(span, error, config);
|
|
240
|
+
span.end();
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
225
243
|
};
|
|
226
244
|
const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
227
245
|
const promisified = function(path) {
|
|
@@ -236,72 +254,24 @@ class FsInstrumentation extends InstrumentationBase {
|
|
|
236
254
|
_patchPromiseFunction(functionName, original) {
|
|
237
255
|
const instrumentation = this;
|
|
238
256
|
const patchedFunction = async function(...args) {
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
const res = await api.context.with(
|
|
251
|
-
suppressTracing(api.trace.setSpan(activeContext, span)),
|
|
252
|
-
original,
|
|
253
|
-
this,
|
|
254
|
-
...args
|
|
255
|
-
);
|
|
256
|
-
instrumentation._runEndHook(functionName, { args, span });
|
|
257
|
-
return res;
|
|
258
|
-
} catch (error) {
|
|
259
|
-
span.recordException(error);
|
|
260
|
-
span.setStatus({
|
|
261
|
-
message: error.message,
|
|
262
|
-
code: api.SpanStatusCode.ERROR
|
|
263
|
-
});
|
|
264
|
-
instrumentation._runEndHook(functionName, { args, span, error });
|
|
265
|
-
throw error;
|
|
266
|
-
} finally {
|
|
267
|
-
span.end();
|
|
268
|
-
}
|
|
257
|
+
const config = instrumentation.getConfig();
|
|
258
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
259
|
+
return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, async (span) => {
|
|
260
|
+
try {
|
|
261
|
+
return await suppressTracing(() => original.apply(this, args));
|
|
262
|
+
} catch (error) {
|
|
263
|
+
recordError(span, error, config);
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
269
267
|
};
|
|
270
268
|
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
271
269
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
} catch (e) {
|
|
278
|
-
this._diag.error("caught createHook error", e);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return true;
|
|
282
|
-
}
|
|
283
|
-
_runEndHook(...args) {
|
|
284
|
-
const { endHook } = this.getConfig();
|
|
285
|
-
if (typeof endHook === "function") {
|
|
286
|
-
try {
|
|
287
|
-
endHook(...args);
|
|
288
|
-
} catch (e) {
|
|
289
|
-
this._diag.error("caught endHook error", e);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
_shouldTrace(context) {
|
|
294
|
-
if (isTracingSuppressed(context)) {
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
const { requireParentSpan } = this.getConfig();
|
|
298
|
-
if (requireParentSpan) {
|
|
299
|
-
const parentSpan = api.trace.getSpan(context);
|
|
300
|
-
if (parentSpan == null) {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return true;
|
|
270
|
+
}
|
|
271
|
+
function recordError(span, error, config) {
|
|
272
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
|
|
273
|
+
if (config.recordErrorMessagesAsSpanAttributes && error instanceof Error) {
|
|
274
|
+
span.setAttribute("fs_error", error.message);
|
|
305
275
|
}
|
|
306
276
|
}
|
|
307
277
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/fs/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-fs\n * - Upstream version: @opentelemetry/instrumentation-fs@0.37.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n/* eslint-disable */\n\nimport * as api from '@opentelemetry/api';\nimport { isTracingSuppressed, suppressTracing } from '@opentelemetry/core';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport { CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS, SYNC_FUNCTIONS } from './constants';\nimport type * as fs from 'fs';\nimport type { FMember, FPMember, CreateHook, EndHook, FsInstrumentationConfig } from './types';\nimport { promisify } from 'util';\nimport { indexFs } from './utils';\n\ntype FS = typeof fs;\ntype FSPromises = (typeof fs)['promises'];\n\nconst PACKAGE_NAME = '@sentry/instrumentation-fs';\n\n/**\n * This is important for 2-level functions like `realpath.native` to retain the 2nd-level\n * when patching the 1st-level.\n */\nfunction patchedFunctionWithOriginalProperties<T extends (...args: any[]) => ReturnType<T>>(\n patchedFunction: T,\n original: T,\n): T {\n return Object.assign(patchedFunction, original);\n}\n\nexport class FsInstrumentation extends InstrumentationBase<FsInstrumentationConfig> {\n constructor(config: FsInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n init(): (InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition)[] {\n return [\n new InstrumentationNodeModuleDefinition(\n 'fs',\n ['*'],\n (fs: FS) => {\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n this._wrap(objectToPatch, functionNameToPatch, this._patchSyncFunction.bind(this, fName) as any);\n }\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n if (fName === 'exists') {\n // handling separately because of the inconsistent cb style:\n // `exists` doesn't have error as the first argument, but the result\n this._wrap(\n objectToPatch,\n functionNameToPatch,\n this._patchExistsCallbackFunction.bind(this, fName) as any,\n );\n continue;\n }\n this._wrap(objectToPatch, functionNameToPatch, this._patchCallbackFunction.bind(this, fName) as any);\n }\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fs.promises[fName])) {\n this._unwrap(fs.promises, fName);\n }\n this._wrap(fs.promises, fName, this._patchPromiseFunction.bind(this, fName) as any);\n }\n return fs;\n },\n (fs: FS) => {\n if (fs === undefined) return;\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n }\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n }\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fs.promises[fName])) {\n this._unwrap(fs.promises, fName);\n }\n }\n },\n ),\n new InstrumentationNodeModuleDefinition(\n 'fs/promises',\n ['*'],\n (fsPromises: FSPromises) => {\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fsPromises[fName])) {\n this._unwrap(fsPromises, fName);\n }\n this._wrap(fsPromises, fName, this._patchPromiseFunction.bind(this, fName) as any);\n }\n return fsPromises;\n },\n (fsPromises: FSPromises) => {\n if (fsPromises === undefined) return;\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fsPromises[fName])) {\n this._unwrap(fsPromises, fName);\n }\n }\n },\n ),\n ];\n }\n\n protected _patchSyncFunction<T extends (...args: any[]) => ReturnType<T>>(functionName: FMember, original: T): T {\n const instrumentation = this;\n const patchedFunction = function (this: any, ...args: any[]) {\n const activeContext = api.context.active();\n\n if (!instrumentation._shouldTrace(activeContext)) {\n return original.apply(this, args);\n }\n if (\n instrumentation._runCreateHook(functionName, {\n args: args,\n }) === false\n ) {\n return api.context.with(suppressTracing(activeContext), original, this, ...args);\n }\n\n const span = instrumentation.tracer.startSpan(`fs ${functionName}`) as api.Span;\n\n try {\n // Suppress tracing for internal fs calls\n const res = api.context.with(suppressTracing(api.trace.setSpan(activeContext, span)), original, this, ...args);\n instrumentation._runEndHook(functionName, { args: args, span });\n return res;\n } catch (error: any) {\n span.recordException(error);\n span.setStatus({\n message: error.message,\n code: api.SpanStatusCode.ERROR,\n });\n instrumentation._runEndHook(functionName, { args: args, span, error });\n throw error;\n } finally {\n span.end();\n }\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as any, original);\n }\n\n protected _patchCallbackFunction<T extends (...args: any[]) => ReturnType<T>>(functionName: FMember, original: T): T {\n const instrumentation = this;\n const patchedFunction = function (this: any, ...args: any[]) {\n const activeContext = api.context.active();\n\n if (!instrumentation._shouldTrace(activeContext)) {\n return original.apply(this, args);\n }\n if (\n instrumentation._runCreateHook(functionName, {\n args: args,\n }) === false\n ) {\n return api.context.with(suppressTracing(activeContext), original, this, ...args);\n }\n\n const lastIdx = args.length - 1;\n const cb = args[lastIdx];\n if (typeof cb === 'function') {\n const span = instrumentation.tracer.startSpan(`fs ${functionName}`) as api.Span;\n\n // Return to the context active during the call in the callback\n args[lastIdx] = api.context.bind(activeContext, function (this: unknown, error?: Error) {\n if (error) {\n span.recordException(error);\n span.setStatus({\n message: error.message,\n code: api.SpanStatusCode.ERROR,\n });\n }\n instrumentation._runEndHook(functionName, {\n args: args,\n span,\n error,\n });\n span.end();\n return cb.apply(this, arguments);\n });\n\n try {\n // Suppress tracing for internal fs calls\n return api.context.with(suppressTracing(api.trace.setSpan(activeContext, span)), original, this, ...args);\n } catch (error: any) {\n span.recordException(error);\n span.setStatus({\n message: error.message,\n code: api.SpanStatusCode.ERROR,\n });\n instrumentation._runEndHook(functionName, {\n args: args,\n span,\n error,\n });\n span.end();\n throw error;\n }\n } else {\n // TODO: what to do if we are pretty sure it's going to throw\n return original.apply(this, args);\n }\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as any, original);\n }\n\n protected _patchExistsCallbackFunction<T extends (...args: any[]) => ReturnType<T>>(\n functionName: 'exists',\n original: T,\n ): T {\n const instrumentation = this;\n const patchedFunction = function (this: any, ...args: any[]) {\n const activeContext = api.context.active();\n\n if (!instrumentation._shouldTrace(activeContext)) {\n return original.apply(this, args);\n }\n if (\n instrumentation._runCreateHook(functionName, {\n args: args,\n }) === false\n ) {\n return api.context.with(suppressTracing(activeContext), original, this, ...args);\n }\n\n const lastIdx = args.length - 1;\n const cb = args[lastIdx];\n if (typeof cb === 'function') {\n const span = instrumentation.tracer.startSpan(`fs ${functionName}`) as api.Span;\n\n // Return to the context active during the call in the callback\n args[lastIdx] = api.context.bind(activeContext, function (this: unknown) {\n // `exists` never calls the callback with an error\n instrumentation._runEndHook(functionName, {\n args: args,\n span,\n });\n span.end();\n return cb.apply(this, arguments);\n });\n\n try {\n // Suppress tracing for internal fs calls\n return api.context.with(suppressTracing(api.trace.setSpan(activeContext, span)), original, this, ...args);\n } catch (error: any) {\n span.recordException(error);\n span.setStatus({\n message: error.message,\n code: api.SpanStatusCode.ERROR,\n });\n instrumentation._runEndHook(functionName, {\n args: args,\n span,\n error,\n });\n span.end();\n throw error;\n }\n } else {\n return original.apply(this, args);\n }\n };\n const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction, original);\n\n // `exists` has a custom promisify function because of the inconsistent signature\n // replicating that on the patched function\n const promisified = function (path: unknown) {\n return new Promise(resolve => functionWithOriginalProperties(path, resolve));\n };\n Object.defineProperty(promisified, 'name', { value: functionName });\n Object.defineProperty(functionWithOriginalProperties, promisify.custom, {\n value: promisified,\n });\n\n return functionWithOriginalProperties as T;\n }\n\n protected _patchPromiseFunction<T extends (...args: any[]) => ReturnType<T>>(functionName: FPMember, original: T): T {\n const instrumentation = this;\n const patchedFunction = async function (this: any, ...args: any[]) {\n const activeContext = api.context.active();\n\n if (!instrumentation._shouldTrace(activeContext)) {\n return original.apply(this, args);\n }\n if (\n instrumentation._runCreateHook(functionName, {\n args: args,\n }) === false\n ) {\n return api.context.with(suppressTracing(activeContext), original, this, ...args);\n }\n\n const span = instrumentation.tracer.startSpan(`fs ${functionName}`) as api.Span;\n\n try {\n // Suppress tracing for internal fs calls\n const res = await api.context.with(\n suppressTracing(api.trace.setSpan(activeContext, span)),\n original,\n this,\n ...args,\n );\n instrumentation._runEndHook(functionName, { args: args, span });\n return res;\n } catch (error: any) {\n span.recordException(error);\n span.setStatus({\n message: error.message,\n code: api.SpanStatusCode.ERROR,\n });\n instrumentation._runEndHook(functionName, { args: args, span, error });\n throw error;\n } finally {\n span.end();\n }\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as any, original);\n }\n\n protected _runCreateHook(...args: Parameters<CreateHook>): ReturnType<CreateHook> {\n const { createHook } = this.getConfig();\n if (typeof createHook === 'function') {\n try {\n return createHook(...args);\n } catch (e) {\n this._diag.error('caught createHook error', e);\n }\n }\n return true;\n }\n\n protected _runEndHook(...args: Parameters<EndHook>): ReturnType<EndHook> {\n const { endHook } = this.getConfig();\n if (typeof endHook === 'function') {\n try {\n endHook(...args);\n } catch (e) {\n this._diag.error('caught endHook error', e);\n }\n }\n }\n\n protected _shouldTrace(context: api.Context): boolean {\n if (isTracingSuppressed(context)) {\n // Performance optimization. Avoid creating additional contexts and spans\n // if we already know that the tracing is being suppressed.\n return false;\n }\n\n const { requireParentSpan } = this.getConfig();\n if (requireParentSpan) {\n const parentSpan = api.trace.getSpan(context);\n if (parentSpan == null) {\n return false;\n }\n }\n\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAmCA,MAAM,YAAA,GAAe,4BAAA;AAMrB,SAAS,qCAAA,CACP,iBACA,QAAA,EACG;AACH,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,eAAA,EAAiB,QAAQ,CAAA;AAChD;AAEO,MAAM,0BAA0B,mBAAA,CAA6C;AAAA,EAClF,WAAA,CAAY,MAAA,GAAkC,EAAC,EAAG;AAChD,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEA,IAAA,GAAsF;AACpF,IAAA,OAAO;AAAA,MACL,IAAI,mCAAA;AAAA,QACF,IAAA;AAAA,QACA,CAAC,GAAG,CAAA;AAAA,QACJ,CAAC,EAAA,KAAW;AACV,UAAA,KAAA,MAAW,SAAS,cAAA,EAAgB;AAClC,YAAA,MAAM,EAAE,aAAA,EAAe,mBAAA,EAAoB,GAAI,OAAA,CAAQ,IAAI,KAAK,CAAA;AAEhE,YAAA,IAAI,SAAA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AA,CAAK,SAAA,EAAU;AAC7C,IAAA,IAAI,iBAAA,EAAmB;AACrB,MAAA,MAAM,UAAA,GAAa,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,OAAO,CAAA;AAC5C,MAAA,IAAI,cAAc,IAAA,EAAM;AACtB,QAAA,OAAO,KAAA;AAAA,MACT;AAAA,IACF;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/fs/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-fs\n * - Upstream version: @opentelemetry/instrumentation-fs@0.37.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - The OpenTelemetry tracer APIs were replaced with Sentry's `startSpan`/`startInactiveSpan`/`suppressTracing`\n * and the configurable `createHook`/`endHook`/`requireParentSpan` options were removed in favor of inlined,\n * Sentry-specific span attributes.\n */\n\nimport { context } from '@opentelemetry/api';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n startSpan,\n suppressTracing,\n} from '@sentry/core';\nimport type * as fs from 'fs';\nimport { promisify } from 'util';\nimport { CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS, SYNC_FUNCTIONS } from './constants';\nimport type { FMember, FPMember, FsInstrumentationConfig, GenericFunction } from './types';\nimport { indexFs } from './utils';\n\ntype FS = typeof fs;\ntype FSPromises = (typeof fs)['promises'];\n\nconst PACKAGE_NAME = '@sentry/instrumentation-fs';\n\nconst SPAN_ORIGIN = 'auto.file.fs';\nconst SPAN_OP = 'file';\n\n// The following lists categorize `fs` functions by the shape of their leading path arguments, so we can\n// record meaningful span attributes for them. These are Sentry-specific additions (not part of upstream).\nconst FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ['rename', 'renameSync'];\nconst FS_OPERATIONS_WITH_SRC_DEST = ['copyFile', 'cp', 'copyFileSync', 'cpSync'];\nconst FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH = ['link', 'linkSync'];\nconst FS_OPERATIONS_WITH_PREFIX = ['mkdtemp', 'mkdtempSync'];\nconst FS_OPERATIONS_WITH_TARGET_PATH = ['symlink', 'symlinkSync'];\nconst FS_OPERATIONS_WITH_PATH_ARG = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'exists',\n 'mkdir',\n 'lchown',\n 'lstat',\n 'lutimes',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'realpath.native',\n 'rm',\n 'rmdir',\n 'stat',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile',\n 'accessSync',\n 'appendFileSync',\n 'chmodSync',\n 'chownSync',\n 'existsSync',\n 'lchownSync',\n 'lstatSync',\n 'lutimesSync',\n 'opendirSync',\n 'mkdirSync',\n 'openSync',\n 'readdirSync',\n 'readFileSync',\n 'readlinkSync',\n 'realpathSync',\n 'realpathSync.native',\n 'rmdirSync',\n 'rmSync',\n 'statSync',\n 'truncateSync',\n 'unlinkSync',\n 'utimesSync',\n 'writeFileSync',\n];\n\n/**\n * Builds the span attributes for a given `fs` operation, optionally including the file path arguments.\n */\nfunction getSpanAttributes(\n functionName: FMember | FPMember,\n args: ArrayLike<unknown>,\n config: FsInstrumentationConfig,\n): SpanAttributes {\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN,\n };\n\n if (!config.recordFilePaths) {\n return attributes;\n }\n\n if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PATH_ARG.includes(functionName)) {\n attributes['path_argument'] = args[0];\n } else if (typeof args[0] === 'string' && typeof args[1] === 'string') {\n if (FS_OPERATIONS_WITH_TARGET_PATH.includes(functionName)) {\n attributes['target_argument'] = args[0];\n attributes['path_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH.includes(functionName)) {\n attributes['existing_path_argument'] = args[0];\n attributes['new_path_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_SRC_DEST.includes(functionName)) {\n attributes['src_argument'] = args[0];\n attributes['dest_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH.includes(functionName)) {\n attributes['old_path_argument'] = args[0];\n attributes['new_path_argument'] = args[1];\n }\n } else if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PREFIX.includes(functionName)) {\n attributes['prefix_argument'] = args[0];\n }\n\n return attributes;\n}\n\n/**\n * This is important for 2-level functions like `realpath.native` to retain the 2nd-level\n * when patching the 1st-level.\n */\nfunction patchedFunctionWithOriginalProperties<T extends GenericFunction>(patchedFunction: T, original: T): T {\n return Object.assign(patchedFunction, original);\n}\n\nexport class FsInstrumentation extends InstrumentationBase<FsInstrumentationConfig> {\n public constructor(config: FsInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n public init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition(\n 'fs',\n ['*'],\n (fs: FS) => {\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n this._wrap(objectToPatch, functionNameToPatch, this._patchSyncFunction.bind(this, fName));\n }\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n if (fName === 'exists') {\n // handling separately because of the inconsistent cb style:\n // `exists` doesn't have error as the first argument, but the result\n this._wrap(objectToPatch, functionNameToPatch, this._patchExistsCallbackFunction.bind(this, fName));\n continue;\n }\n this._wrap(objectToPatch, functionNameToPatch, this._patchCallbackFunction.bind(this, fName));\n }\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fs.promises[fName])) {\n this._unwrap(fs.promises, fName);\n }\n this._wrap(fs.promises, fName, this._patchPromiseFunction.bind(this, fName));\n }\n return fs;\n },\n (fs: FS) => {\n if (fs === undefined) return;\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n }\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n }\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fs.promises[fName])) {\n this._unwrap(fs.promises, fName);\n }\n }\n },\n ),\n new InstrumentationNodeModuleDefinition(\n 'fs/promises',\n ['*'],\n (fsPromises: FSPromises) => {\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fsPromises[fName])) {\n this._unwrap(fsPromises, fName);\n }\n this._wrap(fsPromises, fName, this._patchPromiseFunction.bind(this, fName));\n }\n return fsPromises;\n },\n (fsPromises: FSPromises) => {\n if (fsPromises === undefined) return;\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fsPromises[fName])) {\n this._unwrap(fsPromises, fName);\n }\n }\n },\n ),\n ];\n }\n\n protected _patchSyncFunction<T extends GenericFunction>(functionName: FMember, original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const config = instrumentation.getConfig();\n const attributes = getSpanAttributes(functionName, args, config);\n\n return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, span => {\n try {\n // Suppress tracing for internal fs calls\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n throw error;\n }\n });\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n }\n\n protected _patchCallbackFunction<T extends GenericFunction>(functionName: FMember, original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const config = instrumentation.getConfig();\n\n const lastIdx = args.length - 1;\n const cb: unknown = args[lastIdx];\n if (typeof cb !== 'function') {\n // TODO: what to do if we are pretty sure it's going to throw\n return original.apply(this, args) as ReturnType<T>;\n }\n\n const attributes = getSpanAttributes(functionName, args, config);\n const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });\n\n // Return to the context active during the call in the callback\n args[lastIdx] = context.bind(context.active(), function (this: unknown, ...cbArgs: unknown[]) {\n const error = cbArgs[0];\n if (error) {\n recordError(span, error, config);\n }\n span.end();\n return cb.apply(this, cbArgs);\n });\n\n try {\n // Suppress tracing for internal fs calls\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n span.end();\n throw error;\n }\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n }\n\n protected _patchExistsCallbackFunction<T extends GenericFunction>(functionName: 'exists', original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const config = instrumentation.getConfig();\n\n const lastIdx = args.length - 1;\n const cb: unknown = args[lastIdx];\n if (typeof cb !== 'function') {\n return original.apply(this, args) as ReturnType<T>;\n }\n\n const attributes = getSpanAttributes(functionName, args, config);\n const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });\n\n // Return to the context active during the call in the callback\n args[lastIdx] = context.bind(context.active(), function (this: unknown, ...cbArgs: unknown[]) {\n // `exists` never calls the callback with an error\n span.end();\n return cb.apply(this, cbArgs);\n });\n\n try {\n // Suppress tracing for internal fs calls\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n span.end();\n throw error;\n }\n };\n const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n\n // `exists` has a custom promisify function because of the inconsistent signature\n // replicating that on the patched function\n const promisified = function (path: unknown): Promise<unknown> {\n return new Promise(resolve => (functionWithOriginalProperties as GenericFunction)(path, resolve));\n };\n Object.defineProperty(promisified, 'name', { value: functionName });\n Object.defineProperty(functionWithOriginalProperties, promisify.custom, {\n value: promisified,\n });\n\n return functionWithOriginalProperties;\n }\n\n protected _patchPromiseFunction<T extends GenericFunction>(functionName: FPMember, original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = async function (this: unknown, ...args: Parameters<T>): Promise<unknown> {\n const config = instrumentation.getConfig();\n const attributes = getSpanAttributes(functionName, args, config);\n\n return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, async span => {\n try {\n // Suppress tracing for internal fs calls\n return await suppressTracing(() => original.apply(this, args) as Promise<unknown>);\n } catch (error) {\n recordError(span, error, config);\n throw error;\n }\n });\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as unknown as T, original);\n }\n}\n\n/**\n * Sets the error status on the span and, if configured, records the error message as a span attribute.\n */\nfunction recordError(span: Span, error: unknown, config: FsInstrumentationConfig): void {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n if (config.recordErrorMessagesAsSpanAttributes && error instanceof Error) {\n span.setAttribute('fs_error', error.message);\n }\n}\n"],"names":[],"mappings":";;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["../../../../../src/integrations/fs/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/integrations/fs/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-fs\n * - Upstream version: @opentelemetry/instrumentation-fs@0.37.0\n */\n\nimport type * as fs from 'fs';\nimport type { FMember, FunctionPropertyNames, GenericFunction } from './types';\n\ntype FS = typeof fs;\n\nexport function splitTwoLevels<FSObject>(\n functionName: FMember,\n): [FunctionPropertyNames<FSObject> & string] | [FunctionPropertyNames<FSObject> & string, string] {\n const memberParts = functionName.split('.');\n if (memberParts.length > 1) {\n if (memberParts.length !== 2) throw Error(`Invalid member function name ${functionName}`);\n return memberParts as [FunctionPropertyNames<FSObject> & string, string];\n } else {\n return [functionName as FunctionPropertyNames<FSObject> & string];\n }\n}\n\nexport function indexFs<FSObject extends FS | FS['promises']>(\n fs: FSObject,\n member: FMember,\n): { objectToPatch: Record<string, GenericFunction>; functionNameToPatch: string } {\n if (!member) throw new Error(JSON.stringify({ member }));\n const splitResult = splitTwoLevels<FSObject>(member);\n const [functionName1, functionName2] = splitResult;\n if (functionName2) {\n return {\n objectToPatch: fs[functionName1] as Record<string, GenericFunction>,\n functionNameToPatch: functionName2,\n };\n } else {\n return {\n objectToPatch: fs as unknown as Record<string, GenericFunction>,\n functionNameToPatch: functionName1,\n };\n }\n}\n"],"names":[],"mappings":"AAcO,SAAS,eACd,YAAA,EACiG;AACjG,EAAA,MAAM,WAAA,GAAc,YAAA,CAAa,KAAA,CAAM,GAAG,CAAA;AAC1C,EAAA,IAAI,WAAA,CAAY,SAAS,CAAA,EAAG;AAC1B,IAAA,IAAI,YAAY,MAAA,KAAW,CAAA,QAAS,KAAA,CAAM,CAAA,6BAAA,EAAgC,YAAY,CAAA,CAAE,CAAA;AACxF,IAAA,OAAO,WAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,CAAC,YAAwD,CAAA;AAAA,EAClE;AACF;AAEO,SAAS,OAAA,CACd,IACA,MAAA,EACiF;AACjF,EAAA,IAAI,CAAC,MAAA,EAAQ,MAAM,IAAI,KAAA,CAAM,KAAK,SAAA,CAAU,EAAE,MAAA,EAAQ,CAAC,CAAA;AACvD,EAAA,MAAM,WAAA,GAAc,eAAyB,MAAM,CAAA;AACnD,EAAA,MAAM,CAAC,aAAA,EAAe,aAAa,CAAA,GAAI,WAAA;AACvC,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,OAAO;AAAA,MACL,aAAA,EAAe,GAAG,aAAa,CAAA;AAAA,MAC/B,mBAAA,EAAqB;AAAA,KACvB;AAAA,EACF,CAAA,MAAO;AACL,IAAA,OAAO;AAAA,MACL,aAAA,EAAe,EAAA;AAAA,MACf,mBAAA,EAAqB;AAAA,KACvB;AAAA,EACF;AACF;;;;"}
|