@sentry/server-utils 11.10.0 → 11.12.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/LICENSE +31 -0
- package/build/THIRD-PARTY-LICENSES.txt +34 -34
- package/build/cjs/ai/anthropic-ai/streaming.js +4 -1
- package/build/cjs/ai/anthropic-ai/streaming.js.map +1 -1
- package/build/cjs/ai/anthropic-ai/tool-runner.js +49 -1
- package/build/cjs/ai/anthropic-ai/tool-runner.js.map +1 -1
- package/build/cjs/ai/anthropic-ai/utils.js +8 -1
- package/build/cjs/ai/anthropic-ai/utils.js.map +1 -1
- package/build/cjs/ai/flue/index.js +5 -7
- package/build/cjs/ai/flue/index.js.map +1 -1
- package/build/cjs/ai/flue/utils.js +4 -4
- package/build/cjs/ai/flue/utils.js.map +1 -1
- package/build/cjs/ai/google-genai/index.js +6 -1
- package/build/cjs/ai/google-genai/index.js.map +1 -1
- package/build/cjs/ai/google-genai/streaming.js +4 -1
- package/build/cjs/ai/google-genai/streaming.js.map +1 -1
- package/build/cjs/ai/langchain/utils.js +11 -10
- package/build/cjs/ai/langchain/utils.js.map +1 -1
- package/build/cjs/ai/langgraph/agent-span.js +94 -0
- package/build/cjs/ai/langgraph/agent-span.js.map +1 -0
- package/build/cjs/ai/langgraph/index.js +79 -119
- package/build/cjs/ai/langgraph/index.js.map +1 -1
- package/build/cjs/ai/langgraph/stream.js +117 -0
- package/build/cjs/ai/langgraph/stream.js.map +1 -0
- package/build/cjs/ai/langgraph/utils.js +1 -1
- package/build/cjs/ai/langgraph/utils.js.map +1 -1
- package/build/cjs/ai/mastra/utils.js.map +1 -1
- package/build/cjs/ai/openai/streaming.js +3 -0
- package/build/cjs/ai/openai/streaming.js.map +1 -1
- package/build/cjs/ai/pi-durable/index.js +1 -1
- package/build/cjs/ai/pi-durable/index.js.map +1 -1
- package/build/cjs/ai/pi-durable/models.js +6 -6
- package/build/cjs/ai/pi-durable/models.js.map +1 -1
- package/build/cjs/ai/pi-durable/tools.js +2 -2
- package/build/cjs/ai/pi-durable/tools.js.map +1 -1
- package/build/cjs/ai/typesafe/index.js +1 -1
- package/build/cjs/ai/typesafe/index.js.map +1 -1
- package/build/cjs/index.js +29 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.no-diagnostic-channels.js +8 -5
- package/build/cjs/index.no-diagnostic-channels.js.map +1 -1
- package/build/cjs/index.request-handler.js +8 -0
- package/build/cjs/index.request-handler.js.map +1 -0
- package/build/cjs/integrations/amqplib.js +4 -6
- package/build/cjs/integrations/amqplib.js.map +1 -1
- package/build/cjs/integrations/anthropic.js +8 -0
- package/build/cjs/integrations/anthropic.js.map +1 -1
- package/build/cjs/integrations/aws-sdk/index.js +1 -0
- package/build/cjs/integrations/aws-sdk/index.js.map +1 -1
- package/build/cjs/integrations/aws-sdk/services/bedrock-runtime.js +105 -52
- package/build/cjs/integrations/aws-sdk/services/bedrock-runtime.js.map +1 -1
- package/build/cjs/integrations/cron.js +49 -0
- package/build/cjs/integrations/cron.js.map +1 -0
- package/build/cjs/integrations/dataloader.js +2 -5
- package/build/cjs/integrations/dataloader.js.map +1 -1
- package/build/cjs/integrations/express/instrumentation.js +1 -1
- package/build/cjs/integrations/express/instrumentation.js.map +1 -1
- package/build/cjs/integrations/firebase/firestore.js +1 -0
- package/build/cjs/integrations/firebase/firestore.js.map +1 -1
- package/build/cjs/integrations/google-genai.js +9 -3
- package/build/cjs/integrations/google-genai.js.map +1 -1
- package/build/cjs/integrations/graphql/constants.js +0 -2
- package/build/cjs/integrations/graphql/constants.js.map +1 -1
- package/build/cjs/integrations/graphql/graphql-dc-subscriber.js +4 -4
- package/build/cjs/integrations/graphql/graphql-dc-subscriber.js.map +1 -1
- package/build/cjs/integrations/graphql/resolvers.js +1 -1
- package/build/cjs/integrations/graphql/resolvers.js.map +1 -1
- package/build/cjs/integrations/graphql/spans.js +3 -3
- package/build/cjs/integrations/graphql/spans.js.map +1 -1
- package/build/cjs/integrations/hono/constants.js +2 -0
- package/build/cjs/integrations/hono/constants.js.map +1 -1
- package/build/cjs/integrations/hono/createHonoMiddleware.js +2 -3
- package/build/cjs/integrations/hono/createHonoMiddleware.js.map +1 -1
- package/build/cjs/integrations/hono/honoIntegration.js +12 -12
- package/build/cjs/integrations/hono/honoIntegration.js.map +1 -1
- package/build/cjs/integrations/hono/matchResult.js +67 -0
- package/build/cjs/integrations/hono/matchResult.js.map +1 -1
- package/build/cjs/integrations/hono/middlewareHandlers.js +15 -5
- package/build/cjs/integrations/hono/middlewareHandlers.js.map +1 -1
- package/build/cjs/integrations/hono/patchAppRequest.js +2 -6
- package/build/cjs/integrations/hono/patchAppRequest.js.map +1 -1
- package/build/cjs/integrations/hono/patchRoute.js +2 -6
- package/build/cjs/integrations/hono/patchRoute.js.map +1 -1
- package/build/cjs/integrations/hono/resolveRouteName.js +16 -18
- package/build/cjs/integrations/hono/resolveRouteName.js.map +1 -1
- package/build/cjs/integrations/hono/sentryOriginalTraps.js +21 -0
- package/build/cjs/integrations/hono/sentryOriginalTraps.js.map +1 -0
- package/build/cjs/integrations/hono/wrapMiddlewareSpan.js +4 -8
- package/build/cjs/integrations/hono/wrapMiddlewareSpan.js.map +1 -1
- package/build/cjs/integrations/index.js +6 -6
- package/build/cjs/integrations/index.js.map +1 -1
- package/build/cjs/integrations/kafkajs/consumer.js +3 -3
- package/build/cjs/integrations/kafkajs/consumer.js.map +1 -1
- package/build/cjs/integrations/kafkajs/semconv.js +0 -8
- package/build/cjs/integrations/kafkajs/semconv.js.map +1 -1
- package/build/cjs/integrations/kafkajs/spans.js +6 -6
- package/build/cjs/integrations/kafkajs/spans.js.map +1 -1
- package/build/cjs/integrations/knex.js +3 -33
- package/build/cjs/integrations/knex.js.map +1 -1
- package/build/cjs/integrations/langgraph.js +6 -20
- package/build/cjs/integrations/langgraph.js.map +1 -1
- package/build/cjs/integrations/mongodb/index.js +21 -31
- package/build/cjs/integrations/mongodb/index.js.map +1 -1
- package/build/cjs/integrations/mongodb/mongodb-span.js +3 -2
- package/build/cjs/integrations/mongodb/mongodb-span.js.map +1 -1
- package/build/cjs/integrations/mysql.js +14 -20
- package/build/cjs/integrations/mysql.js.map +1 -1
- package/build/cjs/integrations/mysql2/index.js +12 -23
- package/build/cjs/integrations/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/mysql2/mysql2-dc-subscriber.js +26 -42
- package/build/cjs/integrations/mysql2/mysql2-dc-subscriber.js.map +1 -1
- package/build/cjs/integrations/neon.js +27 -27
- package/build/cjs/integrations/neon.js.map +1 -1
- package/build/cjs/integrations/nitro/captureStorageEvents.js +3 -3
- package/build/cjs/integrations/nitro/captureStorageEvents.js.map +1 -1
- package/build/cjs/integrations/nitro/captureTracingEvents.js +1 -1
- package/build/cjs/integrations/nitro/captureTracingEvents.js.map +1 -1
- package/build/cjs/integrations/node-cron.js +68 -0
- package/build/cjs/integrations/node-cron.js.map +1 -0
- package/build/cjs/integrations/node-schedule.js +76 -0
- package/build/cjs/integrations/node-schedule.js.map +1 -0
- package/build/cjs/integrations/{postgres.js → pg.js} +13 -21
- package/build/cjs/integrations/pg.js.map +1 -0
- package/build/cjs/integrations/postgresjs/index.js +147 -0
- package/build/cjs/integrations/postgresjs/index.js.map +1 -0
- package/build/cjs/integrations/postgresjs/postgresjs-dc-subscriber.js +81 -0
- package/build/cjs/integrations/postgresjs/postgresjs-dc-subscriber.js.map +1 -0
- package/build/cjs/integrations/{postgresjs.js → postgresjs-wrapper.js} +66 -73
- package/build/cjs/integrations/postgresjs-wrapper.js.map +1 -0
- package/build/cjs/integrations/prisma/orchestrion.js +2 -5
- package/build/cjs/integrations/prisma/orchestrion.js.map +1 -1
- package/build/cjs/integrations/prisma/tracing-helper.js +15 -13
- package/build/cjs/integrations/prisma/tracing-helper.js.map +1 -1
- package/build/cjs/integrations/redis/ioredis-channel-subscriber.js +13 -17
- package/build/cjs/integrations/redis/ioredis-channel-subscriber.js.map +1 -1
- package/build/cjs/integrations/serveTunnel.js +33 -0
- package/build/cjs/integrations/serveTunnel.js.map +1 -0
- package/build/cjs/integrations/tedious.js +9 -6
- package/build/cjs/integrations/tedious.js.map +1 -1
- package/build/cjs/integrations/vercel-ai/vercel-ai-dc-subscriber.js +47 -14
- package/build/cjs/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js +1 -1
- package/build/cjs/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
- package/build/cjs/orchestrion/bundler/load-hook.js +2 -2
- package/build/cjs/orchestrion/bundler/load-hook.js.map +1 -1
- package/build/cjs/orchestrion/bundler/options.js.map +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +2 -2
- package/build/cjs/orchestrion/bundler/vite.js +86 -27
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/bundler/webpack.js +1 -1
- package/build/cjs/orchestrion/bundler/webpack.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +6 -0
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js +6 -5
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/cjs/orchestrion/config/cron.js +26 -0
- package/build/cjs/orchestrion/config/cron.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +6 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/mistral.js +1 -1
- package/build/cjs/orchestrion/config/mistral.js.map +1 -1
- package/build/cjs/orchestrion/config/nestjs.js +8 -0
- package/build/cjs/orchestrion/config/nestjs.js.map +1 -1
- package/build/cjs/orchestrion/config/node-cron.js +53 -0
- package/build/cjs/orchestrion/config/node-cron.js.map +1 -0
- package/build/cjs/orchestrion/config/node-schedule.js +29 -0
- package/build/cjs/orchestrion/config/node-schedule.js.map +1 -0
- package/build/cjs/orchestrion/config/postgres.js +5 -1
- package/build/cjs/orchestrion/config/postgres.js.map +1 -1
- package/build/cjs/orchestrion/detect.js +16 -3
- package/build/cjs/orchestrion/detect.js.map +1 -1
- package/build/cjs/orchestrion/instrumentation.js +5 -5
- package/build/cjs/orchestrion/instrumentation.js.map +1 -1
- package/build/cjs/tracing-channel.js +3 -4
- package/build/cjs/tracing-channel.js.map +1 -1
- package/build/cjs/utils/cronMonitoring.js +160 -0
- package/build/cjs/utils/cronMonitoring.js.map +1 -0
- package/build/cjs/utils/diagnosticsChannel.js +2 -1
- package/build/cjs/utils/diagnosticsChannel.js.map +1 -1
- package/build/cjs/utils/monitorStream.js +27 -6
- package/build/cjs/utils/monitorStream.js.map +1 -1
- package/build/cjs/utils/runtime.js +19 -0
- package/build/cjs/utils/runtime.js.map +1 -0
- package/build/cjs/utils/sql.js +51 -5
- package/build/cjs/utils/sql.js.map +1 -1
- package/build/cjs/utils/tunnelServer.js +29 -0
- package/build/cjs/utils/tunnelServer.js.map +1 -0
- package/build/cjs/utils/wrapServerRequestHandler.js +66 -25
- package/build/cjs/utils/wrapServerRequestHandler.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer/index.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer/lib/index.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer/lib/matcher.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer/lib/transformer.js +15 -15
- package/build/cjs/vendored/@apm-js-collab/code-transformer/lib/transformer.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer/lib/transforms.js +35 -7
- package/build/cjs/vendored/@apm-js-collab/code-transformer/lib/transforms.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/bun.js +4 -4
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/bun.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/{core-dC9TN3Ev.js → core-Bd0h-mo3.js} +2 -2
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/{core-dC9TN3Ev.js.map → core-Bd0h-mo3.js.map} +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/esbuild.js +3 -3
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/esbuild.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/instrumentation-serde-C-Xxv-jj.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/{rollup-OTS4ktWb.js → rollup-DCG8HLmh.js} +7 -13
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/rollup-DCG8HLmh.js.map +1 -0
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/vite.js +2 -2
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/vite.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js.map +1 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack.js.map +1 -1
- package/build/esm/ai/anthropic-ai/streaming.js +5 -2
- package/build/esm/ai/anthropic-ai/streaming.js.map +1 -1
- package/build/esm/ai/anthropic-ai/tool-runner.js +52 -4
- package/build/esm/ai/anthropic-ai/tool-runner.js.map +1 -1
- package/build/esm/ai/anthropic-ai/utils.js +9 -2
- package/build/esm/ai/anthropic-ai/utils.js.map +1 -1
- package/build/esm/ai/flue/index.js +4 -6
- package/build/esm/ai/flue/index.js.map +1 -1
- package/build/esm/ai/flue/utils.js +4 -4
- package/build/esm/ai/flue/utils.js.map +1 -1
- package/build/esm/ai/google-genai/index.js +6 -1
- package/build/esm/ai/google-genai/index.js.map +1 -1
- package/build/esm/ai/google-genai/streaming.js +4 -1
- package/build/esm/ai/google-genai/streaming.js.map +1 -1
- package/build/esm/ai/langchain/utils.js +11 -11
- package/build/esm/ai/langchain/utils.js.map +1 -1
- package/build/esm/ai/langgraph/agent-span.js +89 -0
- package/build/esm/ai/langgraph/agent-span.js.map +1 -0
- package/build/esm/ai/langgraph/index.js +73 -115
- package/build/esm/ai/langgraph/index.js.map +1 -1
- package/build/esm/ai/langgraph/stream.js +115 -0
- package/build/esm/ai/langgraph/stream.js.map +1 -0
- package/build/esm/ai/langgraph/utils.js +1 -1
- package/build/esm/ai/langgraph/utils.js.map +1 -1
- package/build/esm/ai/mastra/utils.js.map +1 -1
- package/build/esm/ai/openai/streaming.js +3 -0
- package/build/esm/ai/openai/streaming.js.map +1 -1
- package/build/esm/ai/pi-durable/index.js +1 -1
- package/build/esm/ai/pi-durable/index.js.map +1 -1
- package/build/esm/ai/pi-durable/models.js +6 -6
- package/build/esm/ai/pi-durable/models.js.map +1 -1
- package/build/esm/ai/pi-durable/tools.js +2 -2
- package/build/esm/ai/pi-durable/tools.js.map +1 -1
- package/build/esm/ai/typesafe/index.js +1 -1
- package/build/esm/ai/typesafe/index.js.map +1 -1
- package/build/esm/index.js +10 -5
- package/build/esm/index.js.map +1 -1
- package/build/esm/index.no-diagnostic-channels.js +3 -3
- package/build/esm/index.request-handler.js +2 -0
- package/build/esm/index.request-handler.js.map +1 -0
- package/build/esm/integrations/amqplib.js +5 -7
- package/build/esm/integrations/amqplib.js.map +1 -1
- package/build/esm/integrations/anthropic.js +8 -0
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/aws-sdk/index.js +1 -0
- package/build/esm/integrations/aws-sdk/index.js.map +1 -1
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js +107 -54
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js.map +1 -1
- package/build/esm/integrations/cron.js +46 -0
- package/build/esm/integrations/cron.js.map +1 -0
- package/build/esm/integrations/dataloader.js +2 -5
- package/build/esm/integrations/dataloader.js.map +1 -1
- package/build/esm/integrations/express/instrumentation.js +1 -1
- package/build/esm/integrations/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/firebase/firestore.js +1 -0
- package/build/esm/integrations/firebase/firestore.js.map +1 -1
- package/build/esm/integrations/google-genai.js +9 -3
- package/build/esm/integrations/google-genai.js.map +1 -1
- package/build/esm/integrations/graphql/constants.js +1 -2
- package/build/esm/integrations/graphql/constants.js.map +1 -1
- package/build/esm/integrations/graphql/graphql-dc-subscriber.js +2 -2
- package/build/esm/integrations/graphql/resolvers.js +2 -2
- package/build/esm/integrations/graphql/spans.js +2 -2
- package/build/esm/integrations/hono/constants.js +2 -1
- package/build/esm/integrations/hono/constants.js.map +1 -1
- package/build/esm/integrations/hono/createHonoMiddleware.js +2 -2
- package/build/esm/integrations/hono/createHonoMiddleware.js.map +1 -1
- package/build/esm/integrations/hono/honoIntegration.js +13 -13
- package/build/esm/integrations/hono/honoIntegration.js.map +1 -1
- package/build/esm/integrations/hono/matchResult.js +65 -2
- package/build/esm/integrations/hono/matchResult.js.map +1 -1
- package/build/esm/integrations/hono/middlewareHandlers.js +17 -7
- package/build/esm/integrations/hono/middlewareHandlers.js.map +1 -1
- package/build/esm/integrations/hono/patchAppRequest.js +2 -6
- package/build/esm/integrations/hono/patchAppRequest.js.map +1 -1
- package/build/esm/integrations/hono/patchRoute.js +2 -6
- package/build/esm/integrations/hono/patchRoute.js.map +1 -1
- package/build/esm/integrations/hono/resolveRouteName.js +16 -18
- package/build/esm/integrations/hono/resolveRouteName.js.map +1 -1
- package/build/esm/integrations/hono/sentryOriginalTraps.js +19 -0
- package/build/esm/integrations/hono/sentryOriginalTraps.js.map +1 -0
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js +3 -7
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js.map +1 -1
- package/build/esm/integrations/index.js +2 -2
- package/build/esm/integrations/index.js.map +1 -1
- package/build/esm/integrations/kafkajs/consumer.js +5 -5
- package/build/esm/integrations/kafkajs/consumer.js.map +1 -1
- package/build/esm/integrations/kafkajs/semconv.js +1 -5
- package/build/esm/integrations/kafkajs/semconv.js.map +1 -1
- package/build/esm/integrations/kafkajs/spans.js +8 -8
- package/build/esm/integrations/kafkajs/spans.js.map +1 -1
- package/build/esm/integrations/knex.js +6 -36
- package/build/esm/integrations/knex.js.map +1 -1
- package/build/esm/integrations/langgraph.js +7 -21
- package/build/esm/integrations/langgraph.js.map +1 -1
- package/build/esm/integrations/mongodb/index.js +21 -31
- package/build/esm/integrations/mongodb/index.js.map +1 -1
- package/build/esm/integrations/mongodb/mongodb-span.js +4 -3
- package/build/esm/integrations/mongodb/mongodb-span.js.map +1 -1
- package/build/esm/integrations/mysql.js +17 -23
- package/build/esm/integrations/mysql.js.map +1 -1
- package/build/esm/integrations/mysql2/index.js +15 -26
- package/build/esm/integrations/mysql2/index.js.map +1 -1
- package/build/esm/integrations/mysql2/mysql2-dc-subscriber.js +29 -45
- package/build/esm/integrations/mysql2/mysql2-dc-subscriber.js.map +1 -1
- package/build/esm/integrations/neon.js +27 -27
- package/build/esm/integrations/neon.js.map +1 -1
- package/build/esm/integrations/nitro/captureStorageEvents.js +4 -4
- package/build/esm/integrations/nitro/captureStorageEvents.js.map +1 -1
- package/build/esm/integrations/nitro/captureTracingEvents.js +2 -2
- package/build/esm/integrations/nitro/captureTracingEvents.js.map +1 -1
- package/build/esm/integrations/node-cron.js +63 -0
- package/build/esm/integrations/node-cron.js.map +1 -0
- package/build/esm/integrations/node-schedule.js +70 -0
- package/build/esm/integrations/node-schedule.js.map +1 -0
- package/build/esm/integrations/{postgres.js → pg.js} +16 -24
- package/build/esm/integrations/pg.js.map +1 -0
- package/build/esm/integrations/postgresjs/index.js +145 -0
- package/build/esm/integrations/postgresjs/index.js.map +1 -0
- package/build/esm/integrations/postgresjs/postgresjs-dc-subscriber.js +76 -0
- package/build/esm/integrations/postgresjs/postgresjs-dc-subscriber.js.map +1 -0
- package/build/esm/integrations/{postgresjs.js → postgresjs-wrapper.js} +68 -76
- package/build/esm/integrations/postgresjs-wrapper.js.map +1 -0
- package/build/esm/integrations/prisma/orchestrion.js +2 -5
- package/build/esm/integrations/prisma/orchestrion.js.map +1 -1
- package/build/esm/integrations/prisma/tracing-helper.js +17 -15
- package/build/esm/integrations/prisma/tracing-helper.js.map +1 -1
- package/build/esm/integrations/redis/ioredis-channel-subscriber.js +13 -17
- package/build/esm/integrations/redis/ioredis-channel-subscriber.js.map +1 -1
- package/build/esm/integrations/serveTunnel.js +30 -0
- package/build/esm/integrations/serveTunnel.js.map +1 -0
- package/build/esm/integrations/tedious.js +11 -8
- package/build/esm/integrations/tedious.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +48 -15
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
- package/build/esm/orchestrion/bundler/load-hook.js +1 -1
- package/build/esm/orchestrion/bundler/options.js.map +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +1 -1
- package/build/esm/orchestrion/bundler/vite.js +87 -28
- package/build/esm/orchestrion/bundler/vite.js.map +1 -1
- package/build/esm/orchestrion/bundler/webpack.js +1 -1
- package/build/esm/orchestrion/bundler/webpack.js.map +1 -1
- package/build/esm/orchestrion/channels.js +6 -0
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js +6 -5
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/esm/orchestrion/config/cron.js +22 -0
- package/build/esm/orchestrion/config/cron.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +6 -0
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/mistral.js +1 -1
- package/build/esm/orchestrion/config/mistral.js.map +1 -1
- package/build/esm/orchestrion/config/nestjs.js +8 -0
- package/build/esm/orchestrion/config/nestjs.js.map +1 -1
- package/build/esm/orchestrion/config/node-cron.js +49 -0
- package/build/esm/orchestrion/config/node-cron.js.map +1 -0
- package/build/esm/orchestrion/config/node-schedule.js +25 -0
- package/build/esm/orchestrion/config/node-schedule.js.map +1 -0
- package/build/esm/orchestrion/config/postgres.js +5 -1
- package/build/esm/orchestrion/config/postgres.js.map +1 -1
- package/build/esm/orchestrion/detect.js +15 -2
- package/build/esm/orchestrion/detect.js.map +1 -1
- package/build/esm/orchestrion/instrumentation.js +6 -6
- package/build/esm/orchestrion/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/tracing-channel.js +4 -5
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/utils/cronMonitoring.js +153 -0
- package/build/esm/utils/cronMonitoring.js.map +1 -0
- package/build/esm/utils/diagnosticsChannel.js +2 -1
- package/build/esm/utils/diagnosticsChannel.js.map +1 -1
- package/build/esm/utils/monitorStream.js +28 -7
- package/build/esm/utils/monitorStream.js.map +1 -1
- package/build/esm/utils/runtime.js +15 -0
- package/build/esm/utils/runtime.js.map +1 -0
- package/build/esm/utils/sql.js +48 -5
- package/build/esm/utils/sql.js.map +1 -1
- package/build/esm/utils/tunnelServer.js +27 -0
- package/build/esm/utils/tunnelServer.js.map +1 -0
- package/build/esm/utils/wrapServerRequestHandler.js +68 -27
- package/build/esm/utils/wrapServerRequestHandler.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer/index.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/index.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/matcher.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transformer.js +15 -15
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transformer.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transforms.js +35 -7
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transforms.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/bun.js +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/bun.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/{core-dC9TN3Ev.js → core-Bd0h-mo3.js} +2 -2
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/{core-dC9TN3Ev.js.map → core-Bd0h-mo3.js.map} +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/esbuild.js +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/esbuild.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/instrumentation-serde-C-Xxv-jj.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/{rollup-OTS4ktWb.js → rollup-DCG8HLmh.js} +3 -9
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/rollup-DCG8HLmh.js.map +1 -0
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/vite.js +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/vite.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js.map +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack.js.map +1 -1
- package/build/types/ai/anthropic-ai/streaming.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/tool-runner.d.ts +1 -1
- package/build/types/ai/anthropic-ai/tool-runner.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/utils.d.ts.map +1 -1
- package/build/types/ai/flue/index.d.ts.map +1 -1
- package/build/types/ai/google-genai/index.d.ts.map +1 -1
- package/build/types/ai/google-genai/streaming.d.ts +1 -1
- package/build/types/ai/google-genai/streaming.d.ts.map +1 -1
- package/build/types/ai/langchain/utils.d.ts +6 -0
- package/build/types/ai/langchain/utils.d.ts.map +1 -1
- package/build/types/ai/langgraph/agent-span.d.ts +15 -0
- package/build/types/ai/langgraph/agent-span.d.ts.map +1 -0
- package/build/types/ai/langgraph/index.d.ts +7 -1
- package/build/types/ai/langgraph/index.d.ts.map +1 -1
- package/build/types/ai/langgraph/stream.d.ts +10 -0
- package/build/types/ai/langgraph/stream.d.ts.map +1 -0
- package/build/types/ai/langgraph/types.d.ts +1 -0
- package/build/types/ai/langgraph/types.d.ts.map +1 -1
- package/build/types/ai/mastra/utils.d.ts +1 -1
- package/build/types/ai/openai/streaming.d.ts.map +1 -1
- package/build/types/exports.d.ts +4 -5
- package/build/types/exports.d.ts.map +1 -1
- package/build/types/index.d.ts +10 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.request-handler.d.ts +3 -0
- package/build/types/index.request-handler.d.ts.map +1 -0
- package/build/types/integrations/amqplib.d.ts.map +1 -1
- package/build/types/integrations/anthropic.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/index.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/services/bedrock-runtime.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/types.d.ts +2 -0
- package/build/types/integrations/aws-sdk/types.d.ts.map +1 -1
- package/build/types/integrations/cron.d.ts +16 -0
- package/build/types/integrations/cron.d.ts.map +1 -0
- package/build/types/integrations/dataloader.d.ts.map +1 -1
- package/build/types/integrations/firebase/firestore.d.ts.map +1 -1
- package/build/types/integrations/google-genai.d.ts.map +1 -1
- package/build/types/integrations/graphql/constants.d.ts +1 -1
- package/build/types/integrations/graphql/constants.d.ts.map +1 -1
- package/build/types/integrations/hono/constants.d.ts +1 -0
- package/build/types/integrations/hono/constants.d.ts.map +1 -1
- package/build/types/integrations/hono/createHonoMiddleware.d.ts +0 -1
- package/build/types/integrations/hono/createHonoMiddleware.d.ts.map +1 -1
- package/build/types/integrations/hono/honoIntegration.d.ts.map +1 -1
- package/build/types/integrations/hono/matchResult.d.ts +21 -4
- package/build/types/integrations/hono/matchResult.d.ts.map +1 -1
- package/build/types/integrations/hono/middlewareHandlers.d.ts +1 -2
- package/build/types/integrations/hono/middlewareHandlers.d.ts.map +1 -1
- package/build/types/integrations/hono/patchAppRequest.d.ts.map +1 -1
- package/build/types/integrations/hono/patchRoute.d.ts.map +1 -1
- package/build/types/integrations/hono/resolveRouteName.d.ts +4 -7
- package/build/types/integrations/hono/resolveRouteName.d.ts.map +1 -1
- package/build/types/integrations/hono/sentryOriginalTraps.d.ts +9 -0
- package/build/types/integrations/hono/sentryOriginalTraps.d.ts.map +1 -0
- package/build/types/integrations/hono/wrapMiddlewareSpan.d.ts.map +1 -1
- package/build/types/integrations/kafkajs/semconv.d.ts +1 -4
- package/build/types/integrations/kafkajs/semconv.d.ts.map +1 -1
- package/build/types/integrations/knex.d.ts.map +1 -1
- package/build/types/integrations/langgraph.d.ts.map +1 -1
- package/build/types/integrations/mongodb/index.d.ts.map +1 -1
- package/build/types/integrations/mongodb/mongodb-span.d.ts.map +1 -1
- package/build/types/integrations/mysql.d.ts.map +1 -1
- package/build/types/integrations/mysql2/index.d.ts.map +1 -1
- package/build/types/integrations/mysql2/mysql2-dc-subscriber.d.ts.map +1 -1
- package/build/types/integrations/neon.d.ts.map +1 -1
- package/build/types/integrations/nitro/captureStorageEvents.d.ts.map +1 -1
- package/build/types/integrations/node-cron.d.ts +26 -0
- package/build/types/integrations/node-cron.d.ts.map +1 -0
- package/build/types/integrations/node-schedule.d.ts +25 -0
- package/build/types/integrations/node-schedule.d.ts.map +1 -0
- package/build/types/integrations/{postgres.d.ts → pg.d.ts} +1 -1
- package/build/types/integrations/pg.d.ts.map +1 -0
- package/build/types/integrations/{postgres-js.d.ts → postgresjs/index.d.ts} +11 -8
- package/build/types/integrations/postgresjs/index.d.ts.map +1 -0
- package/build/types/integrations/postgresjs/postgresjs-dc-subscriber.d.ts +48 -0
- package/build/types/integrations/postgresjs/postgresjs-dc-subscriber.d.ts.map +1 -0
- package/build/types/integrations/{postgresjs.d.ts → postgresjs-wrapper.d.ts} +23 -9
- package/build/types/integrations/postgresjs-wrapper.d.ts.map +1 -0
- package/build/types/integrations/prisma/orchestrion.d.ts.map +1 -1
- package/build/types/integrations/prisma/tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/redis/ioredis-channel-subscriber.d.ts.map +1 -1
- package/build/types/integrations/serveTunnel.d.ts +14 -0
- package/build/types/integrations/serveTunnel.d.ts.map +1 -0
- package/build/types/integrations/tedious.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/options.d.ts +7 -0
- package/build/types/orchestrion/bundler/options.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +7 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -1
- package/build/types/orchestrion/config/cron.d.ts +31 -0
- package/build/types/orchestrion/config/cron.d.ts.map +1 -0
- package/build/types/orchestrion/config/generic-pool.d.ts +1 -1
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/mistral.d.ts +3 -3
- package/build/types/orchestrion/config/nestjs.d.ts +1 -0
- package/build/types/orchestrion/config/nestjs.d.ts.map +1 -1
- package/build/types/orchestrion/config/node-cron.d.ts +19 -0
- package/build/types/orchestrion/config/node-cron.d.ts.map +1 -0
- package/build/types/orchestrion/config/node-schedule.d.ts +18 -0
- package/build/types/orchestrion/config/node-schedule.d.ts.map +1 -0
- package/build/types/orchestrion/config/pg.d.ts +1 -1
- package/build/types/orchestrion/config/postgres.d.ts.map +1 -1
- package/build/types/orchestrion/detect.d.ts.map +1 -1
- package/build/types/orchestrion/instrumentation.d.ts.map +1 -1
- package/build/types/tracing-channel.d.ts +1 -6
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/build/types/utils/cronMonitoring.d.ts +39 -0
- package/build/types/utils/cronMonitoring.d.ts.map +1 -0
- package/build/types/utils/diagnosticsChannel.d.ts.map +1 -1
- package/build/types/utils/monitorStream.d.ts +7 -1
- package/build/types/utils/monitorStream.d.ts.map +1 -1
- package/build/types/utils/runtime.d.ts +7 -0
- package/build/types/utils/runtime.d.ts.map +1 -0
- package/build/types/utils/sql.d.ts +31 -7
- package/build/types/utils/sql.d.ts.map +1 -1
- package/build/types/utils/tunnelServer.d.ts +10 -0
- package/build/types/utils/tunnelServer.d.ts.map +1 -0
- package/build/types/utils/wrapServerRequestHandler.d.ts +9 -2
- package/build/types/utils/wrapServerRequestHandler.d.ts.map +1 -1
- package/package.json +33 -25
- package/build/cjs/integrations/postgres-js.js +0 -200
- package/build/cjs/integrations/postgres-js.js.map +0 -1
- package/build/cjs/integrations/postgres.js.map +0 -1
- package/build/cjs/integrations/postgresjs.js.map +0 -1
- package/build/cjs/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/rollup-OTS4ktWb.js.map +0 -1
- package/build/esm/integrations/postgres-js.js +0 -198
- package/build/esm/integrations/postgres-js.js.map +0 -1
- package/build/esm/integrations/postgres.js.map +0 -1
- package/build/esm/integrations/postgresjs.js.map +0 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/rollup-OTS4ktWb.js.map +0 -1
- package/build/types/integrations/postgres-js.d.ts.map +0 -1
- package/build/types/integrations/postgres.d.ts.map +0 -1
- package/build/types/integrations/postgresjs.d.ts.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('../../utils/diagnosticsChannel.js');
|
|
4
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
5
|
+
const op = require('@sentry/conventions/op');
|
|
6
|
+
const core = require('@sentry/core');
|
|
7
|
+
const debugBuild = require('../../debug-build.js');
|
|
8
|
+
const sql = require('../../utils/sql.js');
|
|
9
|
+
const postgresjsWrapper = require('../postgresjs-wrapper.js');
|
|
10
|
+
const channels = require('../../orchestrion/channels.js');
|
|
11
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
12
|
+
const postgres = require('../../orchestrion/config/postgres.js');
|
|
13
|
+
const instrumentation = require('../../orchestrion/instrumentation.js');
|
|
14
|
+
const postgresjsDcSubscriber = require('./postgresjs-dc-subscriber.js');
|
|
15
|
+
|
|
16
|
+
const INTEGRATION_NAME = "PostgresJs";
|
|
17
|
+
const ORIGIN = "auto.db.postgresjs";
|
|
18
|
+
const DB_SYSTEM_NAME_POSTGRES = "postgres";
|
|
19
|
+
const NOOP = () => {
|
|
20
|
+
};
|
|
21
|
+
const QUERY_FROM_INSTRUMENTED_SQL = /* @__PURE__ */ Symbol.for("sentry.query.from.instrumented.sql");
|
|
22
|
+
const QUERY_SPAN = /* @__PURE__ */ Symbol("sentryPostgresJsSpan");
|
|
23
|
+
const SPAN_ENDED = /* @__PURE__ */ Symbol("sentryPostgresJsSpanEnded");
|
|
24
|
+
const connectionContexts = /* @__PURE__ */ new WeakMap();
|
|
25
|
+
const endpointRegistry = [];
|
|
26
|
+
function registerEndpoint(context) {
|
|
27
|
+
const alreadyKnown = endpointRegistry.some(
|
|
28
|
+
(e) => e.ATTR_SERVER_ADDRESS === context.ATTR_SERVER_ADDRESS && e.ATTR_SERVER_PORT === context.ATTR_SERVER_PORT && e.ATTR_DB_NAMESPACE === context.ATTR_DB_NAMESPACE
|
|
29
|
+
);
|
|
30
|
+
if (!alreadyKnown) {
|
|
31
|
+
endpointRegistry.push(context);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function resolveSingleEndpoint() {
|
|
35
|
+
return endpointRegistry.length === 1 ? endpointRegistry[0] : void 0;
|
|
36
|
+
}
|
|
37
|
+
function recordConnectionFromChannel(message) {
|
|
38
|
+
const connection = message.result;
|
|
39
|
+
const options = message.arguments?.[0];
|
|
40
|
+
if (!connection || typeof connection !== "object" || !options) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const context = postgresjsWrapper._buildConnectionContext(options);
|
|
44
|
+
connectionContexts.set(connection, context);
|
|
45
|
+
registerEndpoint(context);
|
|
46
|
+
}
|
|
47
|
+
function attachConnectionAttributesFromChannel(message) {
|
|
48
|
+
const connection = message.self;
|
|
49
|
+
const query = message.arguments?.[0];
|
|
50
|
+
if (!connection || !query) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const span = query[QUERY_SPAN];
|
|
54
|
+
const context = connectionContexts.get(connection);
|
|
55
|
+
if (span && context) {
|
|
56
|
+
span.setAttributes(postgresjsWrapper._getConnectionAttributes(context));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const _postgresJsIntegration = ((options = {}) => {
|
|
60
|
+
return {
|
|
61
|
+
name: INTEGRATION_NAME,
|
|
62
|
+
setupOnce() {
|
|
63
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
core.waitForTracingChannelBinding(() => {
|
|
67
|
+
postgresjsDcSubscriber.subscribePostgresJsDiagnosticChannels(diagnosticsChannel.tracingChannel, options);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
setup(client) {
|
|
71
|
+
instrumentation.invokeOrchestrionInstrumentation(client, postgres.postgresJsModuleNames, instrumentPostgresJs, [options]);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
function instrumentPostgresJs(options) {
|
|
76
|
+
const { requireParentSpan, requestHook } = options;
|
|
77
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.POSTGRESJS_CONNECTION).subscribe({
|
|
78
|
+
start: NOOP,
|
|
79
|
+
asyncStart: NOOP,
|
|
80
|
+
asyncEnd: NOOP,
|
|
81
|
+
error: NOOP,
|
|
82
|
+
end: recordConnectionFromChannel
|
|
83
|
+
});
|
|
84
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.POSTGRESJS_EXECUTE).subscribe({
|
|
85
|
+
end: NOOP,
|
|
86
|
+
asyncStart: NOOP,
|
|
87
|
+
asyncEnd: NOOP,
|
|
88
|
+
error: NOOP,
|
|
89
|
+
start: attachConnectionAttributesFromChannel
|
|
90
|
+
});
|
|
91
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.POSTGRESJS_CONNECT).subscribe({
|
|
92
|
+
end: NOOP,
|
|
93
|
+
asyncStart: NOOP,
|
|
94
|
+
asyncEnd: NOOP,
|
|
95
|
+
error: NOOP,
|
|
96
|
+
start: attachConnectionAttributesFromChannel
|
|
97
|
+
});
|
|
98
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
99
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.POSTGRESJS_HANDLE),
|
|
100
|
+
(data) => {
|
|
101
|
+
const query = data.self;
|
|
102
|
+
if (!query) {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
if (query.executed === true || query[QUERY_FROM_INSTRUMENTED_SQL]) {
|
|
106
|
+
return void 0;
|
|
107
|
+
}
|
|
108
|
+
const queryAttributes = sql.getSqlQueryAttributes(postgresjsWrapper._reconstructQuery(query.strings));
|
|
109
|
+
const context = resolveSingleEndpoint();
|
|
110
|
+
const attributes$1 = {
|
|
111
|
+
[attributes.SENTRY_OP]: op.DB,
|
|
112
|
+
[attributes.SENTRY_KIND]: "client",
|
|
113
|
+
[attributes.SENTRY_ORIGIN]: ORIGIN,
|
|
114
|
+
[attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES,
|
|
115
|
+
...queryAttributes,
|
|
116
|
+
...context && postgresjsWrapper._getConnectionAttributes(context)
|
|
117
|
+
};
|
|
118
|
+
const span = core.startInactiveSpan({
|
|
119
|
+
name: sql.getSqlSpanName(attributes$1, "postgresjs.query"),
|
|
120
|
+
onlyIfParent: requireParentSpan !== false,
|
|
121
|
+
attributes: attributes$1
|
|
122
|
+
});
|
|
123
|
+
query[QUERY_SPAN] = span;
|
|
124
|
+
if (requestHook) {
|
|
125
|
+
try {
|
|
126
|
+
requestHook(span, queryAttributes[attributes.DB_QUERY_TEXT] ?? "", context);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
span.setAttribute("sentry.hook.error", "requestHook failed");
|
|
129
|
+
debugBuild.DEBUG_BUILD && core.debug.error("[instrumentation:postgresjs] error in requestHook:", e);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
postgresjsWrapper._wrapQuerySettlement(query, span, queryAttributes[attributes.DB_OPERATION_NAME], () => {
|
|
133
|
+
data[SPAN_ENDED] = true;
|
|
134
|
+
});
|
|
135
|
+
return span;
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
deferSpanEnd({ data }) {
|
|
139
|
+
return !!data[SPAN_ENDED] || !("error" in data);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
const postgresJsIntegration = core.defineIntegration(_postgresJsIntegration);
|
|
145
|
+
|
|
146
|
+
exports.postgresJsIntegration = postgresJsIntegration;
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/postgresjs/index.ts"],"sourcesContent":["import * as diagnosticsChannel from '../../utils/diagnosticsChannel';\nimport {\n DB_OPERATION_NAME,\n DB_QUERY_TEXT,\n DB_SYSTEM_NAME,\n SENTRY_KIND,\n SENTRY_OP,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { DB } from '@sentry/conventions/op';\nimport type { IntegrationFn, Span, SpanAttributes } from '@sentry/core';\nimport { debug, defineIntegration, startInactiveSpan, waitForTracingChannelBinding } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { getSqlQueryAttributes, getSqlSpanName } from '../../utils/sql';\nimport {\n _buildConnectionContext,\n _getConnectionAttributes,\n _reconstructQuery,\n _wrapQuerySettlement,\n type PostgresConnectionContext,\n type PostgresQuerySettlement,\n} from '../postgresjs-wrapper';\nimport type { OrchestrionChannelContext } from '../../orchestrion/types';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\nimport { postgresJsModuleNames } from '../../orchestrion/config/postgres';\nimport { invokeOrchestrionInstrumentation } from '../../orchestrion/instrumentation';\nimport { subscribePostgresJsDiagnosticChannels } from './postgresjs-dc-subscriber';\n\n// Same name as the OTel `PostgresJs` integration by design, so the OTel\n// integration of the same name is deduplicated out of the default set.\nconst INTEGRATION_NAME = 'PostgresJs' as const;\n\nconst ORIGIN = 'auto.db.postgresjs';\n\nconst DB_SYSTEM_NAME_POSTGRES = 'postgres';\n\nconst NOOP = (): void => {};\n\n// Same `Symbol.for()` marker the core `instrumentPostgresJsSql` wrapper sets on\n// queries it manually instruments, so we skip them there and never double-span.\nconst QUERY_FROM_INSTRUMENTED_SQL = Symbol.for('sentry.query.from.instrumented.sql');\n// The query span, stashed on the `Query` so the `execute`/`connect` channels can\n// attach connection attributes to it.\nconst QUERY_SPAN = Symbol('sentryPostgresJsSpan');\n// Set on the channel context once the resolve/reject wrappers have ended the\n// span, so `deferSpanEnd` knows the wrappers own the lifecycle.\nconst SPAN_ENDED = Symbol('sentryPostgresJsSpanEnded');\n\nexport interface PostgresJsIntegrationOptions {\n /**\n * Only create spans when there's already an active parent span. Defaults to\n * `true`, matching the OTel `postgresJsIntegration`.\n */\n requireParentSpan?: boolean;\n /**\n * Hook to modify the query span before the query runs. Receives the span, the\n * sanitized SQL, and (when resolvable) the connection context.\n */\n requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;\n}\n\n/** The `Query` instance postgres.js passes as `self` to `Query.prototype.handle`. */\ninterface PostgresQuery extends PostgresQuerySettlement {\n strings?: string[];\n executed?: boolean;\n}\n\ninterface PostgresJsQueryContext extends OrchestrionChannelContext {\n self?: PostgresQuery;\n [SPAN_ENDED]?: boolean;\n}\n\n// A connection object -> its resolved context, populated on the `connection`\n// channel and read on the `execute`/`connect` channels (keyed by the same object).\nconst connectionContexts = new WeakMap<object, PostgresConnectionContext>();\n// Distinct endpoints seen so far (value-compared, so N connections to one DB\n// count once). When exactly one endpoint exists — the common case, and the only\n// one the tests exercise — every query resolves to it at handle-start.\nconst endpointRegistry: PostgresConnectionContext[] = [];\n\nfunction registerEndpoint(context: PostgresConnectionContext): void {\n const alreadyKnown = endpointRegistry.some(\n e =>\n e.ATTR_SERVER_ADDRESS === context.ATTR_SERVER_ADDRESS &&\n e.ATTR_SERVER_PORT === context.ATTR_SERVER_PORT &&\n e.ATTR_DB_NAMESPACE === context.ATTR_DB_NAMESPACE,\n );\n if (!alreadyKnown) {\n endpointRegistry.push(context);\n }\n}\n\n/** The single known endpoint, or `undefined` when zero or multiple are known. */\nfunction resolveSingleEndpoint(): PostgresConnectionContext | undefined {\n return endpointRegistry.length === 1 ? endpointRegistry[0] : undefined;\n}\n\n/**\n * Record a connection from the `connection` channel `end` (`result` is the\n * connection object, `arguments[0]` the parsed options), keying its resolved\n * context by the connection object and tracking its endpoint.\n */\nfunction recordConnectionFromChannel(message: PostgresJsQueryContext): void {\n const connection = message.result;\n const options = message.arguments?.[0] as { host?: string[]; port?: number[]; database?: string } | undefined;\n if (!connection || typeof connection !== 'object' || !options) {\n return;\n }\n const context = _buildConnectionContext(options);\n connectionContexts.set(connection, context);\n registerEndpoint(context);\n}\n\n/**\n * Backfill connection attributes onto a query's span from a channel whose `self`\n * is the connection object and `arguments[0]` the query. Shared by the `execute`\n * and `connect` channels; both carry that shape and both resolve the context via\n * the `connectionContexts` WeakMap.\n */\nfunction attachConnectionAttributesFromChannel(message: PostgresJsQueryContext): void {\n const connection = message.self;\n const query = message.arguments?.[0] as PostgresQuery | undefined;\n if (!connection || !query) {\n return;\n }\n const span = (query as Record<symbol, unknown>)[QUERY_SPAN] as Span | undefined;\n const context = connectionContexts.get(connection);\n if (span && context) {\n span.setAttributes(_getConnectionAttributes(context));\n }\n}\n\nconst _postgresJsIntegration = ((options: PostgresJsIntegrationOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // postgres >= 4 publishes its own `postgres:query` tracing channel, with no orchestrion event to\n // signal that it was loaded, so subscribe eagerly.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n waitForTracingChannelBinding(() => {\n subscribePostgresJsDiagnosticChannels(diagnosticsChannel.tracingChannel, options);\n });\n },\n setup(client) {\n // postgres 3.x is covered by the orchestrion-injected channels, subscribed lazily.\n invokeOrchestrionInstrumentation(client, postgresJsModuleNames, instrumentPostgresJs, [options]);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentPostgresJs(options: PostgresJsIntegrationOptions): void {\n const { requireParentSpan, requestHook } = options;\n\n // Connection + execute are pure observers (no span, no async binding).\n diagnosticsChannel.tracingChannel<PostgresJsQueryContext>(CHANNELS.POSTGRESJS_CONNECTION).subscribe({\n start: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n end: recordConnectionFromChannel,\n });\n\n // Per-connection attributes for queries reusing an already-open connection\n // (`c.execute(q)`, `self === c`). `execute` is also called bare\n // (`self === undefined`) for the first query on each connection, `fetchState`\n // and `retry`; those miss here (the `connect` channel below covers the first\n // user query, and the single-endpoint fallback covers the common case).\n diagnosticsChannel.tracingChannel<PostgresJsQueryContext>(CHANNELS.POSTGRESJS_EXECUTE).subscribe({\n end: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n start: attachConnectionAttributesFromChannel,\n });\n\n // The connection's `connect(query)` method (`self === c`, `arguments[0]` the\n // query) fires when a fresh connection is opened for a query. That first query\n // is later dispatched via a bare `execute` (no `self`), so this is where it\n // gets its connection attributes in multi-endpoint apps.\n diagnosticsChannel.tracingChannel<PostgresJsQueryContext>(CHANNELS.POSTGRESJS_CONNECT).subscribe({\n end: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n start: attachConnectionAttributesFromChannel,\n });\n\n bindTracingChannelToSpan<PostgresJsQueryContext>(\n diagnosticsChannel.tracingChannel<PostgresJsQueryContext>(CHANNELS.POSTGRESJS_HANDLE),\n data => {\n const query = data.self;\n if (!query) {\n return undefined;\n }\n\n // Opt out of re-entrant `handle()` calls (then/catch/finally re-invoke\n // it, guarded by `executed`) and queries already wrapped by the portable\n // `instrumentPostgresJsSql`.\n if (query.executed === true || (query as Record<symbol, unknown>)[QUERY_FROM_INSTRUMENTED_SQL]) {\n return undefined;\n }\n\n const queryAttributes = getSqlQueryAttributes(_reconstructQuery(query.strings));\n\n // Single-endpoint fallback: resolve context now so the span name and `requestHook` have\n // it, and the first-query-per-connection (bare `execute`) path still gets attrs.\n const context = resolveSingleEndpoint();\n\n // `sentry.kind: client` matches the mysql/pg channel subscribers.\n const attributes: SpanAttributes = {\n [SENTRY_OP]: DB,\n [SENTRY_KIND]: 'client',\n [SENTRY_ORIGIN]: ORIGIN,\n [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES,\n ...queryAttributes,\n ...(context && _getConnectionAttributes(context)),\n };\n const span = startInactiveSpan({\n name: getSqlSpanName(attributes, 'postgresjs.query'),\n onlyIfParent: requireParentSpan !== false,\n attributes,\n });\n\n // Stash for the `execute`/`connect` channels to attach per-connection attributes.\n (query as Record<symbol, unknown>)[QUERY_SPAN] = span;\n\n if (requestHook) {\n try {\n requestHook(span, queryAttributes[DB_QUERY_TEXT] ?? '', context);\n } catch (e) {\n span.setAttribute('sentry.hook.error', 'requestHook failed');\n DEBUG_BUILD && debug.error('[instrumentation:postgresjs] error in requestHook:', e);\n }\n }\n\n // Claim ownership of ending the span up front, so `deferSpanEnd` defers to the\n // settlement wrappers even if `span.end()` throws in them.\n _wrapQuerySettlement(query, span, queryAttributes[DB_OPERATION_NAME], () => {\n data[SPAN_ENDED] = true;\n });\n\n return span;\n },\n {\n deferSpanEnd({ data }) {\n // `handle` is async: its promise settles on dispatch (asyncEnd), long\n // before the query does, so the resolve/reject wrappers own the ending.\n // The helper only ends the span if `handle()` itself threw.\n // NOTE: for a cursor consumed as an async iterator, only the first batch\n // reaches `handle` (the `executed` guard blocks the rest), so the span\n // ends on the first batch — a pre-existing flaw kept for parity.\n return !!data[SPAN_ENDED] || !('error' in data);\n },\n },\n );\n}\n\n/**\n * Diagnostics-channel-based postgres.js integration.\n *\n * - `postgres` 3.x: subscribes to the `orchestrion:postgres:handle` / `:connection` /\n * `:execute` / `:connect` channels injected into postgres.js' `Query.prototype.handle`\n * and `Connection`/`execute`/`connect` (in `src/*` and `cjs/src/*`). Requires the\n * Sentry runtime hook or bundler plugin.\n * - `postgres` >= 4.0.0: subscribes to the `postgres:query` tracing channel the library\n * publishes natively.\n *\n * Both paths create the same db spans.\n */\nexport const postgresJsIntegration = defineIntegration(_postgresJsIntegration);\n"],"names":["_buildConnectionContext","_getConnectionAttributes","diagnosticsChannel.tracingChannel","waitForTracingChannelBinding","subscribePostgresJsDiagnosticChannels","invokeOrchestrionInstrumentation","postgresJsModuleNames","CHANNELS","bindTracingChannelToSpan","getSqlQueryAttributes","_reconstructQuery","attributes","SENTRY_OP","DB","SENTRY_KIND","SENTRY_ORIGIN","DB_SYSTEM_NAME","startInactiveSpan","getSqlSpanName","DB_QUERY_TEXT","DEBUG_BUILD","debug","_wrapQuerySettlement","DB_OPERATION_NAME","defineIntegration"],"mappings":";;;;;;;;;;;;;;;AA+BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAmB,CAAA,CAA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AsB,CAAA;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
4
|
+
const op = require('@sentry/conventions/op');
|
|
5
|
+
const core = require('@sentry/core');
|
|
6
|
+
const debugBuild = require('../../debug-build.js');
|
|
7
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
8
|
+
const sql = require('../../utils/sql.js');
|
|
9
|
+
const postgresjsWrapper = require('../postgresjs-wrapper.js');
|
|
10
|
+
|
|
11
|
+
const POSTGRESJS_DC_CHANNEL_QUERY = "postgres:query";
|
|
12
|
+
const ORIGIN = "auto.db.postgresjs";
|
|
13
|
+
const DB_SYSTEM_NAME_POSTGRES = "postgres";
|
|
14
|
+
function subscribePostgresJsDiagnosticChannels(tracingChannel$1, options = {}) {
|
|
15
|
+
const { requireParentSpan, requestHook } = options;
|
|
16
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
17
|
+
tracingChannel$1(POSTGRESJS_DC_CHANNEL_QUERY),
|
|
18
|
+
(data) => {
|
|
19
|
+
if (postgresjsWrapper._isPostgresJsWrapperSpan(core.getActiveSpan())) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
const queryAttributes = sql.getSqlQueryAttributes(data.query ?? void 0);
|
|
23
|
+
const sanitizedSqlQuery = queryAttributes[attributes.DB_QUERY_TEXT] ?? "";
|
|
24
|
+
const connectionContext = getPostgresJsConnectionContext(data);
|
|
25
|
+
const attributes$1 = {
|
|
26
|
+
[attributes.SENTRY_OP]: op.DB,
|
|
27
|
+
[attributes.SENTRY_KIND]: "client",
|
|
28
|
+
[attributes.SENTRY_ORIGIN]: ORIGIN,
|
|
29
|
+
[attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES,
|
|
30
|
+
...queryAttributes,
|
|
31
|
+
...postgresjsWrapper._getConnectionAttributes(connectionContext)
|
|
32
|
+
};
|
|
33
|
+
const span = core.startInactiveSpan({
|
|
34
|
+
name: sql.getSqlSpanName(attributes$1, "postgresjs.query"),
|
|
35
|
+
onlyIfParent: requireParentSpan !== false,
|
|
36
|
+
attributes: attributes$1
|
|
37
|
+
});
|
|
38
|
+
if (requestHook) {
|
|
39
|
+
callRequestHook(requestHook, span, sanitizedSqlQuery, connectionContext);
|
|
40
|
+
}
|
|
41
|
+
return span;
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
beforeSpanEnd(span, data) {
|
|
45
|
+
span.setAttributes(getPostgresJsQueryEndAttributes(data));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function getPostgresJsConnectionContext(data) {
|
|
51
|
+
return {
|
|
52
|
+
ATTR_DB_NAMESPACE: data.database || void 0,
|
|
53
|
+
ATTR_SERVER_ADDRESS: data.host || void 0,
|
|
54
|
+
ATTR_SERVER_PORT: typeof data.port === "number" ? String(data.port) : void 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function getPostgresJsQueryEndAttributes(data) {
|
|
58
|
+
const attributes$1 = postgresjsWrapper._getConnectionAttributes(getPostgresJsConnectionContext(data));
|
|
59
|
+
if (data.command) {
|
|
60
|
+
attributes$1[attributes.DB_OPERATION_NAME] = data.command;
|
|
61
|
+
}
|
|
62
|
+
if ("error" in data) {
|
|
63
|
+
const code = core.isObjectLike(data.error) && "code" in data.error ? data.error.code : void 0;
|
|
64
|
+
attributes$1[attributes.DB_RESPONSE_STATUS_CODE] = typeof code === "string" && code ? code : "unknown";
|
|
65
|
+
}
|
|
66
|
+
return attributes$1;
|
|
67
|
+
}
|
|
68
|
+
function callRequestHook(requestHook, span, sanitizedSqlQuery, connectionContext) {
|
|
69
|
+
try {
|
|
70
|
+
requestHook(span, sanitizedSqlQuery, connectionContext);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
span.setAttribute("sentry.hook.error", "requestHook failed");
|
|
73
|
+
debugBuild.DEBUG_BUILD && core.debug.error("[instrumentation:postgresjs] error in requestHook:", e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.POSTGRESJS_DC_CHANNEL_QUERY = POSTGRESJS_DC_CHANNEL_QUERY;
|
|
78
|
+
exports.getPostgresJsConnectionContext = getPostgresJsConnectionContext;
|
|
79
|
+
exports.getPostgresJsQueryEndAttributes = getPostgresJsQueryEndAttributes;
|
|
80
|
+
exports.subscribePostgresJsDiagnosticChannels = subscribePostgresJsDiagnosticChannels;
|
|
81
|
+
//# sourceMappingURL=postgresjs-dc-subscriber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgresjs-dc-subscriber.js","sources":["../../../../src/integrations/postgresjs/postgresjs-dc-subscriber.ts"],"sourcesContent":["import type { TracingChannel } from 'node:diagnostics_channel';\nimport {\n DB_OPERATION_NAME,\n DB_QUERY_TEXT,\n DB_RESPONSE_STATUS_CODE,\n DB_SYSTEM_NAME,\n SENTRY_KIND,\n SENTRY_OP,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { DB } from '@sentry/conventions/op';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport { debug, getActiveSpan, isObjectLike, startInactiveSpan } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\nimport { getSqlQueryAttributes, getSqlSpanName } from '../../utils/sql';\nimport {\n _getConnectionAttributes,\n _isPostgresJsWrapperSpan,\n type PostgresConnectionContext,\n type PostgresJsSqlInstrumentationOptions,\n} from '../postgresjs-wrapper';\n\n/**\n * Tracing channel published by `postgres` >= 4.0.0 for every query (see postgres `src/diagnostics.js`).\n */\nexport const POSTGRESJS_DC_CHANNEL_QUERY = 'postgres:query';\n\nconst ORIGIN = 'auto.db.postgresjs';\nconst DB_SYSTEM_NAME_POSTGRES = 'postgres';\n\n/**\n * The context `postgres` >= 4.0.0 publishes on `postgres:query`. `host`, `port` and `connection`\n * stay `null` until the query is written to a connection, and `command`/`count` until it completes,\n * so they can only be read once the span ends.\n */\nexport interface PostgresJsQueryData {\n query?: string | null;\n database?: string;\n user?: string | null;\n host?: string | null;\n port?: number | null;\n command?: string | null;\n result?: unknown;\n error?: unknown;\n}\n\n/**\n * Platform-provided factory for a native tracing channel. Node passes `node:diagnostics_channel`'s\n * `tracingChannel` directly.\n */\nexport type PostgresJsTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;\n\n/**\n * Subscribe Sentry span handlers to the `postgres:query` tracing channel published natively by\n * `postgres` >= 4.0.0. Older versions never publish it, and the orchestrion transform is gated to\n * `< 4`, so no query gets two spans.\n */\nexport function subscribePostgresJsDiagnosticChannels(\n tracingChannel: PostgresJsTracingChannelFactory,\n options: PostgresJsSqlInstrumentationOptions = {},\n): void {\n const { requireParentSpan, requestHook } = options;\n\n bindTracingChannelToSpan(\n tracingChannel<PostgresJsQueryData>(POSTGRESJS_DC_CHANNEL_QUERY),\n data => {\n // `instrumentPostgresJsSql` already spans this query, and its span is active when postgres runs it.\n if (_isPostgresJsWrapperSpan(getActiveSpan())) {\n return undefined;\n }\n\n const queryAttributes = getSqlQueryAttributes(data.query ?? undefined);\n const sanitizedSqlQuery = queryAttributes[DB_QUERY_TEXT] ?? '';\n const connectionContext = getPostgresJsConnectionContext(data);\n\n const attributes: SpanAttributes = {\n [SENTRY_OP]: DB,\n [SENTRY_KIND]: 'client',\n [SENTRY_ORIGIN]: ORIGIN,\n [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES,\n ...queryAttributes,\n ..._getConnectionAttributes(connectionContext),\n };\n const span = startInactiveSpan({\n name: getSqlSpanName(attributes, 'postgresjs.query'),\n onlyIfParent: requireParentSpan !== false,\n attributes,\n });\n\n if (requestHook) {\n callRequestHook(requestHook, span, sanitizedSqlQuery, connectionContext);\n }\n\n return span;\n },\n {\n beforeSpanEnd(span, data) {\n span.setAttributes(getPostgresJsQueryEndAttributes(data));\n },\n },\n );\n}\n\n/**\n * Maps a `postgres:query` context to a {@link PostgresConnectionContext}. At `start` only the\n * database is known; `host`/`port` are filled in once the query is sent.\n *\n * @internal Exported for testing only\n */\nexport function getPostgresJsConnectionContext(data: PostgresJsQueryData): PostgresConnectionContext {\n return {\n ATTR_DB_NAMESPACE: data.database || undefined,\n ATTR_SERVER_ADDRESS: data.host || undefined,\n ATTR_SERVER_PORT: typeof data.port === 'number' ? String(data.port) : undefined,\n };\n}\n\n/**\n * Attributes only known once the query settled: the connection it ran on, the server-reported\n * command and, on failure, the Postgres error code.\n *\n * @internal Exported for testing only\n */\nexport function getPostgresJsQueryEndAttributes(data: PostgresJsQueryData): SpanAttributes {\n const attributes = _getConnectionAttributes(getPostgresJsConnectionContext(data));\n\n if (data.command) {\n attributes[DB_OPERATION_NAME] = data.command;\n }\n\n if ('error' in data) {\n const code = isObjectLike(data.error) && 'code' in data.error ? data.error.code : undefined;\n attributes[DB_RESPONSE_STATUS_CODE] = typeof code === 'string' && code ? code : 'unknown';\n }\n\n return attributes;\n}\n\nfunction callRequestHook(\n requestHook: NonNullable<PostgresJsSqlInstrumentationOptions['requestHook']>,\n span: Span,\n sanitizedSqlQuery: string,\n connectionContext: PostgresConnectionContext,\n): void {\n try {\n requestHook(span, sanitizedSqlQuery, connectionContext);\n } catch (e) {\n span.setAttribute('sentry.hook.error', 'requestHook failed');\n DEBUG_BUILD && debug.error('[instrumentation:postgresjs] error in requestHook:', e);\n }\n}\n"],"names":["tracingChannel","bindTracingChannelToSpan","_isPostgresJsWrapperSpan","getActiveSpan","getSqlQueryAttributes","DB_QUERY_TEXT","attributes","SENTRY_OP","DB","SENTRY_KIND","SENTRY_ORIGIN","DB_SYSTEM_NAME","_getConnectionAttributes","startInactiveSpan","getSqlSpanName","DB_OPERATION_NAME","isObjectLike","DB_RESPONSE_STATUS_CODE","DEBUG_BUILD","debug"],"mappings":";;;;;;;;;;AA0BO,CAAA,CAAA,CAAA,CA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CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD,CAAC,CAAA;AAAA,CAAA,CACpF;AACF;;;;;"}
|
|
@@ -6,10 +6,10 @@ const sql = require('../utils/sql.js');
|
|
|
6
6
|
const attributes = require('@sentry/conventions/attributes');
|
|
7
7
|
const op = require('@sentry/conventions/op');
|
|
8
8
|
|
|
9
|
-
const SQL_OPERATION_REGEX = /^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i;
|
|
10
9
|
const CONNECTION_CONTEXT_SYMBOL = /* @__PURE__ */ Symbol("sentryPostgresConnectionContext");
|
|
11
10
|
const INSTRUMENTED_MARKER = /* @__PURE__ */ Symbol.for("sentry.instrumented.postgresjs");
|
|
12
11
|
const QUERY_FROM_INSTRUMENTED_SQL = /* @__PURE__ */ Symbol.for("sentry.query.from.instrumented.sql");
|
|
12
|
+
const POSTGRESJS_WRAPPER_SPAN = /* @__PURE__ */ Symbol.for("sentry.postgresjs.wrapper.span");
|
|
13
13
|
function instrumentPostgresJsSql(sql, options) {
|
|
14
14
|
if (!sql || typeof sql !== "function") {
|
|
15
15
|
debugBuild.DEBUG_BUILD && core.debug.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance");
|
|
@@ -93,78 +93,45 @@ function _wrapSingleQueryHandle(query, sqlInstance, options) {
|
|
|
93
93
|
if (this.executed || !_shouldCreateSpans(options)) {
|
|
94
94
|
return originalHandle.apply(this, args);
|
|
95
95
|
}
|
|
96
|
-
const
|
|
97
|
-
const sanitizedSqlQuery =
|
|
98
|
-
const client = core.getClient();
|
|
99
|
-
const querySummary = sql.getSqlQuerySummary(sanitizedSqlQuery);
|
|
96
|
+
const queryAttributes = sql.getSqlQueryAttributes(_reconstructQuery(query.strings));
|
|
97
|
+
const sanitizedSqlQuery = queryAttributes[attributes.DB_QUERY_TEXT] ?? "";
|
|
100
98
|
const connectionContext = sqlInstance ? sqlInstance[CONNECTION_CONTEXT_SYMBOL] : void 0;
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
[attributes.DB_OPERATION_NAME]: _getOperationName(sanitizedSqlQuery),
|
|
112
|
-
...connectionContext && _getConnectionAttributes(connectionContext)
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
(span) => {
|
|
116
|
-
if (options.requestHook) {
|
|
117
|
-
try {
|
|
118
|
-
options.requestHook(span, sanitizedSqlQuery, connectionContext);
|
|
119
|
-
} catch (e) {
|
|
120
|
-
span.setAttribute("sentry.hook.error", "requestHook failed");
|
|
121
|
-
debugBuild.DEBUG_BUILD && core.debug.error("Error in requestHook for PostgresJs instrumentation:", e);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const queryWithCallbacks = this;
|
|
125
|
-
queryWithCallbacks.resolve = new Proxy(queryWithCallbacks.resolve, {
|
|
126
|
-
apply: (resolveTarget, resolveThisArg, resolveArgs) => {
|
|
127
|
-
try {
|
|
128
|
-
span.setAttribute(attributes.DB_OPERATION_NAME, _getOperationName(sanitizedSqlQuery, resolveArgs?.[0]?.command));
|
|
129
|
-
span.end();
|
|
130
|
-
} catch (e) {
|
|
131
|
-
debugBuild.DEBUG_BUILD && core.debug.error("Error ending span in resolve callback:", e);
|
|
132
|
-
}
|
|
133
|
-
return Reflect.apply(resolveTarget, resolveThisArg, resolveArgs);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
queryWithCallbacks.reject = new Proxy(queryWithCallbacks.reject, {
|
|
137
|
-
apply: (rejectTarget, rejectThisArg, rejectArgs) => {
|
|
138
|
-
try {
|
|
139
|
-
span.setStatus({
|
|
140
|
-
code: core.SPAN_STATUS_ERROR,
|
|
141
|
-
message: rejectArgs?.[0]?.message || "unknown_error"
|
|
142
|
-
});
|
|
143
|
-
span.setAttribute("db.response.status_code", rejectArgs?.[0]?.code || "unknown");
|
|
144
|
-
span.setAttribute("error.type", rejectArgs?.[0]?.name || "unknown");
|
|
145
|
-
span.end();
|
|
146
|
-
} catch (e) {
|
|
147
|
-
debugBuild.DEBUG_BUILD && core.debug.error("Error ending span in reject callback:", e);
|
|
148
|
-
}
|
|
149
|
-
return Reflect.apply(rejectTarget, rejectThisArg, rejectArgs);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
99
|
+
const attributes$1 = {
|
|
100
|
+
[attributes.SENTRY_OP]: op.DB,
|
|
101
|
+
[attributes.SENTRY_ORIGIN]: "auto.db.postgresjs",
|
|
102
|
+
[attributes.DB_SYSTEM_NAME]: "postgres",
|
|
103
|
+
...queryAttributes,
|
|
104
|
+
...connectionContext && _getConnectionAttributes(connectionContext)
|
|
105
|
+
};
|
|
106
|
+
return core.startSpanManual({ name: sql.getSqlSpanName(attributes$1, "postgresjs.query"), attributes: attributes$1 }, (span) => {
|
|
107
|
+
core.addNonEnumerableProperty(span, POSTGRESJS_WRAPPER_SPAN, true);
|
|
108
|
+
if (options.requestHook) {
|
|
152
109
|
try {
|
|
153
|
-
|
|
110
|
+
options.requestHook(span, sanitizedSqlQuery, connectionContext);
|
|
154
111
|
} catch (e) {
|
|
155
|
-
span.
|
|
156
|
-
|
|
157
|
-
message: e instanceof Error ? e.message : "unknown_error"
|
|
158
|
-
});
|
|
159
|
-
span.end();
|
|
160
|
-
throw e;
|
|
112
|
+
span.setAttribute("sentry.hook.error", "requestHook failed");
|
|
113
|
+
debugBuild.DEBUG_BUILD && core.debug.error("Error in requestHook for PostgresJs instrumentation:", e);
|
|
161
114
|
}
|
|
162
115
|
}
|
|
163
|
-
|
|
116
|
+
_wrapQuerySettlement(this, span, queryAttributes[attributes.DB_OPERATION_NAME]);
|
|
117
|
+
try {
|
|
118
|
+
return originalHandle.apply(this, args);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
span.setStatus({
|
|
121
|
+
code: core.SPAN_STATUS_ERROR,
|
|
122
|
+
message: e instanceof Error ? e.message : "unknown_error"
|
|
123
|
+
});
|
|
124
|
+
span.end();
|
|
125
|
+
throw e;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
164
128
|
};
|
|
165
129
|
wrappedHandle.__sentryWrapped = true;
|
|
166
130
|
query.handle = wrappedHandle;
|
|
167
131
|
}
|
|
132
|
+
function _isPostgresJsWrapperSpan(span) {
|
|
133
|
+
return !!span && POSTGRESJS_WRAPPER_SPAN in span;
|
|
134
|
+
}
|
|
168
135
|
function _shouldCreateSpans(options) {
|
|
169
136
|
const hasParentSpan = core.getActiveSpan() !== void 0;
|
|
170
137
|
return hasParentSpan || !options.requireParentSpan;
|
|
@@ -194,13 +161,6 @@ function _getConnectionAttributes(connectionContext) {
|
|
|
194
161
|
}
|
|
195
162
|
return attributes$1;
|
|
196
163
|
}
|
|
197
|
-
function _getOperationName(sanitizedQuery, command) {
|
|
198
|
-
if (command) {
|
|
199
|
-
return command;
|
|
200
|
-
}
|
|
201
|
-
const operationMatch = sanitizedQuery?.match(SQL_OPERATION_REGEX);
|
|
202
|
-
return operationMatch?.[1]?.toUpperCase();
|
|
203
|
-
}
|
|
204
164
|
function _buildConnectionContext(options) {
|
|
205
165
|
const host = options.host?.[0] || "localhost";
|
|
206
166
|
const port = options.port?.[0] || 5432;
|
|
@@ -210,6 +170,38 @@ function _buildConnectionContext(options) {
|
|
|
210
170
|
ATTR_SERVER_PORT: String(port)
|
|
211
171
|
};
|
|
212
172
|
}
|
|
173
|
+
function _wrapQuerySettlement(query, span, operationName, onSettle) {
|
|
174
|
+
const originalResolve = query.resolve;
|
|
175
|
+
if (typeof originalResolve === "function") {
|
|
176
|
+
query.resolve = function(...resolveArgs) {
|
|
177
|
+
onSettle?.();
|
|
178
|
+
try {
|
|
179
|
+
const command = resolveArgs[0]?.command;
|
|
180
|
+
span.setAttribute(attributes.DB_OPERATION_NAME, command || operationName);
|
|
181
|
+
span.end();
|
|
182
|
+
} catch (e) {
|
|
183
|
+
debugBuild.DEBUG_BUILD && core.debug.error("[instrumentation:postgresjs] error ending span in resolve:", e);
|
|
184
|
+
}
|
|
185
|
+
return originalResolve.apply(this, resolveArgs);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const originalReject = query.reject;
|
|
189
|
+
if (typeof originalReject === "function") {
|
|
190
|
+
query.reject = function(...rejectArgs) {
|
|
191
|
+
onSettle?.();
|
|
192
|
+
try {
|
|
193
|
+
const err = rejectArgs[0];
|
|
194
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: err?.message || "unknown_error" });
|
|
195
|
+
span.setAttribute(attributes.DB_RESPONSE_STATUS_CODE, err?.code || "unknown");
|
|
196
|
+
span.setAttribute(attributes.ERROR_TYPE, err?.name || "unknown");
|
|
197
|
+
span.end();
|
|
198
|
+
} catch (e) {
|
|
199
|
+
debugBuild.DEBUG_BUILD && core.debug.error("[instrumentation:postgresjs] error ending span in reject:", e);
|
|
200
|
+
}
|
|
201
|
+
return originalReject.apply(this, rejectArgs);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
213
205
|
function _attachConnectionContext(sql, proxiedSql) {
|
|
214
206
|
const sqlInstance = sql;
|
|
215
207
|
if (!sqlInstance.options || typeof sqlInstance.options !== "object") {
|
|
@@ -220,7 +212,8 @@ function _attachConnectionContext(sql, proxiedSql) {
|
|
|
220
212
|
|
|
221
213
|
exports._buildConnectionContext = _buildConnectionContext;
|
|
222
214
|
exports._getConnectionAttributes = _getConnectionAttributes;
|
|
223
|
-
exports.
|
|
215
|
+
exports._isPostgresJsWrapperSpan = _isPostgresJsWrapperSpan;
|
|
224
216
|
exports._reconstructQuery = _reconstructQuery;
|
|
217
|
+
exports._wrapQuerySettlement = _wrapQuerySettlement;
|
|
225
218
|
exports.instrumentPostgresJsSql = instrumentPostgresJsSql;
|
|
226
|
-
//# sourceMappingURL=postgresjs.js.map
|
|
219
|
+
//# sourceMappingURL=postgresjs-wrapper.js.map
|