@sentry/server-utils 10.65.0 → 10.67.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/graphql/graphql-dc-subscriber.js +2 -4
- package/build/cjs/graphql/graphql-dc-subscriber.js.map +1 -1
- package/build/cjs/graphql/utils.js +7 -1
- package/build/cjs/graphql/utils.js.map +1 -1
- package/build/cjs/index.js +18 -8
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js +16 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/index.js +154 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +46 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +47 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +419 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js +131 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js +21 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js +64 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js +21 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +27 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js +63 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js +116 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +25 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js +30 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/dataloader.js +95 -0
- package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/express/instrumentation.js +1 -6
- package/build/cjs/integrations/tracing-channel/express/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/generic-pool.js +34 -0
- package/build/cjs/integrations/tracing-channel/generic-pool.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/graphql/spans.js +2 -2
- package/build/cjs/integrations/tracing-channel/graphql/spans.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/ioredis.js +29 -26
- package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js +71 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/index.js +70 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js +22 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/spans.js +119 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/knex.js +188 -0
- package/build/cjs/integrations/tracing-channel/knex.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/koa.js +146 -0
- package/build/cjs/integrations/tracing-channel/koa.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/langchain.js +63 -0
- package/build/cjs/integrations/tracing-channel/langchain.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/langgraph.js +100 -0
- package/build/cjs/integrations/tracing-channel/langgraph.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mongodb.js +104 -0
- package/build/cjs/integrations/tracing-channel/mongodb.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mongoose.js +110 -0
- package/build/cjs/integrations/tracing-channel/mongoose.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mysql2.js +83 -0
- package/build/cjs/integrations/tracing-channel/mysql2.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/openai.js +1 -3
- package/build/cjs/integrations/tracing-channel/openai.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/redis.js +25 -34
- package/build/cjs/integrations/tracing-channel/redis.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/tedious.js +145 -0
- package/build/cjs/integrations/tracing-channel/tedious.js.map +1 -0
- package/build/cjs/mongodb/mongodb-span.js +133 -0
- package/build/cjs/mongodb/mongodb-span.js.map +1 -0
- package/build/cjs/mongoose/index.js.map +1 -1
- package/build/cjs/mongoose/mongoose-legacy-span.js +40 -0
- package/build/cjs/mongoose/mongoose-legacy-span.js.map +1 -0
- package/build/cjs/orchestrion/bundler/esbuild.js +15 -0
- package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -0
- package/build/cjs/orchestrion/bundler/options.js +24 -0
- package/build/cjs/orchestrion/bundler/options.js.map +1 -0
- package/build/cjs/orchestrion/bundler/rollup.js +15 -0
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -0
- package/build/cjs/orchestrion/bundler/vite.js +8 -21
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/bundler/webpack.js +36 -0
- package/build/cjs/orchestrion/bundler/webpack.js.map +1 -0
- package/build/cjs/orchestrion/channels.js +54 -20
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/amqplib.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/cjs/orchestrion/config/aws-sdk.js +28 -0
- package/build/cjs/orchestrion/config/aws-sdk.js.map +1 -0
- package/build/cjs/orchestrion/config/dataloader.js +53 -0
- package/build/cjs/orchestrion/config/dataloader.js.map +1 -0
- package/build/cjs/orchestrion/config/express.js +9 -8
- package/build/cjs/orchestrion/config/express.js.map +1 -1
- package/build/cjs/orchestrion/config/firebase.js +8 -0
- package/build/cjs/orchestrion/config/firebase.js.map +1 -0
- package/build/cjs/orchestrion/config/generic-pool.js +21 -0
- package/build/cjs/orchestrion/config/generic-pool.js.map +1 -0
- package/build/cjs/orchestrion/config/google-genai.js.map +1 -1
- package/build/cjs/orchestrion/config/graphql.js.map +1 -1
- package/build/cjs/orchestrion/config/hapi.js.map +1 -1
- package/build/cjs/orchestrion/config/index.js +64 -23
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/ioredis.js.map +1 -1
- package/build/cjs/orchestrion/config/kafkajs.js +30 -0
- package/build/cjs/orchestrion/config/kafkajs.js.map +1 -0
- package/build/cjs/orchestrion/config/knex.js +43 -0
- package/build/cjs/orchestrion/config/knex.js.map +1 -0
- package/build/cjs/orchestrion/config/koa.js +16 -0
- package/build/cjs/orchestrion/config/koa.js.map +1 -0
- package/build/cjs/orchestrion/config/langchain.js +52 -0
- package/build/cjs/orchestrion/config/langchain.js.map +1 -0
- package/build/cjs/orchestrion/config/langgraph.js +28 -0
- package/build/cjs/orchestrion/config/langgraph.js.map +1 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -1
- package/build/cjs/orchestrion/config/mongodb.js +67 -0
- package/build/cjs/orchestrion/config/mongodb.js.map +1 -0
- package/build/cjs/orchestrion/config/mongoose.js +107 -0
- package/build/cjs/orchestrion/config/mongoose.js.map +1 -0
- package/build/cjs/orchestrion/config/mysql.js.map +1 -1
- package/build/cjs/orchestrion/config/mysql2.js +32 -0
- package/build/cjs/orchestrion/config/mysql2.js.map +1 -0
- package/build/cjs/orchestrion/config/nestjs.js +122 -0
- package/build/cjs/orchestrion/config/nestjs.js.map +1 -0
- package/build/cjs/orchestrion/config/openai.js +5 -5
- package/build/cjs/orchestrion/config/openai.js.map +1 -1
- package/build/cjs/orchestrion/config/pg.js.map +1 -1
- package/build/cjs/orchestrion/config/postgres.js.map +1 -1
- package/build/cjs/orchestrion/config/prisma.js +8 -0
- package/build/cjs/orchestrion/config/prisma.js.map +1 -0
- package/build/cjs/orchestrion/config/react-router.js +8 -0
- package/build/cjs/orchestrion/config/react-router.js.map +1 -0
- package/build/cjs/orchestrion/config/redis.js.map +1 -1
- package/build/cjs/orchestrion/config/remix.js +54 -0
- package/build/cjs/orchestrion/config/remix.js.map +1 -0
- package/build/cjs/orchestrion/config/tedious.js +24 -0
- package/build/cjs/orchestrion/config/tedious.js.map +1 -0
- package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -1
- package/build/cjs/orchestrion/detect.js +12 -11
- package/build/cjs/orchestrion/detect.js.map +1 -1
- package/build/cjs/orchestrion/index.js +44 -6
- package/build/cjs/orchestrion/index.js.map +1 -1
- package/build/cjs/orchestrion/runtime/register.js +45 -21
- package/build/cjs/orchestrion/runtime/register.js.map +1 -1
- package/build/cjs/prisma/global.js +14 -0
- package/build/cjs/prisma/global.js.map +1 -0
- package/build/cjs/prisma/index.js +27 -0
- package/build/cjs/prisma/index.js.map +1 -0
- package/build/cjs/prisma/tracing-helper.js +211 -0
- package/build/cjs/prisma/tracing-helper.js.map +1 -0
- package/build/cjs/redis/redis-dc-subscriber.js +27 -38
- package/build/cjs/redis/redis-dc-subscriber.js.map +1 -1
- package/build/cjs/vercel-ai/util.js +0 -11
- package/build/cjs/vercel-ai/util.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +9 -9
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js +16 -3
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
- package/build/esm/graphql/graphql-dc-subscriber.js +3 -5
- package/build/esm/graphql/graphql-dc-subscriber.js.map +1 -1
- package/build/esm/graphql/utils.js +8 -2
- package/build/esm/graphql/utils.js.map +1 -1
- package/build/esm/index.js +3 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing-channel/aws-sdk/constants.js +9 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/index.js +152 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +41 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +45 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +417 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js +129 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js +19 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js +62 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js +19 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +25 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js +61 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js +114 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +23 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/utils.js +26 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
- package/build/esm/integrations/tracing-channel/dataloader.js +93 -0
- package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -0
- package/build/esm/integrations/tracing-channel/express/instrumentation.js +1 -6
- package/build/esm/integrations/tracing-channel/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing-channel/generic-pool.js +32 -0
- package/build/esm/integrations/tracing-channel/generic-pool.js.map +1 -0
- package/build/esm/integrations/tracing-channel/graphql/spans.js +3 -3
- package/build/esm/integrations/tracing-channel/graphql/spans.js.map +1 -1
- package/build/esm/integrations/tracing-channel/ioredis.js +29 -27
- package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -1
- package/build/esm/integrations/tracing-channel/kafkajs/consumer.js +67 -0
- package/build/esm/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
- package/build/esm/integrations/tracing-channel/kafkajs/index.js +68 -0
- package/build/esm/integrations/tracing-channel/kafkajs/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/kafkajs/semconv.js +12 -0
- package/build/esm/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
- package/build/esm/integrations/tracing-channel/kafkajs/spans.js +112 -0
- package/build/esm/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
- package/build/esm/integrations/tracing-channel/knex.js +186 -0
- package/build/esm/integrations/tracing-channel/knex.js.map +1 -0
- package/build/esm/integrations/tracing-channel/koa.js +144 -0
- package/build/esm/integrations/tracing-channel/koa.js.map +1 -0
- package/build/esm/integrations/tracing-channel/langchain.js +61 -0
- package/build/esm/integrations/tracing-channel/langchain.js.map +1 -0
- package/build/esm/integrations/tracing-channel/langgraph.js +98 -0
- package/build/esm/integrations/tracing-channel/langgraph.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mongodb.js +102 -0
- package/build/esm/integrations/tracing-channel/mongodb.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mongoose.js +108 -0
- package/build/esm/integrations/tracing-channel/mongoose.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mysql2.js +81 -0
- package/build/esm/integrations/tracing-channel/mysql2.js.map +1 -0
- package/build/esm/integrations/tracing-channel/openai.js +1 -3
- package/build/esm/integrations/tracing-channel/openai.js.map +1 -1
- package/build/esm/integrations/tracing-channel/redis.js +25 -34
- package/build/esm/integrations/tracing-channel/redis.js.map +1 -1
- package/build/esm/integrations/tracing-channel/tedious.js +143 -0
- package/build/esm/integrations/tracing-channel/tedious.js.map +1 -0
- package/build/esm/mongodb/mongodb-span.js +126 -0
- package/build/esm/mongodb/mongodb-span.js.map +1 -0
- package/build/esm/mongoose/index.js.map +1 -1
- package/build/esm/mongoose/mongoose-legacy-span.js +38 -0
- package/build/esm/mongoose/mongoose-legacy-span.js.map +1 -0
- package/build/esm/orchestrion/bundler/esbuild.js +9 -0
- package/build/esm/orchestrion/bundler/esbuild.js.map +1 -0
- package/build/esm/orchestrion/bundler/options.js +22 -0
- package/build/esm/orchestrion/bundler/options.js.map +1 -0
- package/build/esm/orchestrion/bundler/rollup.js +9 -0
- package/build/esm/orchestrion/bundler/rollup.js.map +1 -0
- package/build/esm/orchestrion/bundler/vite.js +5 -22
- package/build/esm/orchestrion/bundler/vite.js.map +1 -1
- package/build/esm/orchestrion/bundler/webpack.js +27 -0
- package/build/esm/orchestrion/bundler/webpack.js.map +1 -0
- package/build/esm/orchestrion/channels.js +54 -20
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/amqplib.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/esm/orchestrion/config/aws-sdk.js +25 -0
- package/build/esm/orchestrion/config/aws-sdk.js.map +1 -0
- package/build/esm/orchestrion/config/dataloader.js +50 -0
- package/build/esm/orchestrion/config/dataloader.js.map +1 -0
- package/build/esm/orchestrion/config/express.js +9 -8
- package/build/esm/orchestrion/config/express.js.map +1 -1
- package/build/esm/orchestrion/config/firebase.js +5 -0
- package/build/esm/orchestrion/config/firebase.js.map +1 -0
- package/build/esm/orchestrion/config/generic-pool.js +18 -0
- package/build/esm/orchestrion/config/generic-pool.js.map +1 -0
- package/build/esm/orchestrion/config/google-genai.js.map +1 -1
- package/build/esm/orchestrion/config/graphql.js.map +1 -1
- package/build/esm/orchestrion/config/hapi.js.map +1 -1
- package/build/esm/orchestrion/config/index.js +64 -24
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/ioredis.js.map +1 -1
- package/build/esm/orchestrion/config/kafkajs.js +27 -0
- package/build/esm/orchestrion/config/kafkajs.js.map +1 -0
- package/build/esm/orchestrion/config/knex.js +40 -0
- package/build/esm/orchestrion/config/knex.js.map +1 -0
- package/build/esm/orchestrion/config/koa.js +13 -0
- package/build/esm/orchestrion/config/koa.js.map +1 -0
- package/build/esm/orchestrion/config/langchain.js +48 -0
- package/build/esm/orchestrion/config/langchain.js.map +1 -0
- package/build/esm/orchestrion/config/langgraph.js +25 -0
- package/build/esm/orchestrion/config/langgraph.js.map +1 -0
- package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -1
- package/build/esm/orchestrion/config/mongodb.js +64 -0
- package/build/esm/orchestrion/config/mongodb.js.map +1 -0
- package/build/esm/orchestrion/config/mongoose.js +103 -0
- package/build/esm/orchestrion/config/mongoose.js.map +1 -0
- package/build/esm/orchestrion/config/mysql.js.map +1 -1
- package/build/esm/orchestrion/config/mysql2.js +29 -0
- package/build/esm/orchestrion/config/mysql2.js.map +1 -0
- package/build/esm/orchestrion/config/nestjs.js +119 -0
- package/build/esm/orchestrion/config/nestjs.js.map +1 -0
- package/build/esm/orchestrion/config/openai.js +5 -5
- package/build/esm/orchestrion/config/openai.js.map +1 -1
- package/build/esm/orchestrion/config/pg.js.map +1 -1
- package/build/esm/orchestrion/config/postgres.js.map +1 -1
- package/build/esm/orchestrion/config/prisma.js +5 -0
- package/build/esm/orchestrion/config/prisma.js.map +1 -0
- package/build/esm/orchestrion/config/react-router.js +5 -0
- package/build/esm/orchestrion/config/react-router.js.map +1 -0
- package/build/esm/orchestrion/config/redis.js.map +1 -1
- package/build/esm/orchestrion/config/remix.js +51 -0
- package/build/esm/orchestrion/config/remix.js.map +1 -0
- package/build/esm/orchestrion/config/tedious.js +21 -0
- package/build/esm/orchestrion/config/tedious.js.map +1 -0
- package/build/esm/orchestrion/config/vercel-ai.js.map +1 -1
- package/build/esm/orchestrion/detect.js +13 -12
- package/build/esm/orchestrion/detect.js.map +1 -1
- package/build/esm/orchestrion/index.js +26 -2
- package/build/esm/orchestrion/index.js.map +1 -1
- package/build/esm/orchestrion/runtime/register.js +47 -23
- package/build/esm/orchestrion/runtime/register.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/prisma/global.js +12 -0
- package/build/esm/prisma/global.js.map +1 -0
- package/build/esm/prisma/index.js +24 -0
- package/build/esm/prisma/index.js.map +1 -0
- package/build/esm/prisma/tracing-helper.js +209 -0
- package/build/esm/prisma/tracing-helper.js.map +1 -0
- package/build/esm/redis/redis-dc-subscriber.js +27 -38
- package/build/esm/redis/redis-dc-subscriber.js.map +1 -1
- package/build/esm/vercel-ai/util.js +1 -11
- package/build/esm/vercel-ai/util.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +11 -11
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js +17 -4
- package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
- package/build/types/graphql/utils.d.ts +2 -6
- package/build/types/graphql/utils.d.ts.map +1 -1
- package/build/types/index.d.ts +7 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
- package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
- package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
- package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
- package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
- package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/dataloader.d.ts +11 -0
- package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/express/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/generic-pool.d.ts +10 -0
- package/build/types/integrations/tracing-channel/generic-pool.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts +20 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
- package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
- package/build/types/integrations/tracing-channel/kafkajs/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
- package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
- package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
- package/build/types/integrations/tracing-channel/kafkajs/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/knex.d.ts +11 -0
- package/build/types/integrations/tracing-channel/knex.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/koa.d.ts +14 -0
- package/build/types/integrations/tracing-channel/koa.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/langchain.d.ts +10 -0
- package/build/types/integrations/tracing-channel/langchain.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/langgraph.d.ts +10 -0
- package/build/types/integrations/tracing-channel/langgraph.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mongodb.d.ts +12 -0
- package/build/types/integrations/tracing-channel/mongodb.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mongoose.d.ts +15 -0
- package/build/types/integrations/tracing-channel/mongoose.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mysql2.d.ts +15 -0
- package/build/types/integrations/tracing-channel/mysql2.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/redis.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/tedious.d.ts +11 -0
- package/build/types/integrations/tracing-channel/tedious.d.ts.map +1 -0
- package/build/types/mongodb/mongodb-span.d.ts +66 -0
- package/build/types/mongodb/mongodb-span.d.ts.map +1 -0
- package/build/types/mongoose/index.d.ts +2 -0
- package/build/types/mongoose/index.d.ts.map +1 -1
- package/build/types/mongoose/mongoose-legacy-span.d.ts +29 -0
- package/build/types/mongoose/mongoose-legacy-span.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/esbuild.d.ts +21 -0
- package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/options.d.ts +29 -0
- package/build/types/orchestrion/bundler/options.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/rollup.d.ts +17 -0
- package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/vite.d.ts +4 -17
- package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/webpack.d.ts +19 -0
- package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -0
- package/build/types/orchestrion/channels.d.ts +94 -37
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/aws-sdk.d.ts +19 -0
- package/build/types/orchestrion/config/aws-sdk.d.ts.map +1 -0
- package/build/types/orchestrion/config/dataloader.d.ts +46 -0
- package/build/types/orchestrion/config/dataloader.d.ts.map +1 -0
- package/build/types/orchestrion/config/express.d.ts +2 -4
- package/build/types/orchestrion/config/express.d.ts.map +1 -1
- package/build/types/orchestrion/config/firebase.d.ts +4 -0
- package/build/types/orchestrion/config/firebase.d.ts.map +1 -0
- package/build/types/orchestrion/config/generic-pool.d.ts +31 -0
- package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts +19 -6
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/ioredis.d.ts +1 -1
- package/build/types/orchestrion/config/ioredis.d.ts.map +1 -1
- package/build/types/orchestrion/config/kafkajs.d.ts +17 -0
- package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -0
- package/build/types/orchestrion/config/knex.d.ts +9 -0
- package/build/types/orchestrion/config/knex.d.ts.map +1 -0
- package/build/types/orchestrion/config/koa.d.ts +17 -0
- package/build/types/orchestrion/config/koa.d.ts.map +1 -0
- package/build/types/orchestrion/config/langchain.d.ts +18 -0
- package/build/types/orchestrion/config/langchain.d.ts.map +1 -0
- package/build/types/orchestrion/config/langgraph.d.ts +21 -0
- package/build/types/orchestrion/config/langgraph.d.ts.map +1 -0
- package/build/types/orchestrion/config/mongodb.d.ts +59 -0
- package/build/types/orchestrion/config/mongodb.d.ts.map +1 -0
- package/build/types/orchestrion/config/mongoose.d.ts +40 -0
- package/build/types/orchestrion/config/mongoose.d.ts.map +1 -0
- package/build/types/orchestrion/config/mysql2.d.ts +18 -0
- package/build/types/orchestrion/config/mysql2.d.ts.map +1 -0
- package/build/types/orchestrion/config/nestjs.d.ts +24 -0
- package/build/types/orchestrion/config/nestjs.d.ts.map +1 -0
- package/build/types/orchestrion/config/openai.d.ts +0 -2
- package/build/types/orchestrion/config/openai.d.ts.map +1 -1
- package/build/types/orchestrion/config/postgres.d.ts +1 -1
- package/build/types/orchestrion/config/postgres.d.ts.map +1 -1
- package/build/types/orchestrion/config/prisma.d.ts +4 -0
- package/build/types/orchestrion/config/prisma.d.ts.map +1 -0
- package/build/types/orchestrion/config/react-router.d.ts +4 -0
- package/build/types/orchestrion/config/react-router.d.ts.map +1 -0
- package/build/types/orchestrion/config/remix.d.ts +9 -0
- package/build/types/orchestrion/config/remix.d.ts.map +1 -0
- package/build/types/orchestrion/config/tedious.d.ts +12 -0
- package/build/types/orchestrion/config/tedious.d.ts.map +1 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts +1 -1
- package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -1
- package/build/types/orchestrion/detect.d.ts +3 -10
- package/build/types/orchestrion/detect.d.ts.map +1 -1
- package/build/types/orchestrion/index.d.ts +56 -1
- package/build/types/orchestrion/index.d.ts.map +1 -1
- package/build/types/orchestrion/runtime/register.d.ts +11 -9
- package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
- package/build/types/prisma/global.d.ts +5 -0
- package/build/types/prisma/global.d.ts.map +1 -0
- package/build/types/prisma/index.d.ts +45 -0
- package/build/types/prisma/index.d.ts.map +1 -0
- package/build/types/prisma/tracing-helper.d.ts +46 -0
- package/build/types/prisma/tracing-helper.d.ts.map +1 -0
- package/build/types/prisma/types.d.ts +37 -0
- package/build/types/prisma/types.d.ts.map +1 -0
- package/build/types/vercel-ai/util.d.ts +0 -2
- package/build/types/vercel-ai/util.d.ts.map +1 -1
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -1
- package/build/types-ts3.8/graphql/utils.d.ts +2 -6
- package/build/types-ts3.8/index.d.ts +7 -1
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
- package/build/types-ts3.8/integrations/tracing-channel/dataloader.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/generic-pool.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +20 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
- package/build/types-ts3.8/integrations/tracing-channel/knex.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/koa.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing-channel/langchain.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/langgraph.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/mongodb.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/mongoose.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/mysql2.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/tedious.d.ts +11 -0
- package/build/types-ts3.8/mongodb/mongodb-span.d.ts +66 -0
- package/build/types-ts3.8/mongoose/index.d.ts +2 -0
- package/build/types-ts3.8/mongoose/mongoose-legacy-span.d.ts +29 -0
- package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +21 -0
- package/build/types-ts3.8/orchestrion/bundler/options.d.ts +29 -0
- package/build/types-ts3.8/orchestrion/bundler/rollup.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/bundler/vite.d.ts +4 -17
- package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/channels.d.ts +94 -37
- package/build/types-ts3.8/orchestrion/config/aws-sdk.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +46 -0
- package/build/types-ts3.8/orchestrion/config/express.d.ts +2 -4
- package/build/types-ts3.8/orchestrion/config/firebase.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +31 -0
- package/build/types-ts3.8/orchestrion/config/index.d.ts +19 -6
- package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +1 -1
- package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/config/knex.d.ts +9 -0
- package/build/types-ts3.8/orchestrion/config/koa.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/config/langchain.d.ts +18 -0
- package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +21 -0
- package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +59 -0
- package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +40 -0
- package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +18 -0
- package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +24 -0
- package/build/types-ts3.8/orchestrion/config/openai.d.ts +0 -2
- package/build/types-ts3.8/orchestrion/config/postgres.d.ts +1 -1
- package/build/types-ts3.8/orchestrion/config/prisma.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/react-router.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/remix.d.ts +9 -0
- package/build/types-ts3.8/orchestrion/config/tedious.d.ts +12 -0
- package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +1 -1
- package/build/types-ts3.8/orchestrion/detect.d.ts +3 -10
- package/build/types-ts3.8/orchestrion/index.d.ts +56 -1
- package/build/types-ts3.8/orchestrion/runtime/register.d.ts +11 -9
- package/build/types-ts3.8/prisma/global.d.ts +5 -0
- package/build/types-ts3.8/prisma/index.d.ts +45 -0
- package/build/types-ts3.8/prisma/tracing-helper.d.ts +52 -0
- package/build/types-ts3.8/prisma/types.d.ts +40 -0
- package/build/types-ts3.8/vercel-ai/util.d.ts +0 -2
- package/package.json +40 -8
|
@@ -49,13 +49,12 @@ function setupValidateChannel(tracingChannel$1) {
|
|
|
49
49
|
tracingChannel.bindTracingChannelToSpan(
|
|
50
50
|
tracingChannel$1(GRAPHQL_DC_CHANNEL_VALIDATE),
|
|
51
51
|
(data) => {
|
|
52
|
-
const document = utils.redactGraphqlDocument(data.document);
|
|
53
52
|
return core.startInactiveSpan({
|
|
54
53
|
name: SPAN_NAME_VALIDATE,
|
|
55
54
|
attributes: {
|
|
56
55
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
57
56
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op.WEB_SERVER_GRAPHQL_SPAN_OP,
|
|
58
|
-
[attributes.GRAPHQL_DOCUMENT]: document
|
|
57
|
+
[attributes.GRAPHQL_DOCUMENT]: utils.collectGraphqlDocument(data.document)
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
60
|
},
|
|
@@ -72,7 +71,6 @@ function setupOperationChannel(tracingChannel$1, channelName, fallbackName, useO
|
|
|
72
71
|
tracingChannel.bindTracingChannelToSpan(
|
|
73
72
|
tracingChannel$1(channelName),
|
|
74
73
|
(data) => {
|
|
75
|
-
const document = utils.redactGraphqlDocument(data.document);
|
|
76
74
|
const span = core.startInactiveSpan({
|
|
77
75
|
name: utils.getOperationSpanName(data.operationType, data.operationName, fallbackName),
|
|
78
76
|
attributes: {
|
|
@@ -80,7 +78,7 @@ function setupOperationChannel(tracingChannel$1, channelName, fallbackName, useO
|
|
|
80
78
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op.WEB_SERVER_GRAPHQL_SPAN_OP,
|
|
81
79
|
[attributes.GRAPHQL_OPERATION_TYPE]: data.operationType,
|
|
82
80
|
[attributes.GRAPHQL_OPERATION_NAME]: data.operationName || void 0,
|
|
83
|
-
[attributes.GRAPHQL_DOCUMENT]: document
|
|
81
|
+
[attributes.GRAPHQL_DOCUMENT]: utils.collectGraphqlDocument(data.document)
|
|
84
82
|
}
|
|
85
83
|
});
|
|
86
84
|
if (useOperationNameForRootSpan && data.operationType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-dc-subscriber.js","sources":["../../../src/graphql/graphql-dc-subscriber.ts"],"sourcesContent":["import type { TracingChannel } from 'node:diagnostics_channel';\nimport { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes';\nimport { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport type { GraphqlDocumentNode } from './utils';\nimport { getOperationSpanName, hasResultErrors, redactGraphqlDocument, renameRootSpanWithOperation } from './utils';\n\n// Channel names published by graphql >= 17.0.0 (see graphql-js `src/diagnostics.ts`).\n// Hardcoded so the subscriber does not have to import graphql — the channels just\n// have to be subscribed to before the user's graphql code publishes.\nexport const GRAPHQL_DC_CHANNEL_PARSE = 'graphql:parse';\nexport const GRAPHQL_DC_CHANNEL_VALIDATE = 'graphql:validate';\nexport const GRAPHQL_DC_CHANNEL_EXECUTE = 'graphql:execute';\nexport const GRAPHQL_DC_CHANNEL_SUBSCRIBE = 'graphql:subscribe';\nexport const GRAPHQL_DC_CHANNEL_RESOLVE = 'graphql:resolve';\n\nconst ORIGIN = 'auto.graphql.diagnostic_channel';\n\nconst SPAN_NAME_PARSE = 'graphql.parse';\nconst SPAN_NAME_VALIDATE = 'graphql.validate';\nconst SPAN_NAME_EXECUTE = 'graphql.execute';\nconst SPAN_NAME_SUBSCRIBE = 'graphql.subscribe';\nconst SPAN_NAME_RESOLVE = 'graphql.resolve';\n\n// Field-level attributes for resolver spans. Not in `@sentry/conventions`; these match the keys the\n// vendored OTel instrumentation emits so there is no drift between the two paths.\nconst GRAPHQL_FIELD_NAME = 'graphql.field.name';\nconst GRAPHQL_FIELD_PATH = 'graphql.field.path';\nconst GRAPHQL_FIELD_TYPE = 'graphql.field.type';\nconst GRAPHQL_PARENT_NAME = 'graphql.parent.name';\n\n/** Context published on the sync-only `graphql:parse` channel. */\nexport interface GraphqlParseData {\n source: string | { body?: string };\n result?: GraphqlDocumentNode;\n error?: unknown;\n}\n\n/** Context published on the sync-only `graphql:validate` channel. */\nexport interface GraphqlValidateData {\n document: GraphqlDocumentNode;\n /** Validation errors returned by validation; an empty array means the document is valid. */\n result?: ReadonlyArray<unknown>;\n error?: unknown;\n}\n\n/**\n * Context published on the `graphql:execute` and `graphql:subscribe` channels.\n *\n * `result` carries an `ExecutionResult` (or, for subscriptions, an async generator); GraphQL errors\n * collected during execution surface on `result.errors` rather than as the channel's `error`\n * lifecycle event, which only fires on an abrupt throw.\n */\nexport interface GraphqlOperationData {\n document: GraphqlDocumentNode;\n operationName?: string;\n operationType?: string;\n result?: unknown;\n error?: unknown;\n}\n\n/**\n * Context published on the per-field `graphql:resolve` channel.\n *\n * A resolver throw or rejection publishes the `error` lifecycle event here; the same failure also\n * surfaces in the enclosing execution result.\n */\nexport interface GraphqlResolveData {\n fieldName: string;\n parentType: string;\n fieldType: string;\n fieldPath: string;\n /** Whether the field is handled by graphql's default property resolver (vs. a user resolver). */\n isDefaultResolver: boolean;\n alias?: string;\n args?: unknown;\n result?: unknown;\n error?: unknown;\n}\n\n/** Options controlling which graphql channels the subscriber emits spans for. */\nexport interface GraphqlDiagnosticChannelsOptions {\n /**\n * Do not create spans for resolvers. Resolver spans are per-field and can be very high volume.\n * Defaults to `true`.\n */\n ignoreResolveSpans?: boolean;\n\n /**\n * When resolver spans are enabled, do not create them for graphql's default property resolver\n * (fields without a user-defined resolver), which are rarely interesting. Defaults to `true`.\n */\n ignoreTrivialResolveSpans?: boolean;\n\n /**\n * Rename the enclosing root span to include the operation name(s), e.g.\n * `GET /graphql` -> `GET /graphql (query GetUser)`. Defaults to `true`.\n */\n useOperationNameForRootSpan?: boolean;\n}\n\n/**\n * Platform-provided factory that creates a native tracing channel for the given name. The\n * subscriber binds the span and its lifecycle onto the channel via `bindTracingChannelToSpan`,\n * which propagates the active span through the runtime's async context.\n *\n * Node passes `node:diagnostics_channel`'s `tracingChannel` directly.\n */\nexport type GraphqlTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;\n\n/**\n * Subscribe Sentry span handlers to graphql's diagnostics-channel events\n * (`graphql:parse`, `:validate`, `:execute`, `:subscribe`), published by graphql >= 17.0.0.\n *\n * On older graphql versions the channels are never published to, so the subscribers are inert —\n * there is no double-instrumentation against the vendored OTel patcher, which is gated to `< 17`.\n *\n * The per-field `graphql:resolve` channel is only subscribed when `ignoreResolveSpans` is `false`:\n * resolver spans are per-field and can be extremely high-volume, so they are off by default (matching\n * the legacy OTel path). When enabled, `ignoreTrivialResolveSpans` (default `true`) additionally skips\n * graphql's default property resolver.\n */\nexport function subscribeGraphqlDiagnosticChannels(\n tracingChannel: GraphqlTracingChannelFactory,\n options: GraphqlDiagnosticChannelsOptions = {},\n): void {\n const ignoreResolveSpans = options.ignoreResolveSpans !== false;\n const ignoreTrivialResolveSpans = options.ignoreTrivialResolveSpans !== false;\n const useOperationNameForRootSpan = options.useOperationNameForRootSpan !== false;\n\n setupParseChannel(tracingChannel);\n setupValidateChannel(tracingChannel);\n setupOperationChannel(tracingChannel, GRAPHQL_DC_CHANNEL_EXECUTE, SPAN_NAME_EXECUTE, useOperationNameForRootSpan);\n setupOperationChannel(tracingChannel, GRAPHQL_DC_CHANNEL_SUBSCRIBE, SPAN_NAME_SUBSCRIBE, useOperationNameForRootSpan);\n\n if (!ignoreResolveSpans) {\n setupResolveChannel(tracingChannel, ignoreTrivialResolveSpans);\n }\n}\n\nfunction setupParseChannel(tracingChannel: GraphqlTracingChannelFactory): void {\n bindTracingChannelToSpan(tracingChannel<GraphqlParseData>(GRAPHQL_DC_CHANNEL_PARSE), () =>\n startInactiveSpan({\n name: SPAN_NAME_PARSE,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n },\n }),\n );\n}\n\nfunction setupValidateChannel(tracingChannel: GraphqlTracingChannelFactory): void {\n bindTracingChannelToSpan(\n tracingChannel<GraphqlValidateData>(GRAPHQL_DC_CHANNEL_VALIDATE),\n data => {\n const document = redactGraphqlDocument(data.document);\n\n return startInactiveSpan({\n name: SPAN_NAME_VALIDATE,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_DOCUMENT]: document,\n },\n });\n },\n {\n beforeSpanEnd: (span, data) => {\n // Validation completes normally even when it returns errors, so flag the span here.\n if (Array.isArray(data.result) && data.result.length > 0) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'invalid_argument' });\n }\n },\n },\n );\n}\n\nfunction setupOperationChannel(\n tracingChannel: GraphqlTracingChannelFactory,\n channelName: string,\n fallbackName: string,\n useOperationNameForRootSpan: boolean,\n): void {\n bindTracingChannelToSpan(\n tracingChannel<GraphqlOperationData>(channelName),\n data => {\n const document = redactGraphqlDocument(data.document);\n\n const span = startInactiveSpan({\n name: getOperationSpanName(data.operationType, data.operationName, fallbackName),\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_OPERATION_TYPE]: data.operationType,\n [GRAPHQL_OPERATION_NAME]: data.operationName || undefined,\n [GRAPHQL_DOCUMENT]: document,\n },\n });\n\n if (useOperationNameForRootSpan && data.operationType) {\n renameRootSpanWithOperation(span, data.operationType, data.operationName);\n }\n\n return span;\n },\n {\n beforeSpanEnd: (span, data) => {\n // GraphQL errors are returned on `result.errors`, not as a thrown error, so flag the span here.\n if (hasResultErrors(data.result)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n }\n },\n },\n );\n}\n\nfunction setupResolveChannel(tracingChannel: GraphqlTracingChannelFactory, ignoreTrivialResolveSpans: boolean): void {\n bindTracingChannelToSpan(tracingChannel<GraphqlResolveData>(GRAPHQL_DC_CHANNEL_RESOLVE), data => {\n // Returning `undefined` opts this field out: no span is created and the active context is left\n // untouched, so the field still resolves under its parent span.\n if (ignoreTrivialResolveSpans && data.isDefaultResolver) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `${SPAN_NAME_RESOLVE} ${data.fieldPath}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_FIELD_NAME]: data.fieldName,\n [GRAPHQL_FIELD_PATH]: data.fieldPath,\n [GRAPHQL_FIELD_TYPE]: data.fieldType,\n [GRAPHQL_PARENT_NAME]: data.parentType,\n },\n });\n });\n}\n"],"names":["tracingChannel","bindTracingChannelToSpan","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","WEB_SERVER_GRAPHQL_SPAN_OP","redactGraphqlDocument","GRAPHQL_DOCUMENT","SPAN_STATUS_ERROR","getOperationSpanName","G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6BAAA;AAAA,QAChC,CAAC,kBAAkB,GAAG,IAAA,CAAK,SAAA;AAAA,QAC3B,CAAC,kBAAkB,GAAG,IAAA,CAAK,SAAA;AAAA,QAC3B,CAAC,kBAAkB,GAAG,IAAA,CAAK,SAAA;AAAA,QAC3B,CAAC,mBAAmB,GAAG,IAAA,CAAK;AAAA;AAC9B,KACD,CAAA;AAAA,EACH,CAAC,CAAA;AACH;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"graphql-dc-subscriber.js","sources":["../../../src/graphql/graphql-dc-subscriber.ts"],"sourcesContent":["import type { TracingChannel } from 'node:diagnostics_channel';\nimport { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes';\nimport { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport type { GraphqlDocumentNode } from './utils';\nimport { collectGraphqlDocument, getOperationSpanName, hasResultErrors, renameRootSpanWithOperation } from './utils';\n\n// Channel names published by graphql >= 17.0.0 (see graphql-js `src/diagnostics.ts`).\n// Hardcoded so the subscriber does not have to import graphql — the channels just\n// have to be subscribed to before the user's graphql code publishes.\nexport const GRAPHQL_DC_CHANNEL_PARSE = 'graphql:parse';\nexport const GRAPHQL_DC_CHANNEL_VALIDATE = 'graphql:validate';\nexport const GRAPHQL_DC_CHANNEL_EXECUTE = 'graphql:execute';\nexport const GRAPHQL_DC_CHANNEL_SUBSCRIBE = 'graphql:subscribe';\nexport const GRAPHQL_DC_CHANNEL_RESOLVE = 'graphql:resolve';\n\nconst ORIGIN = 'auto.graphql.diagnostic_channel';\n\nconst SPAN_NAME_PARSE = 'graphql.parse';\nconst SPAN_NAME_VALIDATE = 'graphql.validate';\nconst SPAN_NAME_EXECUTE = 'graphql.execute';\nconst SPAN_NAME_SUBSCRIBE = 'graphql.subscribe';\nconst SPAN_NAME_RESOLVE = 'graphql.resolve';\n\n// Field-level attributes for resolver spans. Not in `@sentry/conventions`; these match the keys the\n// vendored OTel instrumentation emits so there is no drift between the two paths.\nconst GRAPHQL_FIELD_NAME = 'graphql.field.name';\nconst GRAPHQL_FIELD_PATH = 'graphql.field.path';\nconst GRAPHQL_FIELD_TYPE = 'graphql.field.type';\nconst GRAPHQL_PARENT_NAME = 'graphql.parent.name';\n\n/** Context published on the sync-only `graphql:parse` channel. */\nexport interface GraphqlParseData {\n source: string | { body?: string };\n result?: GraphqlDocumentNode;\n error?: unknown;\n}\n\n/** Context published on the sync-only `graphql:validate` channel. */\nexport interface GraphqlValidateData {\n document: GraphqlDocumentNode;\n /** Validation errors returned by validation; an empty array means the document is valid. */\n result?: ReadonlyArray<unknown>;\n error?: unknown;\n}\n\n/**\n * Context published on the `graphql:execute` and `graphql:subscribe` channels.\n *\n * `result` carries an `ExecutionResult` (or, for subscriptions, an async generator); GraphQL errors\n * collected during execution surface on `result.errors` rather than as the channel's `error`\n * lifecycle event, which only fires on an abrupt throw.\n */\nexport interface GraphqlOperationData {\n document: GraphqlDocumentNode;\n operationName?: string;\n operationType?: string;\n result?: unknown;\n error?: unknown;\n}\n\n/**\n * Context published on the per-field `graphql:resolve` channel.\n *\n * A resolver throw or rejection publishes the `error` lifecycle event here; the same failure also\n * surfaces in the enclosing execution result.\n */\nexport interface GraphqlResolveData {\n fieldName: string;\n parentType: string;\n fieldType: string;\n fieldPath: string;\n /** Whether the field is handled by graphql's default property resolver (vs. a user resolver). */\n isDefaultResolver: boolean;\n alias?: string;\n args?: unknown;\n result?: unknown;\n error?: unknown;\n}\n\n/** Options controlling which graphql channels the subscriber emits spans for. */\nexport interface GraphqlDiagnosticChannelsOptions {\n /**\n * Do not create spans for resolvers. Resolver spans are per-field and can be very high volume.\n * Defaults to `true`.\n */\n ignoreResolveSpans?: boolean;\n\n /**\n * When resolver spans are enabled, do not create them for graphql's default property resolver\n * (fields without a user-defined resolver), which are rarely interesting. Defaults to `true`.\n */\n ignoreTrivialResolveSpans?: boolean;\n\n /**\n * Rename the enclosing root span to include the operation name(s), e.g.\n * `GET /graphql` -> `GET /graphql (query GetUser)`. Defaults to `true`.\n */\n useOperationNameForRootSpan?: boolean;\n}\n\n/**\n * Platform-provided factory that creates a native tracing channel for the given name. The\n * subscriber binds the span and its lifecycle onto the channel via `bindTracingChannelToSpan`,\n * which propagates the active span through the runtime's async context.\n *\n * Node passes `node:diagnostics_channel`'s `tracingChannel` directly.\n */\nexport type GraphqlTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;\n\n/**\n * Subscribe Sentry span handlers to graphql's diagnostics-channel events\n * (`graphql:parse`, `:validate`, `:execute`, `:subscribe`), published by graphql >= 17.0.0.\n *\n * On older graphql versions the channels are never published to, so the subscribers are inert —\n * there is no double-instrumentation against the vendored OTel patcher, which is gated to `< 17`.\n *\n * The per-field `graphql:resolve` channel is only subscribed when `ignoreResolveSpans` is `false`:\n * resolver spans are per-field and can be extremely high-volume, so they are off by default (matching\n * the legacy OTel path). When enabled, `ignoreTrivialResolveSpans` (default `true`) additionally skips\n * graphql's default property resolver.\n */\nexport function subscribeGraphqlDiagnosticChannels(\n tracingChannel: GraphqlTracingChannelFactory,\n options: GraphqlDiagnosticChannelsOptions = {},\n): void {\n const ignoreResolveSpans = options.ignoreResolveSpans !== false;\n const ignoreTrivialResolveSpans = options.ignoreTrivialResolveSpans !== false;\n const useOperationNameForRootSpan = options.useOperationNameForRootSpan !== false;\n\n setupParseChannel(tracingChannel);\n setupValidateChannel(tracingChannel);\n setupOperationChannel(tracingChannel, GRAPHQL_DC_CHANNEL_EXECUTE, SPAN_NAME_EXECUTE, useOperationNameForRootSpan);\n setupOperationChannel(tracingChannel, GRAPHQL_DC_CHANNEL_SUBSCRIBE, SPAN_NAME_SUBSCRIBE, useOperationNameForRootSpan);\n\n if (!ignoreResolveSpans) {\n setupResolveChannel(tracingChannel, ignoreTrivialResolveSpans);\n }\n}\n\nfunction setupParseChannel(tracingChannel: GraphqlTracingChannelFactory): void {\n bindTracingChannelToSpan(tracingChannel<GraphqlParseData>(GRAPHQL_DC_CHANNEL_PARSE), () =>\n startInactiveSpan({\n name: SPAN_NAME_PARSE,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n },\n }),\n );\n}\n\nfunction setupValidateChannel(tracingChannel: GraphqlTracingChannelFactory): void {\n bindTracingChannelToSpan(\n tracingChannel<GraphqlValidateData>(GRAPHQL_DC_CHANNEL_VALIDATE),\n data => {\n return startInactiveSpan({\n name: SPAN_NAME_VALIDATE,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document),\n },\n });\n },\n {\n beforeSpanEnd: (span, data) => {\n // Validation completes normally even when it returns errors, so flag the span here.\n if (Array.isArray(data.result) && data.result.length > 0) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'invalid_argument' });\n }\n },\n },\n );\n}\n\nfunction setupOperationChannel(\n tracingChannel: GraphqlTracingChannelFactory,\n channelName: string,\n fallbackName: string,\n useOperationNameForRootSpan: boolean,\n): void {\n bindTracingChannelToSpan(\n tracingChannel<GraphqlOperationData>(channelName),\n data => {\n const span = startInactiveSpan({\n name: getOperationSpanName(data.operationType, data.operationName, fallbackName),\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_OPERATION_TYPE]: data.operationType,\n [GRAPHQL_OPERATION_NAME]: data.operationName || undefined,\n [GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document),\n },\n });\n\n if (useOperationNameForRootSpan && data.operationType) {\n renameRootSpanWithOperation(span, data.operationType, data.operationName);\n }\n\n return span;\n },\n {\n beforeSpanEnd: (span, data) => {\n // GraphQL errors are returned on `result.errors`, not as a thrown error, so flag the span here.\n if (hasResultErrors(data.result)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n }\n },\n },\n );\n}\n\nfunction setupResolveChannel(tracingChannel: GraphqlTracingChannelFactory, ignoreTrivialResolveSpans: boolean): void {\n bindTracingChannelToSpan(tracingChannel<GraphqlResolveData>(GRAPHQL_DC_CHANNEL_RESOLVE), data => {\n // Returning `undefined` opts this field out: no span is created and the active context is left\n // untouched, so the field still resolves under its parent span.\n if (ignoreTrivialResolveSpans && data.isDefaultResolver) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `${SPAN_NAME_RESOLVE} ${data.fieldPath}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_FIELD_NAME]: data.fieldName,\n [GRAPHQL_FIELD_PATH]: data.fieldPath,\n [GRAPHQL_FIELD_TYPE]: data.fieldType,\n [GRAPHQL_PARENT_NAME]: data.parentType,\n },\n });\n });\n}\n"],"names":["tracingChannel","bindTracingChannelToSpan","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","WEB_SERVER_GRAPHQL_SPAN_OP","GRAPHQL_DOCUMENT","collectGraphqlDocument","SPAN_STATUS_ERROR","getOperationSpanName","GRAPHQL_OPERATION_TYPE","GRAPHQL_OPERATION_NAME","renameRootSpanWithOperation","hasResultErrors"],"mappings":";;;;;;;;AAgBO,MAAM,wBAAA,GAA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AA,CAAK;AAAA;AAC9B,KACD,CAAA;AAAA,EACH,CAAC,CAAA;AACH;;;;;;;;;"}
|
|
@@ -78,9 +78,15 @@ function redactGraphqlDocument(document) {
|
|
|
78
78
|
return void 0;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
function collectGraphqlDocument(document) {
|
|
82
|
+
if (core.getClient()?.getDataCollectionOptions().graphQL.document !== true) {
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
return redactGraphqlDocument(document);
|
|
86
|
+
}
|
|
81
87
|
|
|
88
|
+
exports.collectGraphqlDocument = collectGraphqlDocument;
|
|
82
89
|
exports.getOperationSpanName = getOperationSpanName;
|
|
83
90
|
exports.hasResultErrors = hasResultErrors;
|
|
84
|
-
exports.redactGraphqlDocument = redactGraphqlDocument;
|
|
85
91
|
exports.renameRootSpanWithOperation = renameRootSpanWithOperation;
|
|
86
92
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/graphql/utils.ts"],"sourcesContent":["import { SENTRY_GRAPHQL_OPERATION } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport { isObjectLike, getRootSpan, spanToJSON } from '@sentry/core';\n\n// Same key the OTel path uses, so renames stay consistent across both.\nconst ORIGINAL_DESCRIPTION_ATTRIBUTE = 'original-description';\n\n// graphql-js token kinds whose values may carry user data (literal arguments). We\n// replace them in the serialized document so raw inline values can never reach\n// `graphql.document`. Mirrors the legacy OTel instrumentation's redaction set.\nconst REDACTED_LITERAL_KINDS = new Set(['Int', 'Float', 'String', 'BlockString']);\n\n/** Minimal shape of a graphql-js lexer token, enough to locate literal spans for redaction. */\ninterface GraphqlToken {\n kind: string;\n start: number;\n end: number;\n next?: GraphqlToken | null;\n}\n\n/** Minimal shape of a parsed graphql-js `DocumentNode`, enough to read its source and tokens. */\nexport interface GraphqlDocumentNode {\n loc?: {\n startToken?: GraphqlToken;\n source?: { body?: string };\n };\n}\n\n/**\n * Rename the enclosing root span to include the operation name(s), e.g. `GET /graphql (query GetUser)`.\n * Mirrors the legacy OTel `useOperationNameForRootSpan` behavior; `parseSpanDescription` reads the same\n * `sentry.graphql.operation` attribute on the OTel export path.\n */\nexport function renameRootSpanWithOperation(span: Span, operationType: string, operationName?: string): void {\n const rootSpan = getRootSpan(span);\n // Nothing to rename if the operation span is itself the root (graphql ran outside any span).\n if (rootSpan === span) {\n return;\n }\n\n const rootSpanJson = spanToJSON(rootSpan);\n\n const newOperation = operationName ? `${operationType} ${operationName}` : operationType;\n\n // A single operation is stored as a string, multiple as an array.\n const existingOperations = rootSpanJson.data[SENTRY_GRAPHQL_OPERATION];\n let operations: string | string[];\n if (Array.isArray(existingOperations)) {\n operations = [...(existingOperations as string[]), newOperation];\n } else if (typeof existingOperations === 'string') {\n operations = [existingOperations, newOperation];\n } else {\n operations = newOperation;\n }\n rootSpan.setAttribute(SENTRY_GRAPHQL_OPERATION, operations);\n\n // Keep the pre-rename name so repeated renames don't compound.\n const originalDescription =\n (rootSpanJson.data[ORIGINAL_DESCRIPTION_ATTRIBUTE] as string | undefined) ?? rootSpanJson.description;\n if (!rootSpanJson.data[ORIGINAL_DESCRIPTION_ATTRIBUTE]) {\n rootSpan.setAttribute(ORIGINAL_DESCRIPTION_ATTRIBUTE, originalDescription);\n }\n\n rootSpan.updateName(`${originalDescription} (${getGraphqlOperationNamesFromAttribute(operations)})`);\n}\n\n/** Format the accumulated operations for the root span name: up to 5 sorted names, then `+N`. */\nfunction getGraphqlOperationNamesFromAttribute(attr: string | string[]): string {\n if (Array.isArray(attr)) {\n // oxlint-disable-next-line typescript/require-array-sort-compare\n const sorted = attr.slice().sort();\n if (sorted.length <= 5) {\n return sorted.join(', ');\n }\n\n return `${sorted.slice(0, 5).join(', ')}, +${sorted.length - 5}`;\n }\n\n return attr;\n}\n\n/**\n * Span name follows the GraphQL semantic conventions: `<operation.type> <operation.name>` when both\n * are available, `<operation.type>` when only the type is, otherwise a static fallback.\n */\nexport function getOperationSpanName(\n operationType: string | undefined,\n operationName: string | undefined,\n fallbackName: string,\n): string {\n if (operationType && operationName) {\n return `${operationType} ${operationName}`;\n }\n if (operationType) {\n return operationType;\n }\n\n return fallbackName;\n}\n\n/** Whether a graphql execution result carries GraphQL errors (returned on `result.errors`). */\nexport function hasResultErrors(result: unknown): boolean {\n if (isObjectLike(result) && 'errors' in result) {\n const errors = (result as { errors?: unknown }).errors;\n\n return Array.isArray(errors) && errors.length > 0;\n }\n\n return false;\n}\n\n/**\n * Serialize a parsed document into `graphql.document` while redacting every literal argument value:\n * the original source text is preserved verbatim except that string/number literal spans are\n * replaced (`\"foo\"` -> `\"*\"`, `42` -> `*`). graphql does not sanitize its channel payload, so this\n * prevents raw inline values (potential PII) from leaving the process. Variable values are never\n * included. Returns `undefined` (rather than throwing) on anything it cannot serialize.\n */\
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/graphql/utils.ts"],"sourcesContent":["import { SENTRY_GRAPHQL_OPERATION } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport { getClient, isObjectLike, getRootSpan, spanToJSON } from '@sentry/core';\n\n// Same key the OTel path uses, so renames stay consistent across both.\nconst ORIGINAL_DESCRIPTION_ATTRIBUTE = 'original-description';\n\n// graphql-js token kinds whose values may carry user data (literal arguments). We\n// replace them in the serialized document so raw inline values can never reach\n// `graphql.document`. Mirrors the legacy OTel instrumentation's redaction set.\nconst REDACTED_LITERAL_KINDS = new Set(['Int', 'Float', 'String', 'BlockString']);\n\n/** Minimal shape of a graphql-js lexer token, enough to locate literal spans for redaction. */\ninterface GraphqlToken {\n kind: string;\n start: number;\n end: number;\n next?: GraphqlToken | null;\n}\n\n/** Minimal shape of a parsed graphql-js `DocumentNode`, enough to read its source and tokens. */\nexport interface GraphqlDocumentNode {\n loc?: {\n startToken?: GraphqlToken;\n source?: { body?: string };\n };\n}\n\n/**\n * Rename the enclosing root span to include the operation name(s), e.g. `GET /graphql (query GetUser)`.\n * Mirrors the legacy OTel `useOperationNameForRootSpan` behavior; `parseSpanDescription` reads the same\n * `sentry.graphql.operation` attribute on the OTel export path.\n */\nexport function renameRootSpanWithOperation(span: Span, operationType: string, operationName?: string): void {\n const rootSpan = getRootSpan(span);\n // Nothing to rename if the operation span is itself the root (graphql ran outside any span).\n if (rootSpan === span) {\n return;\n }\n\n const rootSpanJson = spanToJSON(rootSpan);\n\n const newOperation = operationName ? `${operationType} ${operationName}` : operationType;\n\n // A single operation is stored as a string, multiple as an array.\n const existingOperations = rootSpanJson.data[SENTRY_GRAPHQL_OPERATION];\n let operations: string | string[];\n if (Array.isArray(existingOperations)) {\n operations = [...(existingOperations as string[]), newOperation];\n } else if (typeof existingOperations === 'string') {\n operations = [existingOperations, newOperation];\n } else {\n operations = newOperation;\n }\n rootSpan.setAttribute(SENTRY_GRAPHQL_OPERATION, operations);\n\n // Keep the pre-rename name so repeated renames don't compound.\n const originalDescription =\n (rootSpanJson.data[ORIGINAL_DESCRIPTION_ATTRIBUTE] as string | undefined) ?? rootSpanJson.description;\n if (!rootSpanJson.data[ORIGINAL_DESCRIPTION_ATTRIBUTE]) {\n rootSpan.setAttribute(ORIGINAL_DESCRIPTION_ATTRIBUTE, originalDescription);\n }\n\n rootSpan.updateName(`${originalDescription} (${getGraphqlOperationNamesFromAttribute(operations)})`);\n}\n\n/** Format the accumulated operations for the root span name: up to 5 sorted names, then `+N`. */\nfunction getGraphqlOperationNamesFromAttribute(attr: string | string[]): string {\n if (Array.isArray(attr)) {\n // oxlint-disable-next-line typescript/require-array-sort-compare\n const sorted = attr.slice().sort();\n if (sorted.length <= 5) {\n return sorted.join(', ');\n }\n\n return `${sorted.slice(0, 5).join(', ')}, +${sorted.length - 5}`;\n }\n\n return attr;\n}\n\n/**\n * Span name follows the GraphQL semantic conventions: `<operation.type> <operation.name>` when both\n * are available, `<operation.type>` when only the type is, otherwise a static fallback.\n */\nexport function getOperationSpanName(\n operationType: string | undefined,\n operationName: string | undefined,\n fallbackName: string,\n): string {\n if (operationType && operationName) {\n return `${operationType} ${operationName}`;\n }\n if (operationType) {\n return operationType;\n }\n\n return fallbackName;\n}\n\n/** Whether a graphql execution result carries GraphQL errors (returned on `result.errors`). */\nexport function hasResultErrors(result: unknown): boolean {\n if (isObjectLike(result) && 'errors' in result) {\n const errors = (result as { errors?: unknown }).errors;\n\n return Array.isArray(errors) && errors.length > 0;\n }\n\n return false;\n}\n\n/**\n * Serialize a parsed document into `graphql.document` while redacting every literal argument value:\n * the original source text is preserved verbatim except that string/number literal spans are\n * replaced (`\"foo\"` -> `\"*\"`, `42` -> `*`). graphql does not sanitize its channel payload, so this\n * prevents raw inline values (potential PII) from leaving the process. Variable values are never\n * included. Returns `undefined` (rather than throwing) on anything it cannot serialize.\n */\nfunction redactGraphqlDocument(document: GraphqlDocumentNode | undefined): string | undefined {\n const loc = document?.loc;\n const body = loc?.source?.body;\n if (typeof body !== 'string' || !loc?.startToken) {\n return undefined;\n }\n\n try {\n // Collect literal token spans, then splice them out back-to-front so earlier offsets stay valid.\n const ranges: Array<{ start: number; end: number; kind: string }> = [];\n for (let token: GraphqlToken | null | undefined = loc.startToken; token; token = token.next) {\n if (REDACTED_LITERAL_KINDS.has(token.kind)) {\n ranges.push({ start: token.start, end: token.end, kind: token.kind });\n }\n }\n\n let out = body;\n // Reverse index loop (not `for...of`) so we splice back-to-front; `i` is bounded by the loop, so\n // `ranges[i]` is always present and the `!` just satisfies `noUncheckedIndexedAccess`.\n for (let i = ranges.length - 1; i >= 0; i--) {\n const { start, end, kind } = ranges[i]!;\n const replacement = kind === 'String' || kind === 'BlockString' ? '\"*\"' : '*';\n out = out.slice(0, start) + replacement + out.slice(end);\n }\n\n return out;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Returns the redacted document if `dataCollection.graphQL.document` is enabled, `undefined` otherwise.\n */\nexport function collectGraphqlDocument(document: GraphqlDocumentNode | undefined): string | undefined {\n if (getClient()?.getDataCollectionOptions().graphQL.document !== true) {\n return undefined;\n }\n return redactGraphqlDocument(document);\n}\n"],"names":["getRootSpan","spanToJSON","SENTRY_GRAPHQL_OPERATION","isObjectLike","getClient"],"mappings":";;;;;AAKA,MAAM,8BAAA,GAAiC,sBAAA;AAKvC,MAAM,sBAAA,uBAA6B,GAAA,CAAI,CAAC,OAAO,OAAA,EAAS,QAAA,EAAU,aAAa,CAAC,CAAA;AAuBzE,SAAS,2BAAA,CAA4B,IAAA,EAAY,aAAA,EAAuB,aAAA,EAA8B;AAC3G,EAAA,MAAM,QAAA,GAAWA,iBAAY,IAAI,CAAA;AAEjC,EAAA,IAAI,aAAa,IAAA,EAAM;AACrB,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,YAAA,GAAeC,gBAAW,QAAQ,CAAA;AAExC,EAAA,MAAM,eAAe,aAAA,GAAgB,CAAA,EAAG,aAAa,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA,GAAK,aAAA;AAG3E,EAAA,MAAM,kBAAA,GAAqB,YAAA,CAAa,IAAA,CAAKC,mCAAwB,CAAA;AACrE,EAAA,IAAI,UAAA;AACJ,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,kBAAkB,CAAA,EAAG;AACrC,IAAA,UAAA,GAAa,CAAC,GAAI,kBAAA,EAAiC,YAAY,CAAA;AAAA,EACjE,CAAA,MAAA,IAAW,OAAO,kBAAA,KAAuB,QAAA,EAAU;AACjD,IAAA,UAAA,GAAa,CAAC,oBAAoB,YAAY,CAAA;AAAA,EAChD,CAAA,MAAO;AACL,IAAA,UAAA,GAAa,YAAA;AAAA,EACf;AACA,EAAA,QAAA,CAAS,YAAA,CAAaA,qCAA0B,UAAU,CAAA;AAG1D,EAAA,MAAM,mBAAA,GACH,YAAA,CAAa,IAAA,CAAK,8BAA8B,KAA4B,YAAA,CAAa,WAAA;AAC5F,EAAA,IAAI,CAAC,YAAA,CAAa,IAAA,CAAK,8BAA8B,CAAA,EAAG;AACtD,IAAA,QAAA,CAAS,YAAA,CAA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AQ,aAAa,IAAA,EAAM;AACrE,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,sBAAsB,QAAQ,CAAA;AACvC;;;;;;;"}
|
package/build/cjs/index.js
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const index$1 = require('./graphql/index.js');
|
|
4
|
-
const index$
|
|
5
|
-
const
|
|
6
|
-
const index$4 = require('./
|
|
4
|
+
const index$3 = require('./mongoose/index.js');
|
|
5
|
+
const mongodbSpan = require('./mongodb/mongodb-span.js');
|
|
6
|
+
const index$4 = require('./mysql2/index.js');
|
|
7
|
+
const index$2 = require('./prisma/index.js');
|
|
8
|
+
const index$5 = require('./redis/index.js');
|
|
7
9
|
const redisStatementSerializer = require('./redis/redis-statement-serializer.js');
|
|
8
10
|
const tracingChannel = require('./tracing-channel.js');
|
|
9
|
-
const index$
|
|
11
|
+
const index$6 = require('./vercel-ai/index.js');
|
|
10
12
|
const index = require('./integrations/tracing-channel/fastify/index.js');
|
|
13
|
+
const mongooseLegacySpan = require('./mongoose/mongoose-legacy-span.js');
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
exports.graphqlIntegration = index$1.graphqlIntegration;
|
|
15
|
-
exports.mongooseIntegration = index$
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
+
exports.mongooseIntegration = index$3.mongooseIntegration;
|
|
19
|
+
exports.getV3CommandOperation = mongodbSpan.getV3CommandOperation;
|
|
20
|
+
exports.getV3SpanAttributes = mongodbSpan.getV3SpanAttributes;
|
|
21
|
+
exports.getV4SpanAttributes = mongodbSpan.getV4SpanAttributes;
|
|
22
|
+
exports.startMongoSpan = mongodbSpan.startMongoSpan;
|
|
23
|
+
exports.mysql2Integration = index$4.mysql2Integration;
|
|
24
|
+
exports.instrumentPrisma = index$2.instrumentPrisma;
|
|
25
|
+
exports.prismaIntegration = index$2.prismaIntegration;
|
|
26
|
+
exports.redisIntegration = index$5.redisIntegration;
|
|
18
27
|
exports.defaultDbStatementSerializer = redisStatementSerializer.defaultDbStatementSerializer;
|
|
19
28
|
exports.bindTracingChannelToSpan = tracingChannel.bindTracingChannelToSpan;
|
|
20
|
-
exports.vercelAiIntegration = index$
|
|
29
|
+
exports.vercelAiIntegration = index$6.vercelAiIntegration;
|
|
21
30
|
exports.fastifyIntegration = index.fastifyIntegration;
|
|
22
31
|
exports.handleFastifyError = index.handleFastifyError;
|
|
23
32
|
exports.instrumentFastify = index.instrumentFastify;
|
|
33
|
+
exports.startMongooseLegacySpan = mongooseLegacySpan.startMongooseLegacySpan;
|
|
24
34
|
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const AWS_SDK_ORIGIN = "auto.aws.orchestrion.aws_sdk";
|
|
4
|
+
const DB_SYSTEM_VALUE_DYNAMODB = "dynamodb";
|
|
5
|
+
const ATTR_MESSAGING_DESTINATION_KIND = "messaging.destination_kind";
|
|
6
|
+
const MESSAGING_DESTINATION_KIND_VALUE_TOPIC = "topic";
|
|
7
|
+
const GEN_AI_OPERATION_NAME_VALUE_CHAT = "chat";
|
|
8
|
+
const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = "aws.bedrock";
|
|
9
|
+
|
|
10
|
+
exports.ATTR_MESSAGING_DESTINATION_KIND = ATTR_MESSAGING_DESTINATION_KIND;
|
|
11
|
+
exports.AWS_SDK_ORIGIN = AWS_SDK_ORIGIN;
|
|
12
|
+
exports.DB_SYSTEM_VALUE_DYNAMODB = DB_SYSTEM_VALUE_DYNAMODB;
|
|
13
|
+
exports.GEN_AI_OPERATION_NAME_VALUE_CHAT = GEN_AI_OPERATION_NAME_VALUE_CHAT;
|
|
14
|
+
exports.GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = GEN_AI_SYSTEM_VALUE_AWS_BEDROCK;
|
|
15
|
+
exports.MESSAGING_DESTINATION_KIND_VALUE_TOPIC = MESSAGING_DESTINATION_KIND_VALUE_TOPIC;
|
|
16
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../src/integrations/tracing-channel/aws-sdk/constants.ts"],"sourcesContent":["/**\n * AWS-specific span constants used by the aws-sdk channel integration that are NOT covered by\n * `@sentry/conventions/attributes` (attribute names that exist there are imported from there\n * directly). These are either Sentry-specific (the span origin), attribute *values* (not keys), or\n * obsolete OTel conventions with no `@sentry/conventions` export.\n */\n\n/** The span origin every aws-sdk channel span carries, mirroring the uniform OTel `auto.otel.aws`. */\nexport const AWS_SDK_ORIGIN = 'auto.aws.orchestrion.aws_sdk';\n\n/** DynamoDB `db.system` value (an attribute value, not a key, so not covered by conventions). */\nexport const DB_SYSTEM_VALUE_DYNAMODB = 'dynamodb';\n\n// Messaging (obsolete OTel convention with no `@sentry/conventions` export, kept for parity)\n// TODO(v11): import from `@sentry/conventions` once a release including it ships (added in\n// getsentry/sentry-conventions#509), and drop this local constant.\nexport const ATTR_MESSAGING_DESTINATION_KIND = 'messaging.destination_kind';\nexport const MESSAGING_DESTINATION_KIND_VALUE_TOPIC = 'topic';\n\n// Bedrock (gen_ai) attribute values (not keys, so not covered by conventions)\nexport const GEN_AI_OPERATION_NAME_VALUE_CHAT = 'chat';\nexport const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = 'aws.bedrock';\n"],"names":[],"mappings":";;AAQO,MAAM,cAAA,GAAiB;AAGvB,MAAM,wBAAA,GAA2B;AAKjC,MAAM,+BAAA,GAAkC;AACxC,MAAM,sCAAA,GAAyC;AAG/C,MAAM,gCAAA,GAAmC;AACzC,MAAM,+BAAA,GAAkC;;;;;;;;;"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
6
|
+
const debugBuild = require('../../../debug-build.js');
|
|
7
|
+
const channels = require('../../../orchestrion/channels.js');
|
|
8
|
+
const tracingChannel = require('../../../tracing-channel.js');
|
|
9
|
+
const constants = require('./constants.js');
|
|
10
|
+
const ServicesExtensions = require('./services/ServicesExtensions.js');
|
|
11
|
+
const utils = require('./utils.js');
|
|
12
|
+
|
|
13
|
+
const INTEGRATION_NAME = "Aws";
|
|
14
|
+
function safe(fn) {
|
|
15
|
+
try {
|
|
16
|
+
return fn();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
debugBuild.DEBUG_BUILD && core.debug.warn("[orchestrion:aws-sdk] error building span", error);
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function setMetadataAttributes(span, metadata) {
|
|
23
|
+
if (!metadata) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (metadata.requestId) {
|
|
27
|
+
span.setAttribute(attributes._AWS_REQUEST_ID, metadata.requestId);
|
|
28
|
+
}
|
|
29
|
+
if (metadata.httpStatusCode) {
|
|
30
|
+
span.setAttribute(attributes.HTTP_STATUS_CODE, metadata.httpStatusCode);
|
|
31
|
+
}
|
|
32
|
+
if (metadata.extendedRequestId) {
|
|
33
|
+
span.setAttribute(attributes.AWS_REQUEST_EXTENDED_ID, metadata.extendedRequestId);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const _awsChannelIntegration = (() => {
|
|
37
|
+
const servicesExtensions = new ServicesExtensions.ServicesExtensions();
|
|
38
|
+
return {
|
|
39
|
+
name: INTEGRATION_NAME,
|
|
40
|
+
setupOnce() {
|
|
41
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const getSpan = (data) => safe(() => {
|
|
45
|
+
const command = data.arguments[0];
|
|
46
|
+
const commandName = command?.constructor?.name;
|
|
47
|
+
if (!command || !commandName) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
const clientConfig = data.self?.config;
|
|
51
|
+
const serviceName = clientConfig?.serviceId ?? // `clientName` isn't available at the `send` boundary; fall back to the client's
|
|
52
|
+
// constructor name (e.g. `S3Client` -> `S3`). `serviceId` is set for all AWS clients.
|
|
53
|
+
utils.removeSuffixFromStringIfExists(data.self?.constructor?.name || "AWS", "Client");
|
|
54
|
+
if (!command.input) {
|
|
55
|
+
command.input = {};
|
|
56
|
+
}
|
|
57
|
+
const normalizedRequest = utils.normalizeV3Request(serviceName, commandName, command.input, void 0);
|
|
58
|
+
const requestMetadata = servicesExtensions.requestPreSpanHook(normalizedRequest);
|
|
59
|
+
const span = core.startInactiveSpan({
|
|
60
|
+
name: requestMetadata.spanName ?? `${normalizedRequest.serviceName}.${normalizedRequest.commandName}`,
|
|
61
|
+
kind: requestMetadata.spanKind ?? core.SPAN_KIND.CLIENT,
|
|
62
|
+
// `rpc` matches what the exporter infers from `rpc.service` for the OTel aws-sdk spans;
|
|
63
|
+
// service extensions override it where inference yields a different op (DynamoDB: `db`).
|
|
64
|
+
op: requestMetadata.spanOp || "rpc",
|
|
65
|
+
attributes: {
|
|
66
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: constants.AWS_SDK_ORIGIN,
|
|
67
|
+
...utils.extractAttributesFromNormalizedRequest(normalizedRequest),
|
|
68
|
+
...requestMetadata.spanAttributes
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
data._sentryNormalizedRequest = normalizedRequest;
|
|
72
|
+
data._sentryRequestMetadata = requestMetadata;
|
|
73
|
+
let regionResult;
|
|
74
|
+
try {
|
|
75
|
+
regionResult = clientConfig?.region?.();
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
const regionHolder = {
|
|
79
|
+
settled: false,
|
|
80
|
+
promise: Promise.resolve(regionResult).then((region) => {
|
|
81
|
+
if (region) {
|
|
82
|
+
normalizedRequest.region = region;
|
|
83
|
+
span.setAttribute(attributes.CLOUD_REGION, region);
|
|
84
|
+
}
|
|
85
|
+
}).catch(() => {
|
|
86
|
+
}).finally(() => {
|
|
87
|
+
regionHolder.settled = true;
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
data._sentryRegion = regionHolder;
|
|
91
|
+
safe(() => servicesExtensions.requestPostSpanHook(normalizedRequest, span));
|
|
92
|
+
return span;
|
|
93
|
+
});
|
|
94
|
+
const opts = {
|
|
95
|
+
deferSpanEnd({ span, data, end }) {
|
|
96
|
+
const normalizedRequest = data._sentryNormalizedRequest;
|
|
97
|
+
const requestMetadata = data._sentryRequestMetadata;
|
|
98
|
+
if (!normalizedRequest) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
const failed = "error" in data;
|
|
102
|
+
safe(() => {
|
|
103
|
+
if (failed) {
|
|
104
|
+
const err = data.error;
|
|
105
|
+
const errMetadata = err?.$metadata;
|
|
106
|
+
setMetadataAttributes(span, {
|
|
107
|
+
requestId: err?.RequestId ?? errMetadata?.requestId,
|
|
108
|
+
httpStatusCode: errMetadata?.httpStatusCode,
|
|
109
|
+
extendedRequestId: err?.extendedRequestId ?? errMetadata?.extendedRequestId
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const output = data.result;
|
|
114
|
+
setMetadataAttributes(span, output?.$metadata);
|
|
115
|
+
const normalizedResponse = {
|
|
116
|
+
data: output,
|
|
117
|
+
request: normalizedRequest,
|
|
118
|
+
requestId: output?.$metadata?.requestId
|
|
119
|
+
};
|
|
120
|
+
servicesExtensions.responseHook(normalizedResponse, span);
|
|
121
|
+
});
|
|
122
|
+
if (requestMetadata?.isStream && !failed) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
const region = data._sentryRegion;
|
|
126
|
+
if (region && !region.settled) {
|
|
127
|
+
void region.promise.then(() => end());
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const awsSendChannels = [
|
|
134
|
+
channels.CHANNELS.AWS_SMITHY_CORE_SEND,
|
|
135
|
+
channels.CHANNELS.AWS_SMITHY_CLIENT_SEND,
|
|
136
|
+
channels.CHANNELS.AWS_SDK_SMITHY_CLIENT_SEND
|
|
137
|
+
];
|
|
138
|
+
debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:aws-sdk] subscribing to channels "${awsSendChannels.join('", "')}"`);
|
|
139
|
+
core.waitForTracingChannelBinding(() => {
|
|
140
|
+
for (const channelName of awsSendChannels) {
|
|
141
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
142
|
+
diagnosticsChannel.tracingChannel(channelName),
|
|
143
|
+
getSpan,
|
|
144
|
+
opts
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
const awsChannelIntegration = core.defineIntegration(_awsChannelIntegration);
|
|
152
|
+
|
|
153
|
+
exports.awsChannelIntegration = awsChannelIntegration;
|
|
154
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/aws-sdk/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport {\n _AWS_REQUEST_ID as AWS_REQUEST_ID,\n AWS_REQUEST_EXTENDED_ID,\n CLOUD_REGION,\n HTTP_STATUS_CODE,\n} from '@sentry/conventions/attributes';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport type { TracingChannelLifeCycleOptions } from '../../../tracing-channel';\nimport { bindTracingChannelToSpan } from '../../../tracing-channel';\nimport { AWS_SDK_ORIGIN } from './constants';\nimport { ServicesExtensions } from './services';\nimport type { NormalizedRequest, NormalizedResponse, RequestMetadata } from './types';\nimport { extractAttributesFromNormalizedRequest, normalizeV3Request, removeSuffixFromStringIfExists } from './utils';\n\n// Same name as the OTel `Aws` integration by design, so enabling injection swaps this in for it.\nconst INTEGRATION_NAME = 'Aws' as const;\n\n// The context orchestrion's transform attaches to the channel: `arguments` is the live args of the\n// wrapped `Client.prototype.send` call (`[command, ...]`), `self` the client, `result`/`error` the\n// settled value. The `_sentry*` fields are stashed by us across the call's lifecycle.\ninterface AwsSendChannelContext {\n arguments: unknown[];\n self?: { config?: AwsClientConfig; constructor?: { name?: string } };\n result?: unknown;\n error?: unknown;\n _sentryNormalizedRequest?: NormalizedRequest;\n _sentryRequestMetadata?: RequestMetadata;\n _sentryRegion?: { settled: boolean; promise: Promise<void> };\n}\n\ninterface AwsClientConfig {\n serviceId?: string;\n region?: () => string | Promise<string> | undefined;\n}\n\ninterface AwsV3Command {\n input?: Record<string, unknown>;\n constructor?: { name?: string };\n}\n\n/** Runs a span-building callback so a throw inside it can never break the user's aws-sdk call. */\nfunction safe<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[orchestrion:aws-sdk] error building span', error);\n return undefined;\n }\n}\n\n// `metadata` is smithy's `ResponseMetadata`, read off the untyped channel result/error (`any` for the\n// same reason as `CommandInput`, see types.ts).\nfunction setMetadataAttributes(span: Span, metadata: Record<string, any> | undefined): void {\n if (!metadata) {\n return;\n }\n if (metadata.requestId) {\n // oxlint-disable-next-line typescript/no-deprecated\n span.setAttribute(AWS_REQUEST_ID, metadata.requestId);\n }\n if (metadata.httpStatusCode) {\n // oxlint-disable-next-line typescript/no-deprecated\n span.setAttribute(HTTP_STATUS_CODE, metadata.httpStatusCode);\n }\n if (metadata.extendedRequestId) {\n // oxlint-disable-next-line typescript/no-deprecated\n span.setAttribute(AWS_REQUEST_EXTENDED_ID, metadata.extendedRequestId);\n }\n}\n\nconst _awsChannelIntegration = (() => {\n const servicesExtensions = new ServicesExtensions();\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n const getSpan = (data: AwsSendChannelContext): Span | undefined =>\n safe(() => {\n const command = data.arguments[0] as AwsV3Command | undefined;\n const commandName = command?.constructor?.name;\n if (!command || !commandName) {\n // Not a recognizable v3 command call; leave the active context untouched.\n return undefined;\n }\n\n const clientConfig = data.self?.config;\n const serviceName =\n clientConfig?.serviceId ??\n // `clientName` isn't available at the `send` boundary; fall back to the client's\n // constructor name (e.g. `S3Client` -> `S3`). `serviceId` is set for all AWS clients.\n removeSuffixFromStringIfExists(data.self?.constructor?.name || 'AWS', 'Client');\n\n // Commands with all-optional members can be constructed without an input (`new\n // ListBucketsCommand()`); the OTel path traces those too, so default rather than bail.\n // The default is assigned back onto the command (not kept detached) because service hooks\n // mutate `commandInput` (trace-propagation headers, `MessageAttributeNames`) and those\n // writes must reach the serialized request. Current smithy clients already default `input`\n // to `{}` in the command constructor; this only affects older clients in our range.\n if (!command.input) {\n command.input = {};\n }\n const normalizedRequest = normalizeV3Request(serviceName, commandName, command.input, undefined);\n const requestMetadata = servicesExtensions.requestPreSpanHook(normalizedRequest);\n\n const span = startInactiveSpan({\n name: requestMetadata.spanName ?? `${normalizedRequest.serviceName}.${normalizedRequest.commandName}`,\n kind: requestMetadata.spanKind ?? SPAN_KIND.CLIENT,\n // `rpc` matches what the exporter infers from `rpc.service` for the OTel aws-sdk spans;\n // service extensions override it where inference yields a different op (DynamoDB: `db`).\n op: requestMetadata.spanOp || 'rpc',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: AWS_SDK_ORIGIN,\n ...extractAttributesFromNormalizedRequest(normalizedRequest),\n ...requestMetadata.spanAttributes,\n },\n });\n\n data._sentryNormalizedRequest = normalizedRequest;\n data._sentryRequestMetadata = requestMetadata;\n\n // `region` resolves asynchronously while `send` proceeds (a channel subscriber cannot delay\n // the traced call the way the OTel middleware does). Backfill it onto the span and the\n // normalized request once available; `deferSpanEnd` holds the span open until this settles\n // so `cloud.region` cannot be lost when `send` settles first (e.g. an early failure).\n //\n // The provider call is guarded separately: the span is already started, so a synchronous\n // throw bubbling into the enclosing `safe` would discard it without ending it (a leaked\n // open span).\n let regionResult: string | Promise<string> | undefined;\n try {\n regionResult = clientConfig?.region?.();\n } catch {\n // Nothing to do; continue without a region.\n }\n // The `.finally` self-reference is safe: the callback only runs after initialization.\n const regionHolder: { settled: boolean; promise: Promise<void> } = {\n settled: false,\n promise: Promise.resolve(regionResult)\n .then(region => {\n if (region) {\n normalizedRequest.region = region;\n span.setAttribute(CLOUD_REGION, region);\n }\n })\n .catch(() => {\n // Nothing to do; continue without a region.\n })\n .finally(() => {\n regionHolder.settled = true;\n }),\n };\n data._sentryRegion = regionHolder;\n\n // Inject trace-propagation headers into outgoing messages (SQS/SNS/Lambda). Runs before\n // `send` proceeds, so the mutated `commandInput` is used to build the request.\n safe(() => servicesExtensions.requestPostSpanHook(normalizedRequest, span));\n\n return span;\n });\n\n const opts: TracingChannelLifeCycleOptions<AwsSendChannelContext> = {\n deferSpanEnd({ span, data, end }) {\n const normalizedRequest = data._sentryNormalizedRequest;\n const requestMetadata = data._sentryRequestMetadata;\n if (!normalizedRequest) {\n return false;\n }\n\n const failed = 'error' in data;\n\n // The channel `result`/`error` are untyped; the `$metadata` casts below name smithy's\n // `ResponseMetadata` shape (`any`-valued, see `setMetadataAttributes`).\n safe(() => {\n if (failed) {\n const err = data.error as\n | { $metadata?: Record<string, any>; RequestId?: string; extendedRequestId?: string }\n | undefined;\n const errMetadata = err?.$metadata;\n // Like the OTel path, read RequestId/extendedRequestId off the error itself, with\n // `$metadata` (which smithy service errors also carry) as the fallback. A spread won't\n // do: `$metadata` includes these keys with `undefined` values, clobbering the fallback.\n setMetadataAttributes(span, {\n requestId: err?.RequestId ?? errMetadata?.requestId,\n httpStatusCode: errMetadata?.httpStatusCode,\n extendedRequestId: err?.extendedRequestId ?? errMetadata?.extendedRequestId,\n });\n return;\n }\n\n const output = data.result as { $metadata?: Record<string, any> } | undefined;\n setMetadataAttributes(span, output?.$metadata);\n\n const normalizedResponse: NormalizedResponse = {\n data: output,\n request: normalizedRequest,\n requestId: output?.$metadata?.requestId,\n };\n servicesExtensions.responseHook(normalizedResponse, span);\n });\n\n // Streaming responses end the span when their wrapped stream is consumed (see\n // bedrock-runtime); the helper must not end it on `send` settling. Errors always end here.\n if (requestMetadata?.isStream && !failed) {\n return true;\n }\n\n // Normally the region settles long before `send` does (the SDK awaits it internally to\n // build the endpoint), but when `send` settles first (e.g. an early failure) hold the span\n // open until the region backfill lands. The error status was already applied by the\n // helper's `error` subscriber, so a plain `end()` suffices.\n const region = data._sentryRegion;\n if (region && !region.settled) {\n void region.promise.then(() => end());\n return true;\n }\n\n return false;\n },\n };\n\n // The AWS SDK's `Client.prototype.send` lives in different smithy packages across versions; the\n // transform injects one channel per package. Only the package hosting the app's client fires, so\n // subscribing to all of them is safe and never double-instruments a single call.\n const awsSendChannels = [\n CHANNELS.AWS_SMITHY_CORE_SEND,\n CHANNELS.AWS_SMITHY_CLIENT_SEND,\n CHANNELS.AWS_SDK_SMITHY_CLIENT_SEND,\n ] as const;\n\n DEBUG_BUILD && debug.log(`[orchestrion:aws-sdk] subscribing to channels \"${awsSendChannels.join('\", \"')}\"`);\n\n waitForTracingChannelBinding(() => {\n for (const channelName of awsSendChannels) {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<AwsSendChannelContext>(channelName),\n getSpan,\n opts,\n );\n }\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven aws-sdk (v3) integration.\n *\n * Subscribes to the `orchestrion:@smithy/smithy-client:send` (and equivalent) diagnostics_channel\n * the orchestrion code transform injects into the AWS SDK's smithy `Client.prototype.send`, emitting\n * spans identical to the OTel `@opentelemetry/instrumentation-aws-sdk` integration (with a distinct\n * `auto.aws.orchestrion.aws_sdk` origin). Requires the orchestrion runtime hook or bundler plugin —\n * wire it up via `experimentalUseDiagnosticsChannelInjection()`.\n *\n * @experimental\n */\nexport const awsChannelIntegration = defineIntegration(_awsChannelIntegration);\n"],"names":["DEBUG_BUILD","debug","AWS_REQUEST_ID","HTTP_STATUS_CODE","AWS_REQUEST_EXTENDED_ID","ServicesExtensions","removeSuffixFromStringIfExists","normalizeV3Request","startInactiveSpan","SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","AWS_SDK_ORIGIN","extractAttributesFromNormalizedRequest","CLOUD_REGION","CHANNELS","waitForTracingChannelBinding","bindTracingChannelToSpan","defineIntegration"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,gBAAA,GAAmB,KAAA;AA0BzB,SAAS,KAAQ,EAAA,EAA4B;AAC3C,EAAA,IAAI;AACF,IAAA,OAAO,EAAA,EAAG;AAAA,EACZ,SAAS,KAAA,EAAO;AACd,IAAAA,sBAAA,IAAeC,UAAA,CAAM,IAAA,CAAK,2CAAA,EAA6C,KAAK,CAAA;AAC5E,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAIA,SAAS,qBAAA,CAAsB,MAAY,QAAA,EAAiD;AAC1F,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA;AAAA,EACF;AACA,EAAA,IAAI,SAAS,SAAA,EAAW;AAEtB,IAAA,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,MAAA,EAAQ;AACxC,YAAA,OAAO,IAAA;AAAA,UACT;AAMA,UAAA,MAAM,SAAS,IAAA,CAAK,aAAA;AACpB,UAAA,IAAI,MAAA,IAAU,CAAC,MAAA,CAAO,OAAA,EAAS;AAC7B,YAAA,KAAK,MAAA,CAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,KAAK,CAAA;AACpC,YAAA,OAAO,IAAA;AAAA,UACT;AAEA,UAAA,OAAO,KAAA;AAAA,QACT;AAAA,OACF;AAKA,MAAA,MAAM,eAAA,GAAkB;AAAA,QACtBC,iBAAA,CAAS,oBAAA;AAAA,QACTA,iBAAA,CAAS,sBAAA;AAAA,QACTA,iBAAA,CAAS;AAAA,OACX;AAEA,MAAAd,sBAAA,IAAeC,WAAM,GAAA,CAAI,CAAA,+CAAA,EAAkD,gBAAgB,IAAA,CAAK,MAAM,CAAC,CAAA,CAAA,CAAG,CAAA;AAE1G,MAAAc,iCAAA,CAA6B,MAAM;AACjC,QAAA,KAAA,MAAW,eAAe,eAAA,EAAiB;AACzC,UAAAC,uCAAA;AAAA,YACE,kBAAA,CAAmB,eAAsC,WAAW,CAAA;AAAA,YACpE,OAAA;AAAA,YACA;AAAA,WACF;AAAA,QACF;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAaO,MAAM,qBAAA,GAAwBC,uBAAkB,sBAAsB;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const debugBuild = require('../../../../debug-build.js');
|
|
5
|
+
|
|
6
|
+
const MAX_MESSAGE_ATTRIBUTES = 10;
|
|
7
|
+
const SENTRY_TRACE_HEADER = "sentry-trace";
|
|
8
|
+
const BAGGAGE_HEADER = "baggage";
|
|
9
|
+
const PROPAGATION_FIELDS = [SENTRY_TRACE_HEADER, BAGGAGE_HEADER];
|
|
10
|
+
function injectPropagationContext(attributesMap, traceData) {
|
|
11
|
+
const attributes = attributesMap ?? {};
|
|
12
|
+
const headerKeys = Object.keys(traceData);
|
|
13
|
+
if (Object.keys(attributes).length + headerKeys.length <= MAX_MESSAGE_ATTRIBUTES) {
|
|
14
|
+
for (const key of headerKeys) {
|
|
15
|
+
const value = traceData[key];
|
|
16
|
+
if (value) {
|
|
17
|
+
attributes[key] = { DataType: "String", StringValue: value };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
debugBuild.DEBUG_BUILD && core.debug.warn(
|
|
22
|
+
"[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return attributes;
|
|
26
|
+
}
|
|
27
|
+
function extractPropagationHeaders(message) {
|
|
28
|
+
const carrier = message.MessageAttributes ?? {};
|
|
29
|
+
const sentryTrace = carrier[SENTRY_TRACE_HEADER]?.StringValue ?? carrier[SENTRY_TRACE_HEADER]?.Value;
|
|
30
|
+
if (!sentryTrace) {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
sentryTrace,
|
|
35
|
+
baggage: carrier[BAGGAGE_HEADER]?.StringValue ?? carrier[BAGGAGE_HEADER]?.Value
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function addPropagationFieldsToAttributeNames(messageAttributeNames = []) {
|
|
39
|
+
return core.uniq([...messageAttributeNames, ...PROPAGATION_FIELDS]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.MAX_MESSAGE_ATTRIBUTES = MAX_MESSAGE_ATTRIBUTES;
|
|
43
|
+
exports.addPropagationFieldsToAttributeNames = addPropagationFieldsToAttributeNames;
|
|
44
|
+
exports.extractPropagationHeaders = extractPropagationHeaders;
|
|
45
|
+
exports.injectPropagationContext = injectPropagationContext;
|
|
46
|
+
//# sourceMappingURL=MessageAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageAttributes.js","sources":["../../../../../../src/integrations/tracing-channel/aws-sdk/services/MessageAttributes.ts"],"sourcesContent":["import type { SerializedTraceData } from '@sentry/core';\nimport { debug, uniq } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../../debug-build';\nimport type { SNS, SQS } from '../aws-sdk.types';\n\n// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html\nexport const MAX_MESSAGE_ATTRIBUTES = 10;\n\n// Sentry trace-propagation headers written into / read from AWS message attributes.\nconst SENTRY_TRACE_HEADER = 'sentry-trace';\nconst BAGGAGE_HEADER = 'baggage';\nconst PROPAGATION_FIELDS = [SENTRY_TRACE_HEADER, BAGGAGE_HEADER];\n\nexport interface AwsSdkContextObject {\n [key: string]: {\n StringValue?: string;\n Value?: string;\n };\n}\n\n/**\n * Inject trace-propagation headers (from `getTraceData({ span })`) into an SQS/SNS message-attribute\n * map, so the consumer can continue the trace. Respects the SQS 10-attribute quota. Mirrors the OTel\n * integration's `injectPropagationContext`, but writes Sentry's `sentry-trace`/`baggage` instead of\n * W3C headers. Callers pass the precomputed headers so batch sends serialize them only once.\n */\nexport function injectPropagationContext(\n attributesMap: SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap | undefined,\n traceData: SerializedTraceData,\n): SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap {\n const attributes = attributesMap ?? {};\n const headerKeys = Object.keys(traceData) as (keyof SerializedTraceData)[];\n\n if (Object.keys(attributes).length + headerKeys.length <= MAX_MESSAGE_ATTRIBUTES) {\n for (const key of headerKeys) {\n const value = traceData[key];\n if (value) {\n // Index-assigning into the SQS/SNS map union needs one concrete map type; the written value\n // shape is valid for both.\n (attributes as SQS.MessageBodyAttributeMap)[key] = { DataType: 'String', StringValue: value };\n }\n }\n } else {\n DEBUG_BUILD &&\n debug.warn(\n '[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes',\n );\n }\n return attributes;\n}\n\n/** Read the propagation headers back off a received SQS message, if present. */\nexport function extractPropagationHeaders(\n message: SQS.Message,\n): { sentryTrace?: string; baggage?: string } | undefined {\n const carrier = (message.MessageAttributes ?? {}) as AwsSdkContextObject;\n const sentryTrace = carrier[SENTRY_TRACE_HEADER]?.StringValue ?? carrier[SENTRY_TRACE_HEADER]?.Value;\n if (!sentryTrace) {\n return undefined;\n }\n return {\n sentryTrace,\n baggage: carrier[BAGGAGE_HEADER]?.StringValue ?? carrier[BAGGAGE_HEADER]?.Value,\n };\n}\n\nexport function addPropagationFieldsToAttributeNames(messageAttributeNames: string[] = []): string[] {\n return uniq([...messageAttributeNames, ...PROPAGATION_FIELDS]);\n}\n"],"names":["DEBUG_BUILD","debug","uniq"],"mappings":";;;;;AAMO,MAAM,sBAAA,GAAyB;AAGtC,MAAM,mBAAA,GAAsB,cAAA;AAC5B,MAAM,cAAA,GAAiB,SAAA;AACvB,MAAM,kBAAA,GAAqB,CAAC,mBAAA,EAAqB,cAAc,CAAA;AAexD,SAAS,wBAAA,CACd,eACA,SAAA,EACuD;AACvD,EAAA,MAAM,UAAA,GAAa,iBAAiB,EAAC;AACrC,EAAA,MAAM,UAAA,GAAa,MAAA,CAAO,IAAA,CAAK,SAAS,CAAA;AAExC,EAAA,IAAI,OAAO,IAAA,CAAK,UAAU,EAAE,MAAA,GAAS,UAAA,CAAW,UAAU,sBAAA,EAAwB;AAChF,IAAA,KAAA,MAAW,OAAO,UAAA,EAAY;AAC5B,MAAA,MAAM,KAAA,GAAQ,UAAU,GAAG,CAAA;AAC3B,MAAA,IAAI,KAAA,EAAO;AAGT,QAAC,WAA2C,GAAG,CAAA,GAAI,EAAE,QAAA,EAAU,QAAA,EAAU,aAAa,KAAA,EAAM;AAAA,MAC9F;AAAA,IACF;AAAA,EACF,CAAA,MAAO;AACL,IAAAA,sBAAA,IACEC,UAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KACF;AAAA,EACJ;AACA,EAAA,OAAO,UAAA;AACT;AAGO,SAAS,0BACd,OAAA,EACwD;AACxD,EAAA,MAAM,OAAA,GAAW,OAAA,CAAQ,iBAAA,IAAqB,EAAC;AAC/C,EAAA,MAAM,cAAc,OAAA,CAAQ,mBAAmB,GAAG,WAAA,IAAe,OAAA,CAAQ,mBAAmB,CAAA,EAAG,KAAA;AAC/F,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO;AAAA,IACL,WAAA;AAAA,IACA,SAAS,OAAA,CAAQ,cAAc,GAAG,WAAA,IAAe,OAAA,CAAQ,cAAc,CAAA,EAAG;AAAA,GAC5E;AACF;AAEO,SAAS,oCAAA,CAAqC,qBAAA,GAAkC,EAAC,EAAa;AACnG,EAAA,OAAOC,UAAK,CAAC,GAAG,qBAAA,EAAuB,GAAG,kBAAkB,CAAC,CAAA;AAC/D;;;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const bedrockRuntime = require('./bedrock-runtime.js');
|
|
4
|
+
const dynamodb = require('./dynamodb.js');
|
|
5
|
+
const kinesis = require('./kinesis.js');
|
|
6
|
+
const lambda = require('./lambda.js');
|
|
7
|
+
const s3 = require('./s3.js');
|
|
8
|
+
const secretsmanager = require('./secretsmanager.js');
|
|
9
|
+
const sns = require('./sns.js');
|
|
10
|
+
const sqs = require('./sqs.js');
|
|
11
|
+
const stepfunctions = require('./stepfunctions.js');
|
|
12
|
+
|
|
13
|
+
class ServicesExtensions {
|
|
14
|
+
constructor() {
|
|
15
|
+
// Per-service extensions, keyed by the client's `serviceId` (e.g. `'S3'`). Services without a
|
|
16
|
+
// registered extension still get the base rpc span from the subscriber.
|
|
17
|
+
this._services = /* @__PURE__ */ new Map([
|
|
18
|
+
["SecretsManager", new secretsmanager.SecretsManagerServiceExtension()],
|
|
19
|
+
["SFN", new stepfunctions.StepFunctionsServiceExtension()],
|
|
20
|
+
["SQS", new sqs.SqsServiceExtension()],
|
|
21
|
+
["SNS", new sns.SnsServiceExtension()],
|
|
22
|
+
["DynamoDB", new dynamodb.DynamodbServiceExtension()],
|
|
23
|
+
["Lambda", new lambda.LambdaServiceExtension()],
|
|
24
|
+
["S3", new s3.S3ServiceExtension()],
|
|
25
|
+
["Kinesis", new kinesis.KinesisServiceExtension()],
|
|
26
|
+
["BedrockRuntime", new bedrockRuntime.BedrockRuntimeServiceExtension()]
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
requestPreSpanHook(request) {
|
|
30
|
+
const serviceExtension = this._services.get(request.serviceName);
|
|
31
|
+
if (!serviceExtension) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
return serviceExtension.requestPreSpanHook(request);
|
|
35
|
+
}
|
|
36
|
+
requestPostSpanHook(request, span) {
|
|
37
|
+
const serviceExtension = this._services.get(request.serviceName);
|
|
38
|
+
serviceExtension?.requestPostSpanHook?.(request, span);
|
|
39
|
+
}
|
|
40
|
+
responseHook(response, span) {
|
|
41
|
+
const serviceExtension = this._services.get(response.request.serviceName);
|
|
42
|
+
serviceExtension?.responseHook?.(response, span);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.ServicesExtensions = ServicesExtensions;
|
|
47
|
+
//# sourceMappingURL=ServicesExtensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServicesExtensions.js","sources":["../../../../../../src/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport type { NormalizedRequest, NormalizedResponse, RequestMetadata } from '../types';\nimport { BedrockRuntimeServiceExtension } from './bedrock-runtime';\nimport { DynamodbServiceExtension } from './dynamodb';\nimport { KinesisServiceExtension } from './kinesis';\nimport { LambdaServiceExtension } from './lambda';\nimport { S3ServiceExtension } from './s3';\nimport { SecretsManagerServiceExtension } from './secretsmanager';\nimport type { ServiceExtension } from './ServiceExtension';\nimport { SnsServiceExtension } from './sns';\nimport { SqsServiceExtension } from './sqs';\nimport { StepFunctionsServiceExtension } from './stepfunctions';\n\nexport class ServicesExtensions implements ServiceExtension {\n // Per-service extensions, keyed by the client's `serviceId` (e.g. `'S3'`). Services without a\n // registered extension still get the base rpc span from the subscriber.\n private _services: Map<string, ServiceExtension> = new Map<string, ServiceExtension>([\n ['SecretsManager', new SecretsManagerServiceExtension()],\n ['SFN', new StepFunctionsServiceExtension()],\n ['SQS', new SqsServiceExtension()],\n ['SNS', new SnsServiceExtension()],\n ['DynamoDB', new DynamodbServiceExtension()],\n ['Lambda', new LambdaServiceExtension()],\n ['S3', new S3ServiceExtension()],\n ['Kinesis', new KinesisServiceExtension()],\n ['BedrockRuntime', new BedrockRuntimeServiceExtension()],\n ]);\n\n public requestPreSpanHook(request: NormalizedRequest): RequestMetadata {\n const serviceExtension = this._services.get(request.serviceName);\n if (!serviceExtension) {\n return {};\n }\n return serviceExtension.requestPreSpanHook(request);\n }\n\n public requestPostSpanHook(request: NormalizedRequest, span: Span): void {\n const serviceExtension = this._services.get(request.serviceName);\n serviceExtension?.requestPostSpanHook?.(request, span);\n }\n\n public responseHook(response: NormalizedResponse, span: Span): void {\n const serviceExtension = this._services.get(response.request.serviceName);\n serviceExtension?.responseHook?.(response, span);\n }\n}\n"],"names":["SecretsManagerServiceExtension","StepFunctionsServiceExtension","SqsServiceExtension","SnsServiceExtension","DynamodbServiceExtension","LambdaServiceExtension","S3ServiceExtension","KinesisServiceExtension","BedrockRuntimeServiceExtension"],"mappings":";;;;;;;;;;;;AAaO,MAAM,kBAAA,CAA+C;AAAA,EAArD,WAAA,GAAA;AAGL;AAAA;AAAA,IAAA,IAAA,CAAQ,SAAA,uBAA+C,GAAA,CAA8B;AAAA,MACnF,CAAC,gBAAA,EAAkB,IAAIA,6CAAA,EAAgC,CAAA;AAAA,MACvD,CAAC,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