@sentry/node 10.62.0 → 10.63.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/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/cjs/integrations/fs/index.js.map +1 -1
- package/build/cjs/integrations/http.js.map +1 -1
- package/build/cjs/integrations/node-fetch/index.js +7 -49
- package/build/cjs/integrations/node-fetch/index.js.map +1 -1
- package/build/cjs/integrations/node-fetch/undici-instrumentation.js +266 -0
- package/build/cjs/integrations/node-fetch/undici-instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/index.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/index.js.map +1 -1
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +7 -103
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +2 -3
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/index.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +0 -1
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/index.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/index.js.map +1 -1
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js +4 -2
- package/build/cjs/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/index.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js +34 -128
- package/build/cjs/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js +0 -2
- package/build/cjs/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js +2 -27
- package/build/cjs/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/index.js +1 -10
- package/build/cjs/integrations/tracing/prisma/index.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
- package/build/cjs/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/global.js +2 -2
- package/build/cjs/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
- package/build/cjs/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/index.js +3 -3
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/index.js +2 -4
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/cjs/sdk/diagnosticsChannelInjection.js.map +1 -1
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js +8 -6
- package/build/cjs/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/esm/integrations/fs/index.js.map +1 -1
- package/build/esm/integrations/http.js.map +1 -1
- package/build/esm/integrations/node-fetch/index.js +9 -50
- package/build/esm/integrations/node-fetch/index.js.map +1 -1
- package/build/esm/integrations/node-fetch/undici-instrumentation.js +264 -0
- package/build/esm/integrations/node-fetch/undici-instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/index.js.map +1 -1
- package/build/esm/integrations/tracing/connect/index.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/index.js.map +1 -1
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js +8 -103
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +3 -4
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool/index.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hono/index.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +1 -2
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
- package/build/esm/integrations/tracing/knex/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa/index.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/index.js.map +1 -1
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js +5 -3
- package/build/esm/integrations/tracing/lrumemoizer/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/index.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/index.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js +37 -131
- package/build/esm/integrations/tracing/mysql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js +1 -2
- package/build/esm/integrations/tracing/mysql/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/mysql/vendored/utils.js +3 -25
- package/build/esm/integrations/tracing/mysql/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/index.js +2 -11
- package/build/esm/integrations/tracing/prisma/index.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js +83 -57
- package/build/esm/integrations/tracing/prisma/vendored/active-tracing-helper.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/constants.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/global.js +2 -2
- package/build/esm/integrations/tracing/prisma/vendored/global.js.map +1 -1
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js +1 -6
- package/build/esm/integrations/tracing/prisma/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/index.js +4 -4
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js +3 -5
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/diagnosticsChannelInjection.js.map +1 -1
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js +9 -7
- package/build/esm/sdk/experimentalUseDiagnosticsChannelInjection.js.map +1 -1
- package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/openFeature.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/statsig.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -1
- package/build/types/integrations/featureFlagShims/unleash.d.ts +3 -1
- package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -1
- package/build/types/integrations/fs/index.d.ts +3 -1
- package/build/types/integrations/fs/index.d.ts.map +1 -1
- package/build/types/integrations/http.d.ts +3 -1
- package/build/types/integrations/http.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/index.d.ts +4 -35
- package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/types.d.ts +96 -0
- package/build/types/integrations/node-fetch/types.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/undici-instrumentation.d.ts +14 -0
- package/build/types/integrations/node-fetch/undici-instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/index.d.ts +3 -1
- package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts +3 -1
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/connect/index.d.ts +3 -1
- package/build/types/integrations/tracing/connect/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/index.d.ts +3 -1
- package/build/types/integrations/tracing/dataloader/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/express.d.ts +3 -1
- package/build/types/integrations/tracing/express.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/index.d.ts +6 -6
- package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/firebase.d.ts +3 -1
- package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
- package/build/types/integrations/tracing/genericPool/index.d.ts +3 -1
- package/build/types/integrations/tracing/genericPool/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/google-genai/index.d.ts +3 -1
- package/build/types/integrations/tracing/google-genai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/index.d.ts +3 -1
- package/build/types/integrations/tracing/graphql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/index.d.ts +3 -1
- package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hono/index.d.ts +3 -1
- package/build/types/integrations/tracing/hono/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/index.d.ts +3 -1
- package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/index.d.ts +3 -1
- package/build/types/integrations/tracing/knex/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/index.d.ts +3 -1
- package/build/types/integrations/tracing/koa/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langchain/index.d.ts +3 -1
- package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts +3 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/index.d.ts +3 -1
- package/build/types/integrations/tracing/lrumemoizer/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/lrumemoizer/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/index.d.ts +3 -1
- package/build/types/integrations/tracing/mongo/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/index.d.ts +3 -1
- package/build/types/integrations/tracing/mongoose/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/index.d.ts +3 -1
- package/build/types/integrations/tracing/mysql/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
- package/build/types/integrations/tracing/mysql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
- package/build/types/integrations/tracing/mysql/vendored/mysql-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts +0 -8
- package/build/types/integrations/tracing/mysql/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
- package/build/types/integrations/tracing/mysql/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts +3 -1
- package/build/types/integrations/tracing/mysql2/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/openai/index.d.ts +3 -1
- package/build/types/integrations/tracing/openai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/index.d.ts +3 -1
- package/build/types/integrations/tracing/postgres/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgresjs.d.ts +3 -1
- package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/index.d.ts +5 -21
- package/build/types/integrations/tracing/prisma/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
- package/build/types/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/global.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
- package/build/types/integrations/tracing/prisma/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts +5 -23
- package/build/types/integrations/tracing/prisma/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/index.d.ts +4 -2
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/index.d.ts +3 -1
- package/build/types/integrations/tracing/tedious/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/constants.d.ts +1 -1
- package/build/types/integrations/tracing/vercelai/constants.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/index.d.ts +3 -1
- package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts +1 -1
- package/build/types/sdk/diagnosticsChannelInjection.d.ts.map +1 -1
- package/build/types/sdk/experimentalUseDiagnosticsChannelInjection.d.ts.map +1 -1
- package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +3 -1
- package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +3 -1
- package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +3 -1
- package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +3 -1
- package/build/types-ts3.8/integrations/fs/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/http.d.ts +3 -1
- package/build/types-ts3.8/integrations/node-fetch/index.d.ts +4 -35
- package/build/types-ts3.8/integrations/node-fetch/types.d.ts +96 -0
- package/build/types-ts3.8/integrations/node-fetch/undici-instrumentation.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/connect/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/dataloader/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/express.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +6 -6
- package/build/types-ts3.8/integrations/tracing/firebase/firebase.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/genericPool/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/google-genai/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/graphql/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/hapi/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/kafka/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/knex/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/koa/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/lrumemoizer/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mongo/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mongoose/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mysql/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/instrumentation.d.ts +3 -17
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/mysql-types.d.ts +16 -16
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/semconv.d.ts +0 -8
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/utils.d.ts +6 -9
- package/build/types-ts3.8/integrations/tracing/mysql2/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/postgres/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/postgresjs.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/prisma/index.d.ts +5 -21
- package/build/types-ts3.8/integrations/tracing/prisma/vendored/active-tracing-helper.d.ts +5 -7
- package/build/types-ts3.8/integrations/tracing/prisma/vendored/instrumentation.d.ts +2 -4
- package/build/types-ts3.8/integrations/tracing/prisma/vendored/types.d.ts +5 -23
- package/build/types-ts3.8/integrations/tracing/redis/index.d.ts +4 -2
- package/build/types-ts3.8/integrations/tracing/tedious/index.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing/vercelai/constants.d.ts +1 -1
- package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +3 -1
- package/build/types-ts3.8/sdk/diagnosticsChannelInjection.d.ts +1 -1
- package/package.json +6 -5
- package/build/cjs/integrations/node-fetch/vendored/semconv.js +0 -28
- package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +0 -1
- package/build/cjs/integrations/node-fetch/vendored/undici.js +0 -302
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +0 -1
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js +0 -387
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js +0 -9
- package/build/cjs/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
- package/build/esm/integrations/node-fetch/vendored/semconv.js +0 -15
- package/build/esm/integrations/node-fetch/vendored/semconv.js.map +0 -1
- package/build/esm/integrations/node-fetch/vendored/undici.js +0 -300
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +0 -1
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js +0 -385
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +0 -1
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js +0 -7
- package/build/esm/integrations/tracing/mysql/vendored/AttributeNames.js.map +0 -1
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts +0 -13
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/types.d.ts +0 -60
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts +0 -21
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +0 -1
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
- package/build/types/integrations/tracing/mysql/vendored/AttributeNames.d.ts.map +0 -1
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts +0 -9
- package/build/types/integrations/tracing/mysql/vendored/types.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/node-fetch/vendored/internal-types.d.ts +0 -25
- package/build/types-ts3.8/integrations/node-fetch/vendored/semconv.d.ts +0 -13
- package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +0 -60
- package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +0 -21
- package/build/types-ts3.8/integrations/tracing/fastify/vendored/instrumentation.d.ts +0 -27
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/AttributeNames.d.ts +0 -4
- package/build/types-ts3.8/integrations/tracing/mysql/vendored/types.d.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentSentryHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { anthropicAIIntegration, instrumentAnthropicAi } from './anthropic-ai';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress } from './express';\nimport { fastifyIntegration,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentSentryHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { anthropicAIIntegration, instrumentAnthropicAi } from './anthropic-ai';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress } from './express';\nimport { fastifyIntegration, instrumentFastifyV3 } from './fastify';\nimport { firebaseIntegration, instrumentFirebase } from './firebase';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { googleGenAIIntegration, instrumentGoogleGenAI } from './google-genai';\nimport { graphqlIntegration, instrumentGraphql } from './graphql';\nimport { hapiIntegration, instrumentHapi } from './hapi';\nimport { honoIntegration, instrumentHono } from './hono';\nimport { instrumentKafka, kafkaIntegration } from './kafka';\nimport { instrumentKoa, koaIntegration } from './koa';\nimport { instrumentLangChain, langChainIntegration } from './langchain';\nimport { instrumentLangGraph, langGraphIntegration } from './langgraph';\nimport { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer';\nimport { instrumentMongo, mongoIntegration } from './mongo';\nimport { instrumentMongoose, mongooseIntegration } from './mongoose';\nimport { instrumentMysql, mysqlIntegration } from './mysql';\nimport { instrumentMysql2, mysql2Integration } from './mysql2';\nimport { instrumentOpenAi, openAIIntegration } from './openai';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { instrumentPostgresJs, postgresJsIntegration } from './postgresjs';\nimport { prismaIntegration } from './prisma';\nimport { instrumentRedis, redisIntegration } from './redis';\nimport { instrumentTedious, tediousIntegration } from './tedious';\nimport { instrumentVercelAi, vercelAIIntegration } from './vercelai';\n\n/**\n * With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.\n */\nexport function getAutoPerformanceIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n graphqlIntegration(),\n // eslint-disable-next-line typescript/no-deprecated\n honoIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n hapiIntegration(),\n koaIntegration(),\n connectIntegration(),\n tediousIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n ];\n}\n\n/**\n * Get a list of methods to instrument OTEL, when preload instrumentation.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => void) & { id: string })[] {\n return [\n instrumentSentryHttp,\n instrumentExpress,\n instrumentConnect,\n instrumentFastifyV3,\n instrumentHapi,\n instrumentHono,\n instrumentKafka,\n instrumentKoa,\n instrumentLruMemoizer,\n instrumentMongo,\n instrumentMongoose,\n instrumentMysql,\n instrumentMysql2,\n instrumentPostgres,\n instrumentHapi,\n instrumentGraphql,\n instrumentRedis,\n instrumentTedious,\n instrumentGenericPool,\n instrumentAmqplib,\n instrumentLangChain,\n instrumentVercelAi,\n instrumentOpenAi,\n instrumentPostgresJs,\n instrumentFirebase,\n instrumentAnthropicAi,\n instrumentGoogleGenAI,\n instrumentLangGraph,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAS,8BAAA,GAAgD;AAC9D,EAAA,OAAO;AAAA,IACL,kBAAA,EAAmB;AAAA,IACnB,kBAAA,EAAmB;AAAA,IACnB,kBAAA,EAAmB;AAAA;AAAA,IAEnB,eAAA,EAAgB;AAAA,IAChB,gBAAA,EAAiB;AAAA,IACjB,mBAAA,EAAoB;AAAA,IACpB,gBAAA,EAAiB;AAAA,IACjB,iBAAA,EAAkB;AAAA,IAClB,gBAAA,EAAiB;AAAA,IACjB,mBAAA,EAAoB;AAAA,IACpB,iBAAA,EAAkB;AAAA,IAClB,eAAA,EAAgB;AAAA,IAChB,cAAA,EAAe;AAAA,IACf,kBAAA,EAAmB;AAAA,IACnB,kBAAA,EAAmB;AAAA,IACnB,sBAAA,EAAuB;AAAA,IACvB,gBAAA,EAAiB;AAAA,IACjB,kBAAA,EAAmB;AAAA,IACnB,sBAAA,EAAuB;AAAA;AAAA;AAAA,IAGvB,oBAAA,EAAqB;AAAA,IACrB,oBAAA,EAAqB;AAAA,IACrB,mBAAA,EAAoB;AAAA,IACpB,iBAAA,EAAkB;AAAA,IAClB,sBAAA,EAAuB;AAAA,IACvB,sBAAA,EAAuB;AAAA,IACvB,qBAAA,EAAsB;AAAA,IACtB,mBAAA;AAAoB,GACtB;AACF;AAMO,SAAS,wCAAA,GAA2F;AACzG,EAAA,OAAO;AAAA,IACL,oBAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,qBAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,eAAA;AAAA,IACA,iBAAA;AAAA,IACA,qBAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAA;AAAA,IACA,kBAAA;AAAA,IACA,gBAAA;AAAA,IACA,oBAAA;AAAA,IACA,kBAAA;AAAA,IACA,qBAAA;AAAA,IACA,qBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/kafka/index.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Kafka';\n\nexport const instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME, () => new KafkaJsInstrumentation());\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,kBAAkB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,wBAAwB;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/kafka/index.ts"],"sourcesContent":["import { KafkaJsInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Kafka' as const;\n\nexport const instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME, () => new KafkaJsInstrumentation());\n\nconst _kafkaIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKafka();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [kafkajs](https://www.npmjs.com/package/kafkajs) library.\n *\n * For more information, see the [`kafkaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/kafka/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.kafkaIntegration()],\n * });\n */\nexport const kafkaIntegration = defineIntegration(_kafkaIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,kBAAkB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,wBAAwB;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/knex/index.ts"],"sourcesContent":["import { KnexInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Knex';\n\nexport const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());\n\nconst _knexIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKnex();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,qBAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,cAAA,EAAe;AAAA,IACjB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,eAAA,GAAkB,kBAAkB,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/knex/index.ts"],"sourcesContent":["import { KnexInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Knex' as const;\n\nexport const instrumentKnex = generateInstrumentOnce(INTEGRATION_NAME, () => new KnexInstrumentation());\n\nconst _knexIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKnex();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Knex integration\n *\n * Capture tracing data for [Knex](https://knexjs.org/).\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.knexIntegration()],\n * });\n * ```\n */\nexport const knexIntegration = defineIntegration(_knexIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,MAAA;AAElB,MAAM,iBAAiB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,qBAAqB;AAEtG,MAAM,oBAAoB,MAAM;AAC9B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,cAAA,EAAe;AAAA,IACjB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,eAAA,GAAkB,kBAAkB,gBAAgB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/koa/index.ts"],"sourcesContent":["import type { KoaInstrumentationConfig, KoaLayerType } from './vendored/types';\nimport { KoaInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { captureException, defineIntegration } from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\n\ninterface KoaOptions {\n /**\n * Ignore layers of specified types\n */\n ignoreLayersType?: Array<'middleware' | 'router'>;\n}\n\nconst INTEGRATION_NAME = 'Koa';\n\nexport const instrumentKoa = generateInstrumentOnce(\n INTEGRATION_NAME,\n KoaInstrumentation,\n (options: KoaOptions = {}) => {\n return {\n ignoreLayersType: options.ignoreLayersType as KoaLayerType[],\n } satisfies KoaInstrumentationConfig;\n },\n);\n\nconst _koaIntegration = ((options: KoaOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKoa(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Koa](https://koajs.com/).\n *\n * If you also want to capture errors, you need to call `setupKoaErrorHandler(app)` after you set up your Koa server.\n *\n * For more information, see the [koa documentation](https://docs.sentry.io/platforms/javascript/guides/koa/).\n *\n * @param {KoaOptions} options Configuration options for the Koa integration.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.koaIntegration()],\n * })\n * ```\n *\n * @example\n * ```javascript\n * // To ignore middleware spans\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [\n * Sentry.koaIntegration({\n * ignoreLayersType: ['middleware']\n * })\n * ],\n * })\n * ```\n */\nexport const koaIntegration = defineIntegration(_koaIntegration);\n\n/**\n * Add an Koa error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Koa = require(\"koa\");\n *\n * const app = new Koa();\n *\n * Sentry.setupKoaErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen(3000);\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const setupKoaErrorHandler = (app: { use: (arg0: (ctx: any, next: any) => Promise<void>) => void }): void => {\n app.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'auto.middleware.koa',\n },\n });\n throw error;\n }\n });\n\n ensureIsWrapped(app.use, 'koa');\n};\n"],"names":[],"mappings":";;;;AAaA,MAAM,gBAAA,GAAmB,KAAA;AAElB,MAAM,aAAA,GAAgB,sBAAA;AAAA,EAC3B,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,CAAC,OAAA,GAAsB,EAAC,KAAM;AAC5B,IAAA,OAAO;AAAA,MACL,kBAAkB,OAAA,CAAQ;AAAA,KAC5B;AAAA,EACF;AACF;AAEA,MAAM,eAAA,IAAmB,CAAC,OAAA,GAAsB,EAAC,KAAM;AACrD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,aAAA,CAAc,OAAO,CAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAkCO,MAAM,cAAA,GAAiB,kBAAkB,eAAe;AAyBxD,MAAM,oBAAA,GAAuB,CAAC,GAAA,KAA+E;AAClH,EAAA,GAAA,CAAI,GAAA,CAAI,OAAO,GAAA,EAAK,IAAA,KAAS;AAC3B,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,EAAK;AAAA,IACb,SAAS,KAAA,EAAO;AACd,MAAA,gBAAA,CAAiB,KAAA,EAAO;AAAA,QACtB,SAAA,EAAW;AAAA,UACT,OAAA,EAAS,KAAA;AAAA,UACT,IAAA,EAAM;AAAA;AACR,OACD,CAAA;AACD,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF,CAAC,CAAA;AAED,EAAA,eAAA,CAAgB,GAAA,CAAI,KAAK,KAAK,CAAA;AAChC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/koa/index.ts"],"sourcesContent":["import type { KoaInstrumentationConfig, KoaLayerType } from './vendored/types';\nimport { KoaInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { captureException, defineIntegration } from '@sentry/core';\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\n\ninterface KoaOptions {\n /**\n * Ignore layers of specified types\n */\n ignoreLayersType?: Array<'middleware' | 'router'>;\n}\n\nconst INTEGRATION_NAME = 'Koa' as const;\n\nexport const instrumentKoa = generateInstrumentOnce(\n INTEGRATION_NAME,\n KoaInstrumentation,\n (options: KoaOptions = {}) => {\n return {\n ignoreLayersType: options.ignoreLayersType as KoaLayerType[],\n } satisfies KoaInstrumentationConfig;\n },\n);\n\nconst _koaIntegration = ((options: KoaOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentKoa(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Koa](https://koajs.com/).\n *\n * If you also want to capture errors, you need to call `setupKoaErrorHandler(app)` after you set up your Koa server.\n *\n * For more information, see the [koa documentation](https://docs.sentry.io/platforms/javascript/guides/koa/).\n *\n * @param {KoaOptions} options Configuration options for the Koa integration.\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.koaIntegration()],\n * })\n * ```\n *\n * @example\n * ```javascript\n * // To ignore middleware spans\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [\n * Sentry.koaIntegration({\n * ignoreLayersType: ['middleware']\n * })\n * ],\n * })\n * ```\n */\nexport const koaIntegration = defineIntegration(_koaIntegration);\n\n/**\n * Add an Koa error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Koa = require(\"koa\");\n *\n * const app = new Koa();\n *\n * Sentry.setupKoaErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen(3000);\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const setupKoaErrorHandler = (app: { use: (arg0: (ctx: any, next: any) => Promise<void>) => void }): void => {\n app.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'auto.middleware.koa',\n },\n });\n throw error;\n }\n });\n\n ensureIsWrapped(app.use, 'koa');\n};\n"],"names":[],"mappings":";;;;AAaA,MAAM,gBAAA,GAAmB,KAAA;AAElB,MAAM,aAAA,GAAgB,sBAAA;AAAA,EAC3B,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,CAAC,OAAA,GAAsB,EAAC,KAAM;AAC5B,IAAA,OAAO;AAAA,MACL,kBAAkB,OAAA,CAAQ;AAAA,KAC5B;AAAA,EACF;AACF;AAEA,MAAM,eAAA,IAAmB,CAAC,OAAA,GAAsB,EAAC,KAAM;AACrD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,aAAA,CAAc,OAAO,CAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAkCO,MAAM,cAAA,GAAiB,kBAAkB,eAAe;AAyBxD,MAAM,oBAAA,GAAuB,CAAC,GAAA,KAA+E;AAClH,EAAA,GAAA,CAAI,GAAA,CAAI,OAAO,GAAA,EAAK,IAAA,KAAS;AAC3B,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,EAAK;AAAA,IACb,SAAS,KAAA,EAAO;AACd,MAAA,gBAAA,CAAiB,KAAA,EAAO;AAAA,QACtB,SAAA,EAAW;AAAA,UACT,OAAA,EAAS,KAAA;AAAA,UACT,IAAA,EAAM;AAAA;AACR,OACD,CAAA;AACD,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF,CAAC,CAAA;AAED,EAAA,eAAA,CAAgB,GAAA,CAAI,KAAK,KAAK,CAAA;AAChC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/lrumemoizer/index.ts"],"sourcesContent":["import { LruMemoizerInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'LruMemoizer';\n\nexport const instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME, () => new LruMemoizerInstrumentation());\n\nconst _lruMemoizerIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentLruMemoizer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [lru-memoizer](https://www.npmjs.com/package/lru-memoizer) library.\n *\n * For more information, see the [`lruMemoizerIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/lrumemoizer/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.lruMemoizerIntegration()],\n * });\n */\nexport const lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,aAAA;AAElB,MAAM,wBAAwB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,4BAA4B;AAEpH,MAAM,2BAA2B,MAAM;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,qBAAA,EAAsB;AAAA,IACxB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,sBAAA,GAAyB,kBAAkB,uBAAuB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/lrumemoizer/index.ts"],"sourcesContent":["import { LruMemoizerInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'LruMemoizer' as const;\n\nexport const instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME, () => new LruMemoizerInstrumentation());\n\nconst _lruMemoizerIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentLruMemoizer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [lru-memoizer](https://www.npmjs.com/package/lru-memoizer) library.\n *\n * For more information, see the [`lruMemoizerIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/lrumemoizer/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.lruMemoizerIntegration()],\n * });\n */\nexport const lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,aAAA;AAElB,MAAM,wBAAwB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,4BAA4B;AAEpH,MAAM,2BAA2B,MAAM;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,qBAAA,EAAsB;AAAA,IACxB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,sBAAA,GAAyB,kBAAkB,uBAAuB;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { context } from '@opentelemetry/api';
|
|
2
1
|
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
3
|
-
import { SDK_VERSION } from '@sentry/core';
|
|
2
|
+
import { SDK_VERSION, getCurrentScope, withScope } from '@sentry/core';
|
|
4
3
|
|
|
5
4
|
const PACKAGE_NAME = "@sentry/instrumentation-lru-memoizer";
|
|
6
5
|
class LruMemoizerInstrumentation extends InstrumentationBase {
|
|
@@ -17,7 +16,10 @@ class LruMemoizerInstrumentation extends InstrumentationBase {
|
|
|
17
16
|
const origMemoizer = moduleExports.apply(this, args);
|
|
18
17
|
return function(...memoizerArgs) {
|
|
19
18
|
const origCallback = memoizerArgs.pop();
|
|
20
|
-
const
|
|
19
|
+
const scope = getCurrentScope();
|
|
20
|
+
const callbackWithContext = typeof origCallback === "function" ? function(...callbackArgs) {
|
|
21
|
+
return withScope(scope, () => origCallback.apply(this, callbackArgs));
|
|
22
|
+
} : origCallback;
|
|
21
23
|
return origMemoizer.apply(this, [...memoizerArgs, callbackWithContext]);
|
|
22
24
|
};
|
|
23
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/lrumemoizer/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-lru-memoizer\n * - Upstream version: @opentelemetry/instrumentation-lru-memoizer@0.62.0\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/lrumemoizer/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-lru-memoizer\n * - Upstream version: @opentelemetry/instrumentation-lru-memoizer@0.62.0\n */\n\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { getCurrentScope, SDK_VERSION, withScope } from '@sentry/core';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-lru-memoizer';\n\ntype Memoizer = (this: unknown, ...args: unknown[]) => unknown;\ntype LruMemoizerModule = ((this: unknown, ...args: unknown[]) => Memoizer) & { sync: unknown };\n\nexport class LruMemoizerInstrumentation extends InstrumentationBase {\n constructor() {\n super(PACKAGE_NAME, SDK_VERSION, {});\n }\n\n init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition(\n 'lru-memoizer',\n ['>=1.3 <4'],\n (moduleExports: LruMemoizerModule) => {\n // moduleExports is a function which receives an options object,\n // and returns a \"memoizer\" function upon invocation.\n // We want to patch this \"memoizer's\" internal function\n const asyncMemoizer = function (this: unknown, ...args: unknown[]): unknown {\n // This following function is invoked every time the user wants to get a (possible) memoized value\n // We replace it with another function in which we bind the current context to the last argument (callback)\n const origMemoizer = moduleExports.apply(this, args) as Memoizer;\n return function (this: unknown, ...memoizerArgs: unknown[]): unknown {\n // last argument is the callback\n const origCallback = memoizerArgs.pop();\n const scope = getCurrentScope();\n const callbackWithContext =\n typeof origCallback === 'function'\n ? function (this: unknown, ...callbackArgs: unknown[]): unknown {\n return withScope(scope, () => (origCallback as Memoizer).apply(this, callbackArgs));\n }\n : origCallback;\n return origMemoizer.apply(this, [...memoizerArgs, callbackWithContext]);\n };\n };\n\n // sync function preserves context, but we still need to export it\n // as the lru-memoizer package does\n return Object.assign(asyncMemoizer, { sync: moduleExports.sync });\n },\n undefined, // no need to disable as this instrumentation does not create any spans\n ),\n ];\n }\n}\n"],"names":[],"mappings":";;;AAYA,MAAM,YAAA,GAAe,sCAAA;AAKd,MAAM,mCAAmC,mBAAA,CAAoB;AAAA,EAClE,WAAA,GAAc;AACZ,IAAA,KAAA,CAAM,YAAA,EAAc,WAAA,EAAa,EAAE,CAAA;AAAA,EACrC;AAAA,EAEA,IAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,IAAI,mCAAA;AAAA,QACF,cAAA;AAAA,QACA,CAAC,UAAU,CAAA;AAAA,QACX,CAAC,aAAA,KAAqC;AAIpC,UAAA,MAAM,aAAA,GAAgB,YAA4B,IAAA,EAA0B;AAG1E,YAAA,MAAM,YAAA,GAAe,aAAA,CAAc,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AACnD,YAAA,OAAO,YAA4B,YAAA,EAAkC;AAEnE,cAAA,MAAM,YAAA,GAAe,aAAa,GAAA,EAAI;AACtC,cAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,cAAA,MAAM,mBAAA,GACJ,OAAO,YAAA,KAAiB,UAAA,GACpB,YAA4B,YAAA,EAAkC;AAC5D,gBAAA,OAAO,UAAU,KAAA,EAAO,MAAO,aAA0B,KAAA,CAAM,IAAA,EAAM,YAAY,CAAC,CAAA;AAAA,cACpF,CAAA,GACA,YAAA;AACN,cAAA,OAAO,aAAa,KAAA,CAAM,IAAA,EAAM,CAAC,GAAG,YAAA,EAAc,mBAAmB,CAAC,CAAA;AAAA,YACxE,CAAA;AAAA,UACF,CAAA;AAIA,UAAA,OAAO,OAAO,MAAA,CAAO,aAAA,EAAe,EAAE,IAAA,EAAM,aAAA,CAAc,MAAM,CAAA;AAAA,QAClE,CAAA;AAAA,QACA;AAAA;AAAA;AACF,KACF;AAAA,EACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mongo/index.ts"],"sourcesContent":["import { MongoDBInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongo';\n\nexport const instrumentMongo = generateInstrumentOnce(INTEGRATION_NAME, () => new MongoDBInstrumentation());\n\nconst _mongoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongo();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library.\n *\n * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongoIntegration()],\n * });\n * ```\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,kBAAkB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,wBAAwB;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mongo/index.ts"],"sourcesContent":["import { MongoDBInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongo' as const;\n\nexport const instrumentMongo = generateInstrumentOnce(INTEGRATION_NAME, () => new MongoDBInstrumentation());\n\nconst _mongoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongo();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library.\n *\n * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongoIntegration()],\n * });\n * ```\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,kBAAkB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,wBAAwB;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mongoose/index.ts"],"sourcesContent":["import { MongooseInstrumentation } from './vendored/mongoose';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongoose';\n\nexport const instrumentMongoose = generateInstrumentOnce(INTEGRATION_NAME, () => new MongooseInstrumentation());\n\nconst _mongooseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongoose();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongoose](https://www.npmjs.com/package/mongoose) library.\n *\n * For more information, see the [`mongooseIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongoose/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongooseIntegration()],\n * });\n * ```\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,UAAA;AAElB,MAAM,qBAAqB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,yBAAyB;AAE9G,MAAM,wBAAwB,MAAM;AAClC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,EAAmB;AAAA,IACrB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,mBAAA,GAAsB,kBAAkB,oBAAoB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mongoose/index.ts"],"sourcesContent":["import { MongooseInstrumentation } from './vendored/mongoose';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongoose' as const;\n\nexport const instrumentMongoose = generateInstrumentOnce(INTEGRATION_NAME, () => new MongooseInstrumentation());\n\nconst _mongooseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongoose();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongoose](https://www.npmjs.com/package/mongoose) library.\n *\n * For more information, see the [`mongooseIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongoose/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongooseIntegration()],\n * });\n * ```\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,UAAA;AAElB,MAAM,qBAAqB,sBAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAI,yBAAyB;AAE9G,MAAM,wBAAwB,MAAM;AAClC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,EAAmB;AAAA,IACrB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,mBAAA,GAAsB,kBAAkB,oBAAoB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mysql/index.ts"],"sourcesContent":["import { MySQLInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql';\n\nexport const instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQLInstrumentation({}));\n\nconst _mysqlIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql](https://www.npmjs.com/package/mysql) library.\n *\n * For more information, see the [`mysqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,eAAA,GAAkB,uBAAuB,gBAAA,EAAkB,MAAM,IAAI,oBAAA,CAAqB,EAAE,CAAC;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/mysql/index.ts"],"sourcesContent":["import { MySQLInstrumentation } from './vendored/instrumentation';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql' as const;\n\nexport const instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQLInstrumentation({}));\n\nconst _mysqlIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql](https://www.npmjs.com/package/mysql) library.\n *\n * For more information, see the [`mysqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,OAAA;AAElB,MAAM,eAAA,GAAkB,uBAAuB,gBAAA,EAAkB,MAAM,IAAI,oBAAA,CAAqB,EAAE,CAAC;AAE1G,MAAM,qBAAqB,MAAM;AAC/B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,EAAgB;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAgBO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { AttributeNames } from './AttributeNames.js';
|
|
6
|
-
import { getPoolNameOld, getConfig, getDbQueryText, getSpanName, getDbValues, getJDBCString } from './utils.js';
|
|
7
|
-
import { SDK_VERSION } from '@sentry/core';
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { SDK_VERSION, getCurrentScope, withScope, startInactiveSpan, SPAN_KIND, withActiveSpan, bindScopeToEmitter, SPAN_STATUS_ERROR, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
|
+
import { ATTR_DB_STATEMENT, DB_SYSTEM_VALUE_MYSQL, ATTR_NET_PEER_NAME, ATTR_DB_USER, ATTR_DB_NAME, ATTR_DB_CONNECTION_STRING, ATTR_DB_SYSTEM, ATTR_NET_PEER_PORT } from './semconv.js';
|
|
4
|
+
import { getConfig, getDbQueryText, getSpanName, getJDBCString } from './utils.js';
|
|
8
5
|
|
|
9
6
|
const PACKAGE_NAME = "@sentry/instrumentation-mysql";
|
|
7
|
+
const ORIGIN = "auto.db.otel.mysql";
|
|
10
8
|
class MySQLInstrumentation extends InstrumentationBase {
|
|
11
9
|
constructor(config = {}) {
|
|
12
10
|
super(PACKAGE_NAME, SDK_VERSION, config);
|
|
13
|
-
this._setSemconvStabilityFromEnv();
|
|
14
|
-
}
|
|
15
|
-
// Used for testing.
|
|
16
|
-
_setSemconvStabilityFromEnv() {
|
|
17
|
-
this._netSemconvStability = semconvStabilityFromStr("http", process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
|
|
18
|
-
this._dbSemconvStability = semconvStabilityFromStr("database", process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
|
|
19
|
-
}
|
|
20
|
-
_updateMetricInstruments() {
|
|
21
|
-
this._connectionsUsageOld = this.meter.createUpDownCounter(METRIC_DB_CLIENT_CONNECTIONS_USAGE, {
|
|
22
|
-
description: "The number of connections that are currently in state described by the state attribute.",
|
|
23
|
-
unit: "{connection}"
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Convenience function for updating the `db.client.connections.usage` metric.
|
|
28
|
-
* The name "count" comes from the eventually replacement for this metric per
|
|
29
|
-
* https://opentelemetry.io/docs/specs/semconv/non-normative/db-migration/#database-client-connection-count
|
|
30
|
-
*/
|
|
31
|
-
_connCountAdd(n, poolNameOld, state) {
|
|
32
|
-
this._connectionsUsageOld?.add(n, { state, name: poolNameOld });
|
|
33
11
|
}
|
|
34
12
|
init() {
|
|
35
13
|
return [
|
|
@@ -79,26 +57,10 @@ class MySQLInstrumentation extends InstrumentationBase {
|
|
|
79
57
|
const pool = originalCreatePool(...arguments);
|
|
80
58
|
thisPlugin._wrap(pool, "query", thisPlugin._patchQuery(pool));
|
|
81
59
|
thisPlugin._wrap(pool, "getConnection", thisPlugin._patchGetConnection(pool));
|
|
82
|
-
thisPlugin._wrap(pool, "end", thisPlugin._patchPoolEnd(pool));
|
|
83
|
-
thisPlugin._setPoolCallbacks(pool, "");
|
|
84
60
|
return pool;
|
|
85
61
|
};
|
|
86
62
|
};
|
|
87
63
|
}
|
|
88
|
-
_patchPoolEnd(pool) {
|
|
89
|
-
return (originalPoolEnd) => {
|
|
90
|
-
const thisPlugin = this;
|
|
91
|
-
return function end(callback) {
|
|
92
|
-
const nAll = pool._allConnections.length;
|
|
93
|
-
const nFree = pool._freeConnections.length;
|
|
94
|
-
const nUsed = nAll - nFree;
|
|
95
|
-
const poolNameOld = getPoolNameOld(pool);
|
|
96
|
-
thisPlugin._connCountAdd(-nUsed, poolNameOld, "used");
|
|
97
|
-
thisPlugin._connCountAdd(-nFree, poolNameOld, "idle");
|
|
98
|
-
originalPoolEnd.apply(pool, arguments);
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
64
|
// global export function
|
|
103
65
|
_patchCreatePoolCluster() {
|
|
104
66
|
return (originalCreatePoolCluster) => {
|
|
@@ -106,29 +68,10 @@ class MySQLInstrumentation extends InstrumentationBase {
|
|
|
106
68
|
return function createPool(_config) {
|
|
107
69
|
const cluster = originalCreatePoolCluster(...arguments);
|
|
108
70
|
thisPlugin._wrap(cluster, "getConnection", thisPlugin._patchGetConnection(cluster));
|
|
109
|
-
thisPlugin._wrap(cluster, "add", thisPlugin._patchAdd(cluster));
|
|
110
71
|
return cluster;
|
|
111
72
|
};
|
|
112
73
|
};
|
|
113
74
|
}
|
|
114
|
-
_patchAdd(cluster) {
|
|
115
|
-
return (originalAdd) => {
|
|
116
|
-
const thisPlugin = this;
|
|
117
|
-
return function add(id, config) {
|
|
118
|
-
if (!thisPlugin["_enabled"]) {
|
|
119
|
-
thisPlugin._unwrap(cluster, "add");
|
|
120
|
-
return originalAdd.apply(cluster, arguments);
|
|
121
|
-
}
|
|
122
|
-
originalAdd.apply(cluster, arguments);
|
|
123
|
-
const nodes = cluster["_nodes"];
|
|
124
|
-
if (nodes) {
|
|
125
|
-
const nodeId = typeof id === "object" ? "CLUSTER::" + cluster._lastId : String(id);
|
|
126
|
-
const pool = nodes[nodeId].pool;
|
|
127
|
-
thisPlugin._setPoolCallbacks(pool, id);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
75
|
// method on cluster or pool
|
|
133
76
|
_patchGetConnection(pool) {
|
|
134
77
|
return (originalGetConnection) => {
|
|
@@ -156,7 +99,7 @@ class MySQLInstrumentation extends InstrumentationBase {
|
|
|
156
99
|
}
|
|
157
100
|
_getConnectionCallbackPatchFn(cb) {
|
|
158
101
|
const thisPlugin = this;
|
|
159
|
-
const
|
|
102
|
+
const scope = getCurrentScope();
|
|
160
103
|
return function(err, connection) {
|
|
161
104
|
if (connection) {
|
|
162
105
|
if (!isWrapped(connection.query)) {
|
|
@@ -164,7 +107,7 @@ class MySQLInstrumentation extends InstrumentationBase {
|
|
|
164
107
|
}
|
|
165
108
|
}
|
|
166
109
|
if (typeof cb === "function") {
|
|
167
|
-
|
|
110
|
+
withScope(scope, () => cb.call(this, err, connection));
|
|
168
111
|
}
|
|
169
112
|
};
|
|
170
113
|
}
|
|
@@ -176,100 +119,63 @@ class MySQLInstrumentation extends InstrumentationBase {
|
|
|
176
119
|
thisPlugin._unwrap(connection, "query");
|
|
177
120
|
return originalQuery.apply(connection, arguments);
|
|
178
121
|
}
|
|
179
|
-
const attributes = {};
|
|
180
122
|
const { host, port, database, user } = getConfig(connection.config);
|
|
181
|
-
const portNumber = parseInt(port, 10);
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
attributes[
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!isNaN(portNumber)) {
|
|
198
|
-
attributes[ATTR_NET_PEER_PORT] = portNumber;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (thisPlugin._netSemconvStability & SemconvStability.STABLE) {
|
|
202
|
-
attributes[ATTR_SERVER_ADDRESS] = host;
|
|
203
|
-
if (!isNaN(portNumber)) {
|
|
204
|
-
attributes[ATTR_SERVER_PORT] = portNumber;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
const span = thisPlugin.tracer.startSpan(getSpanName(query), {
|
|
208
|
-
kind: SpanKind.CLIENT,
|
|
123
|
+
const portNumber = parseInt(String(port), 10);
|
|
124
|
+
const attributes = {
|
|
125
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
126
|
+
[ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL,
|
|
127
|
+
[ATTR_DB_CONNECTION_STRING]: getJDBCString(host, port, database),
|
|
128
|
+
[ATTR_DB_NAME]: database,
|
|
129
|
+
[ATTR_DB_USER]: user,
|
|
130
|
+
[ATTR_DB_STATEMENT]: getDbQueryText(query),
|
|
131
|
+
[ATTR_NET_PEER_NAME]: host
|
|
132
|
+
};
|
|
133
|
+
if (!isNaN(portNumber)) {
|
|
134
|
+
attributes[ATTR_NET_PEER_PORT] = portNumber;
|
|
135
|
+
}
|
|
136
|
+
const span = startInactiveSpan({
|
|
137
|
+
name: getSpanName(query),
|
|
138
|
+
kind: SPAN_KIND.CLIENT,
|
|
209
139
|
attributes
|
|
210
140
|
});
|
|
211
|
-
if (thisPlugin.getConfig().enhancedDatabaseReporting) {
|
|
212
|
-
let values;
|
|
213
|
-
if (Array.isArray(_valuesOrCallback)) {
|
|
214
|
-
values = _valuesOrCallback;
|
|
215
|
-
} else if (arguments[2]) {
|
|
216
|
-
values = [_valuesOrCallback];
|
|
217
|
-
}
|
|
218
|
-
span.setAttribute(AttributeNames.MYSQL_VALUES, getDbValues(query, values));
|
|
219
|
-
}
|
|
220
141
|
const cbIndex = Array.from(arguments).findIndex((arg) => typeof arg === "function");
|
|
221
|
-
const
|
|
142
|
+
const scope = getCurrentScope();
|
|
222
143
|
if (cbIndex === -1) {
|
|
223
|
-
const streamableQuery =
|
|
144
|
+
const streamableQuery = withActiveSpan(span, () => {
|
|
224
145
|
return originalQuery.apply(connection, arguments);
|
|
225
146
|
});
|
|
226
|
-
|
|
227
|
-
return streamableQuery.on(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
code: SpanStatusCode.ERROR,
|
|
147
|
+
bindScopeToEmitter(streamableQuery, scope);
|
|
148
|
+
return streamableQuery.on("error", (err) => {
|
|
149
|
+
span.setStatus({
|
|
150
|
+
code: SPAN_STATUS_ERROR,
|
|
231
151
|
message: err.message
|
|
232
|
-
})
|
|
233
|
-
).on("end", () => {
|
|
152
|
+
});
|
|
153
|
+
}).on("end", () => {
|
|
234
154
|
span.end();
|
|
235
155
|
});
|
|
236
156
|
} else {
|
|
237
|
-
thisPlugin._wrap(arguments, cbIndex, thisPlugin._patchCallbackQuery(span,
|
|
238
|
-
return
|
|
157
|
+
thisPlugin._wrap(arguments, cbIndex, thisPlugin._patchCallbackQuery(span, scope));
|
|
158
|
+
return withActiveSpan(span, () => {
|
|
239
159
|
return originalQuery.apply(connection, arguments);
|
|
240
160
|
});
|
|
241
161
|
}
|
|
242
162
|
};
|
|
243
163
|
};
|
|
244
164
|
}
|
|
245
|
-
_patchCallbackQuery(span,
|
|
165
|
+
_patchCallbackQuery(span, scope) {
|
|
246
166
|
return (originalCallback) => {
|
|
247
|
-
return function(err,
|
|
167
|
+
return function(err, _results, _fields) {
|
|
248
168
|
if (err) {
|
|
249
169
|
span.setStatus({
|
|
250
|
-
code:
|
|
170
|
+
code: SPAN_STATUS_ERROR,
|
|
251
171
|
message: err.message
|
|
252
172
|
});
|
|
253
173
|
}
|
|
254
174
|
span.end();
|
|
255
|
-
return
|
|
175
|
+
return withScope(scope, () => originalCallback(...arguments));
|
|
256
176
|
};
|
|
257
177
|
};
|
|
258
178
|
}
|
|
259
|
-
_setPoolCallbacks(pool, id) {
|
|
260
|
-
const poolNameOld = id || getPoolNameOld(pool);
|
|
261
|
-
pool.on("connection", (_connection) => {
|
|
262
|
-
this._connCountAdd(1, poolNameOld, "idle");
|
|
263
|
-
});
|
|
264
|
-
pool.on("acquire", (_connection) => {
|
|
265
|
-
this._connCountAdd(-1, poolNameOld, "idle");
|
|
266
|
-
this._connCountAdd(1, poolNameOld, "used");
|
|
267
|
-
});
|
|
268
|
-
pool.on("release", (_connection) => {
|
|
269
|
-
this._connCountAdd(1, poolNameOld, "idle");
|
|
270
|
-
this._connCountAdd(-1, poolNameOld, "used");
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
179
|
}
|
|
274
180
|
|
|
275
181
|
export { MySQLInstrumentation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/mysql/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql\n * - Upstream version: @opentelemetry/instrumentation-mysql@0.64.0\n * - Types from the `mysql` package inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n/* eslint-disable */\n\nimport { context, Context, trace, Span, SpanKind, SpanStatusCode, type Attributes } from '@opentelemetry/api';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n isWrapped,\n SemconvStability,\n semconvStabilityFromStr,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_NAMESPACE,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_SYSTEM_NAME,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n DB_SYSTEM_NAME_VALUE_MYSQL,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DB_CONNECTION_STRING,\n ATTR_DB_NAME,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_DB_USER,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_MYSQL,\n METRIC_DB_CLIENT_CONNECTIONS_USAGE,\n} from './semconv';\nimport type * as mysqlTypes from './mysql-types';\nimport { AttributeNames } from './AttributeNames';\nimport { MySQLInstrumentationConfig } from './types';\nimport { getConfig, getDbQueryText, getDbValues, getJDBCString, getSpanName, getPoolNameOld } from './utils';\nimport { SDK_VERSION } from '@sentry/core';\nimport { UpDownCounter } from '@opentelemetry/api';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-mysql';\n\ntype getConnectionCallbackType = (err: mysqlTypes.MysqlError, connection: mysqlTypes.PoolConnection) => void;\n\nexport class MySQLInstrumentation extends InstrumentationBase<MySQLInstrumentationConfig> {\n private _netSemconvStability!: SemconvStability;\n private _dbSemconvStability!: SemconvStability;\n declare private _connectionsUsageOld: UpDownCounter;\n\n constructor(config: MySQLInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n this._setSemconvStabilityFromEnv();\n }\n\n // Used for testing.\n private _setSemconvStabilityFromEnv() {\n this._netSemconvStability = semconvStabilityFromStr('http', process.env.OTEL_SEMCONV_STABILITY_OPT_IN);\n this._dbSemconvStability = semconvStabilityFromStr('database', process.env.OTEL_SEMCONV_STABILITY_OPT_IN);\n }\n\n protected override _updateMetricInstruments() {\n this._connectionsUsageOld = this.meter.createUpDownCounter(METRIC_DB_CLIENT_CONNECTIONS_USAGE, {\n description: 'The number of connections that are currently in state described by the state attribute.',\n unit: '{connection}',\n });\n }\n\n /**\n * Convenience function for updating the `db.client.connections.usage` metric.\n * The name \"count\" comes from the eventually replacement for this metric per\n * https://opentelemetry.io/docs/specs/semconv/non-normative/db-migration/#database-client-connection-count\n */\n private _connCountAdd(n: number, poolNameOld: string, state: string) {\n this._connectionsUsageOld?.add(n, { state, name: poolNameOld });\n }\n\n protected init() {\n return [\n new InstrumentationNodeModuleDefinition(\n 'mysql',\n ['>=2.0.0 <3'],\n (moduleExports: typeof mysqlTypes) => {\n if (isWrapped(moduleExports.createConnection)) {\n this._unwrap(moduleExports, 'createConnection');\n }\n this._wrap(moduleExports, 'createConnection', this._patchCreateConnection() as any);\n\n if (isWrapped(moduleExports.createPool)) {\n this._unwrap(moduleExports, 'createPool');\n }\n this._wrap(moduleExports, 'createPool', this._patchCreatePool() as any);\n\n if (isWrapped(moduleExports.createPoolCluster)) {\n this._unwrap(moduleExports, 'createPoolCluster');\n }\n this._wrap(moduleExports, 'createPoolCluster', this._patchCreatePoolCluster() as any);\n\n return moduleExports;\n },\n (moduleExports: typeof mysqlTypes) => {\n if (moduleExports === undefined) return;\n this._unwrap(moduleExports, 'createConnection');\n this._unwrap(moduleExports, 'createPool');\n this._unwrap(moduleExports, 'createPoolCluster');\n },\n ),\n ];\n }\n\n // global export function\n private _patchCreateConnection() {\n return (originalCreateConnection: Function) => {\n const thisPlugin = this;\n\n return function createConnection(_connectionUri: string | mysqlTypes.ConnectionConfig) {\n const originalResult = originalCreateConnection(...arguments);\n\n // This is unwrapped on next call after unpatch\n thisPlugin._wrap(originalResult, 'query', thisPlugin._patchQuery(originalResult) as any);\n\n return originalResult;\n };\n };\n }\n\n // global export function\n private _patchCreatePool() {\n return (originalCreatePool: Function) => {\n const thisPlugin = this;\n return function createPool(_config: string | mysqlTypes.PoolConfig) {\n const pool = originalCreatePool(...arguments);\n\n thisPlugin._wrap(pool, 'query', thisPlugin._patchQuery(pool));\n thisPlugin._wrap(pool, 'getConnection', thisPlugin._patchGetConnection(pool));\n thisPlugin._wrap(pool, 'end', thisPlugin._patchPoolEnd(pool));\n thisPlugin._setPoolCallbacks(pool, '');\n\n return pool;\n };\n };\n }\n\n private _patchPoolEnd(pool: any) {\n return (originalPoolEnd: Function) => {\n const thisPlugin = this;\n return function end(callback?: unknown) {\n const nAll = (pool as any)._allConnections.length;\n const nFree = (pool as any)._freeConnections.length;\n const nUsed = nAll - nFree;\n const poolNameOld = getPoolNameOld(pool);\n thisPlugin._connCountAdd(-nUsed, poolNameOld, 'used');\n thisPlugin._connCountAdd(-nFree, poolNameOld, 'idle');\n originalPoolEnd.apply(pool, arguments);\n };\n };\n }\n\n // global export function\n private _patchCreatePoolCluster() {\n return (originalCreatePoolCluster: Function) => {\n const thisPlugin = this;\n return function createPool(_config: string | mysqlTypes.PoolConfig) {\n const cluster = originalCreatePoolCluster(...arguments);\n\n // This is unwrapped on next call after unpatch\n thisPlugin._wrap(cluster, 'getConnection', thisPlugin._patchGetConnection(cluster));\n thisPlugin._wrap(cluster, 'add', thisPlugin._patchAdd(cluster));\n\n return cluster;\n };\n };\n }\n private _patchAdd(cluster: mysqlTypes.PoolCluster) {\n return (originalAdd: Function) => {\n const thisPlugin = this;\n return function add(id: string, config: unknown) {\n // Unwrap if unpatch has been called\n if (!thisPlugin['_enabled']) {\n thisPlugin._unwrap(cluster, 'add');\n return originalAdd.apply(cluster, arguments);\n }\n originalAdd.apply(cluster, arguments);\n const nodes = cluster['_nodes' as keyof mysqlTypes.PoolCluster] as any;\n if (nodes) {\n const nodeId = typeof id === 'object' ? 'CLUSTER::' + (cluster as any)._lastId : String(id);\n\n const pool = nodes[nodeId].pool;\n thisPlugin._setPoolCallbacks(pool, id);\n }\n };\n };\n }\n\n // method on cluster or pool\n private _patchGetConnection(pool: mysqlTypes.Pool | mysqlTypes.PoolCluster) {\n return (originalGetConnection: Function) => {\n const thisPlugin = this;\n\n return function getConnection(arg1?: unknown, arg2?: unknown, arg3?: unknown) {\n // Unwrap if unpatch has been called\n if (!thisPlugin['_enabled']) {\n thisPlugin._unwrap(pool, 'getConnection');\n return originalGetConnection.apply(pool, arguments);\n }\n\n if (arguments.length === 1 && typeof arg1 === 'function') {\n const patchFn = thisPlugin._getConnectionCallbackPatchFn(arg1 as getConnectionCallbackType);\n return originalGetConnection.call(pool, patchFn);\n }\n if (arguments.length === 2 && typeof arg2 === 'function') {\n const patchFn = thisPlugin._getConnectionCallbackPatchFn(arg2 as getConnectionCallbackType);\n return originalGetConnection.call(pool, arg1, patchFn);\n }\n if (arguments.length === 3 && typeof arg3 === 'function') {\n const patchFn = thisPlugin._getConnectionCallbackPatchFn(arg3 as getConnectionCallbackType);\n return originalGetConnection.call(pool, arg1, arg2, patchFn);\n }\n\n return originalGetConnection.apply(pool, arguments);\n };\n };\n }\n\n private _getConnectionCallbackPatchFn(cb: getConnectionCallbackType) {\n const thisPlugin = this;\n const activeContext = context.active();\n return function (this: any, err: mysqlTypes.MysqlError, connection: mysqlTypes.PoolConnection) {\n if (connection) {\n // this is the callback passed into a query\n // no need to unwrap\n if (!isWrapped(connection.query)) {\n thisPlugin._wrap(connection, 'query', thisPlugin._patchQuery(connection));\n }\n }\n if (typeof cb === 'function') {\n context.with(activeContext, cb, this, err, connection);\n }\n };\n }\n\n private _patchQuery(connection: mysqlTypes.Connection | mysqlTypes.Pool) {\n return (originalQuery: Function): mysqlTypes.QueryFunction => {\n const thisPlugin = this;\n\n return function query(\n query: string | mysqlTypes.Query | mysqlTypes.QueryOptions,\n _valuesOrCallback?: unknown[] | mysqlTypes.queryCallback,\n _callback?: mysqlTypes.queryCallback,\n ) {\n if (!thisPlugin['_enabled']) {\n thisPlugin._unwrap(connection, 'query');\n return originalQuery.apply(connection, arguments);\n }\n\n const attributes: Attributes = {};\n const { host, port, database, user } = getConfig(connection.config);\n const portNumber = parseInt(port, 10);\n const dbQueryText = getDbQueryText(query);\n if (thisPlugin._dbSemconvStability & SemconvStability.OLD) {\n attributes[ATTR_DB_SYSTEM] = DB_SYSTEM_VALUE_MYSQL;\n attributes[ATTR_DB_CONNECTION_STRING] = getJDBCString(host, port, database);\n attributes[ATTR_DB_NAME] = database;\n attributes[ATTR_DB_USER] = user;\n attributes[ATTR_DB_STATEMENT] = dbQueryText;\n }\n if (thisPlugin._dbSemconvStability & SemconvStability.STABLE) {\n attributes[ATTR_DB_SYSTEM_NAME] = DB_SYSTEM_NAME_VALUE_MYSQL;\n attributes[ATTR_DB_NAMESPACE] = database;\n attributes[ATTR_DB_QUERY_TEXT] = dbQueryText;\n }\n if (thisPlugin._netSemconvStability & SemconvStability.OLD) {\n attributes[ATTR_NET_PEER_NAME] = host;\n if (!isNaN(portNumber)) {\n attributes[ATTR_NET_PEER_PORT] = portNumber;\n }\n }\n if (thisPlugin._netSemconvStability & SemconvStability.STABLE) {\n attributes[ATTR_SERVER_ADDRESS] = host;\n if (!isNaN(portNumber)) {\n attributes[ATTR_SERVER_PORT] = portNumber;\n }\n }\n const span = thisPlugin.tracer.startSpan(getSpanName(query), {\n kind: SpanKind.CLIENT,\n attributes,\n });\n\n if (thisPlugin.getConfig().enhancedDatabaseReporting) {\n let values;\n\n if (Array.isArray(_valuesOrCallback)) {\n values = _valuesOrCallback;\n } else if (arguments[2]) {\n values = [_valuesOrCallback];\n }\n\n span.setAttribute(AttributeNames.MYSQL_VALUES, getDbValues(query, values));\n }\n\n const cbIndex = Array.from(arguments).findIndex(arg => typeof arg === 'function');\n\n const parentContext = context.active();\n\n if (cbIndex === -1) {\n const streamableQuery: mysqlTypes.Query = context.with(trace.setSpan(context.active(), span), () => {\n return originalQuery.apply(connection, arguments);\n });\n context.bind(parentContext, streamableQuery);\n\n return streamableQuery\n .on('error', err =>\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n }),\n )\n .on('end', () => {\n span.end();\n });\n } else {\n thisPlugin._wrap(arguments, cbIndex, thisPlugin._patchCallbackQuery(span, parentContext));\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return originalQuery.apply(connection, arguments);\n });\n }\n };\n };\n }\n\n private _patchCallbackQuery(span: Span, parentContext: Context) {\n return (originalCallback: Function) => {\n return function (err: mysqlTypes.MysqlError | null, results?: any, fields?: mysqlTypes.FieldInfo[]) {\n if (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n }\n span.end();\n return context.with(parentContext, () => originalCallback(...arguments));\n };\n };\n }\n\n private _setPoolCallbacks(pool: mysqlTypes.Pool, id: string) {\n const poolNameOld = id || getPoolNameOld(pool);\n\n pool.on('connection', _connection => {\n this._connCountAdd(1, poolNameOld, 'idle');\n });\n\n pool.on('acquire', _connection => {\n this._connCountAdd(-1, poolNameOld, 'idle');\n this._connCountAdd(1, poolNameOld, 'used');\n });\n\n pool.on('release', _connection => {\n this._connCountAdd(1, poolNameOld, 'idle');\n this._connCountAdd(-1, poolNameOld, 'used');\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;AA8CA,MAAM,YAAA,GAAe,+BAAA;AAId,MAAM,6BAA6B,mBAAA,CAAgD;AAAA,EAKxF,WAAA,CAAY,MAAA,GAAqC,EAAC,EAAG;AACnD,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AACvC,IAAA,IAAA,CAAK,2BAAA,EAA4B;AAAA,EACnC;AAAA;AAAA,EAGQ,2BAAA,GAA8B;AACpC,IAAA,IAAA,CAAK,oBAAA,GAAuB,uBAAA,CAAwB,MAAA,EAAQ,OAAA,CAAQ,IAAI,6BAA6B,CAAA;AACrG,IAAA,IAAA,CAAK,mBAAA,GAAsB,uBAAA,CAAwB,UAAA,EAAY,OAAA,CAAQ,IAAI,6BAA6B,CAAA;AAAA,EAC1G;AAAA,EAEmB,wBAAA,GAA2B;AAC5C,IAAA,IAAA,CAAK,oBAAA,GAAuB,IAAA,CAAK,KAAA,CAAM,mBAAA,CAAoB,kCAAA,EAAoC;AAAA,MAC7F,WAAA,EAAa,yFAAA;AAAA,MACb,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,aAAA,CAAc,CAAA,EAAW,WAAA,EAAqB,KAAA,EAAe;AACnE,IAAA,IAAA,CAAK,sBAAsB,GAAA,CAAI,CAAA,EAAG,EAAE,KAAA,EAAO,IAAA,EAAM,aAAa,CAAA;AAAA,EAChE;AAAA,EAEU,IAAA,GAAO;AACf,IAAA,OAAO;AAAA,MACL,IAAI,mCAAA;AAAA,QACF,OAAA;AAAA,QACA,CAAC,YAAY,CAAA;AAAA,QACb,CAAC,aAAA,KAAqC;AACpC,UAAA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,EAAA,CAAG,WAAW,CAAA,WAAA,KAAe;AAChC,MAAA,IAAA,CAAK,aAAA,CAAc,EAAA,EAAI,WAAA,EAAa,MAAM,CAAA;AAC1C,MAAA,IAAA,CAAK,aAAA,CAAc,CAAA,EAAG,WAAA,EAAa,MAAM,CAAA;AAAA,IAC3C,CAAC,CAAA;AAED,IAAA,IAAA,CAAK,EAAA,CAAG,WAAW,CAAA,WAAA,KAAe;AAChC,MAAA,IAAA,CAAK,aAAA,CAAc,CAAA,EAAG,WAAA,EAAa,MAAM,CAAA;AACzC,MAAA,IAAA,CAAK,aAAA,CAAc,EAAA,EAAI,WAAA,EAAa,MAAM,CAAA;AAAA,IAC5C,CAAC,CAAA;AAAA,EACH;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/mysql/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql\n * - Upstream version: @opentelemetry/instrumentation-mysql@0.64.0\n * - Types from the `mysql` package inlined as simplified interfaces\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - Refactored to use Sentry's span APIs instead of OpenTelemetry tracing APIs, and the connection-pool\n * metrics / `enhancedDatabaseReporting` option were removed (unused by the Sentry SDK)\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Scope, SpanAttributes } from '@sentry/core';\nimport {\n bindScopeToEmitter,\n getCurrentScope,\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n withActiveSpan,\n withScope,\n} from '@sentry/core';\nimport type * as mysqlTypes from './mysql-types';\nimport {\n ATTR_DB_CONNECTION_STRING,\n ATTR_DB_NAME,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_DB_USER,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_MYSQL,\n} from './semconv';\nimport { getConfig, getDbQueryText, getJDBCString, getSpanName } from './utils';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-mysql';\nconst ORIGIN = 'auto.db.otel.mysql';\n\ntype getConnectionCallbackType = (err: mysqlTypes.MysqlError, connection: mysqlTypes.PoolConnection) => void;\n\nexport class MySQLInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init() {\n return [\n new InstrumentationNodeModuleDefinition(\n 'mysql',\n ['>=2.0.0 <3'],\n (moduleExports: typeof mysqlTypes) => {\n if (isWrapped(moduleExports.createConnection)) {\n this._unwrap(moduleExports, 'createConnection');\n }\n // oxlint-disable-next-line typescript/no-explicit-any\n this._wrap(moduleExports, 'createConnection', this._patchCreateConnection() as any);\n\n if (isWrapped(moduleExports.createPool)) {\n this._unwrap(moduleExports, 'createPool');\n }\n // oxlint-disable-next-line typescript/no-explicit-any\n this._wrap(moduleExports, 'createPool', this._patchCreatePool() as any);\n\n if (isWrapped(moduleExports.createPoolCluster)) {\n this._unwrap(moduleExports, 'createPoolCluster');\n }\n // oxlint-disable-next-line typescript/no-explicit-any\n this._wrap(moduleExports, 'createPoolCluster', this._patchCreatePoolCluster() as any);\n\n return moduleExports;\n },\n (moduleExports: typeof mysqlTypes) => {\n if (moduleExports === undefined) return;\n this._unwrap(moduleExports, 'createConnection');\n this._unwrap(moduleExports, 'createPool');\n this._unwrap(moduleExports, 'createPoolCluster');\n },\n ),\n ];\n }\n\n // global export function\n private _patchCreateConnection() {\n return (originalCreateConnection: Function) => {\n // oxlint-disable-next-line typescript/no-this-alias\n const thisPlugin = this;\n\n return function createConnection(_connectionUri: string | mysqlTypes.ConnectionConfig) {\n const originalResult = originalCreateConnection(...arguments);\n\n // This is unwrapped on next call after unpatch\n // oxlint-disable-next-line typescript/no-explicit-any\n thisPlugin._wrap(originalResult, 'query', thisPlugin._patchQuery(originalResult) as any);\n\n return originalResult;\n };\n };\n }\n\n // global export function\n private _patchCreatePool() {\n return (originalCreatePool: Function) => {\n // oxlint-disable-next-line typescript/no-this-alias\n const thisPlugin = this;\n return function createPool(_config: string | mysqlTypes.PoolConfig) {\n const pool = originalCreatePool(...arguments);\n\n thisPlugin._wrap(pool, 'query', thisPlugin._patchQuery(pool));\n thisPlugin._wrap(pool, 'getConnection', thisPlugin._patchGetConnection(pool));\n\n return pool;\n };\n };\n }\n\n // global export function\n private _patchCreatePoolCluster() {\n return (originalCreatePoolCluster: Function) => {\n // oxlint-disable-next-line typescript/no-this-alias\n const thisPlugin = this;\n return function createPool(_config: string | mysqlTypes.PoolConfig) {\n const cluster = originalCreatePoolCluster(...arguments);\n\n // This is unwrapped on next call after unpatch\n thisPlugin._wrap(cluster, 'getConnection', thisPlugin._patchGetConnection(cluster));\n\n return cluster;\n };\n };\n }\n\n // method on cluster or pool\n private _patchGetConnection(pool: mysqlTypes.Pool | mysqlTypes.PoolCluster) {\n return (originalGetConnection: Function) => {\n // oxlint-disable-next-line typescript/no-this-alias\n const thisPlugin = this;\n\n return function getConnection(arg1?: unknown, arg2?: unknown, arg3?: unknown) {\n // Unwrap if unpatch has been called\n if (!thisPlugin['_enabled']) {\n thisPlugin._unwrap(pool, 'getConnection');\n return originalGetConnection.apply(pool, arguments);\n }\n\n if (arguments.length === 1 && typeof arg1 === 'function') {\n const patchFn = thisPlugin._getConnectionCallbackPatchFn(arg1 as getConnectionCallbackType);\n return originalGetConnection.call(pool, patchFn);\n }\n if (arguments.length === 2 && typeof arg2 === 'function') {\n const patchFn = thisPlugin._getConnectionCallbackPatchFn(arg2 as getConnectionCallbackType);\n return originalGetConnection.call(pool, arg1, patchFn);\n }\n if (arguments.length === 3 && typeof arg3 === 'function') {\n const patchFn = thisPlugin._getConnectionCallbackPatchFn(arg3 as getConnectionCallbackType);\n return originalGetConnection.call(pool, arg1, arg2, patchFn);\n }\n\n return originalGetConnection.apply(pool, arguments);\n };\n };\n }\n\n private _getConnectionCallbackPatchFn(cb: getConnectionCallbackType) {\n // oxlint-disable-next-line typescript/no-this-alias\n const thisPlugin = this;\n const scope = getCurrentScope();\n return function (this: unknown, err: mysqlTypes.MysqlError, connection: mysqlTypes.PoolConnection) {\n if (connection) {\n // this is the callback passed into a query\n // no need to unwrap\n if (!isWrapped(connection.query)) {\n // oxlint-disable-next-line typescript/no-explicit-any\n thisPlugin._wrap(connection, 'query', thisPlugin._patchQuery(connection) as any);\n }\n }\n if (typeof cb === 'function') {\n withScope(scope, () => cb.call(this, err, connection));\n }\n };\n }\n\n private _patchQuery(connection: mysqlTypes.Connection | mysqlTypes.Pool) {\n return (originalQuery: Function) => {\n // oxlint-disable-next-line typescript/no-this-alias\n const thisPlugin = this;\n\n return function query(\n query: string | mysqlTypes.Query | mysqlTypes.QueryOptions,\n _valuesOrCallback?: unknown[] | mysqlTypes.queryCallback,\n _callback?: mysqlTypes.queryCallback,\n ) {\n if (!thisPlugin['_enabled']) {\n thisPlugin._unwrap(connection, 'query');\n return originalQuery.apply(connection, arguments);\n }\n\n const { host, port, database, user } = getConfig(connection.config);\n const portNumber = parseInt(String(port), 10);\n /* eslint-disable @sentry/no-deprecated-attributes */\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL,\n [ATTR_DB_CONNECTION_STRING]: getJDBCString(host, port, database),\n [ATTR_DB_NAME]: database,\n [ATTR_DB_USER]: user,\n [ATTR_DB_STATEMENT]: getDbQueryText(query),\n [ATTR_NET_PEER_NAME]: host,\n };\n\n if (!isNaN(portNumber)) {\n attributes[ATTR_NET_PEER_PORT] = portNumber;\n }\n /* eslint-enable @sentry/no-deprecated-attributes */\n\n const span = startInactiveSpan({\n name: getSpanName(query),\n kind: SPAN_KIND.CLIENT,\n attributes,\n });\n\n const cbIndex = Array.from(arguments).findIndex(arg => typeof arg === 'function');\n\n const scope = getCurrentScope();\n if (cbIndex === -1) {\n const streamableQuery: mysqlTypes.Query = withActiveSpan(span, () => {\n return originalQuery.apply(connection, arguments);\n });\n bindScopeToEmitter(streamableQuery, scope);\n\n return streamableQuery\n .on('error', (err: unknown) => {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: (err as mysqlTypes.MysqlError).message,\n });\n })\n .on('end', () => {\n span.end();\n });\n } else {\n thisPlugin._wrap(arguments, cbIndex, thisPlugin._patchCallbackQuery(span, scope));\n\n return withActiveSpan(span, () => {\n return originalQuery.apply(connection, arguments);\n });\n }\n };\n };\n }\n\n private _patchCallbackQuery(span: Span, scope: Scope) {\n return (originalCallback: Function) => {\n return function (err: mysqlTypes.MysqlError | null, _results?: unknown, _fields?: mysqlTypes.FieldInfo[]) {\n if (err) {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: err.message,\n });\n }\n span.end();\n return withScope(scope, () => originalCallback(...arguments));\n };\n };\n }\n}\n"],"names":[],"mappings":";;;;;AAyCA,MAAM,YAAA,GAAe,+BAAA;AACrB,MAAM,MAAA,GAAS,oBAAA;AAIR,MAAM,6BAA6B,mBAAA,CAA2C;AAAA,EAC5E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,YAAA,EAAc,aAAa,MAAM,CAAA;AAAA,EACzC;AAAA,EAEU,IAAA,GAAO;AACf,IAAA,OAAO;AAAA,MACL,IAAI,mCAAA;AAAA,QACF,OAAA;AAAA,QACA,CAAC,YAAY,CAAA;AAAA,QACb,CAAC,aAAA,KAAqC;AACpC,UAAA,IAAI,SAAA,CAAU,aAAA,CAAc,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,mBAAA,CAAoB,MAAY,KAAA,EAAc;AACpD,IAAA,OAAO,CAAC,gBAAA,KAA+B;AACrC,MAAA,OAAO,SAAU,GAAA,EAAmC,QAAA,EAAoB,OAAA,EAAkC;AACxG,QAAA,IAAI,GAAA,EAAK;AACP,UAAA,IAAA,CAAK,SAAA,CAAU;AAAA,YACb,IAAA,EAAM,iBAAA;AAAA,YACN,SAAS,GAAA,CAAI;AAAA,WACd,CAAA;AAAA,QACH;AACA,QAAA,IAAA,CAAK,GAAA,EAAI;AACT,QAAA,OAAO,UAAU,KAAA,EAAO,MAAM,gBAAA,CAAiB,GAAG,SAAS,CAAC,CAAA;AAAA,MAC9D,CAAA;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
|
|
@@ -6,7 +6,6 @@ const ATTR_DB_USER = "db.user";
|
|
|
6
6
|
const ATTR_NET_PEER_NAME = "net.peer.name";
|
|
7
7
|
const ATTR_NET_PEER_PORT = "net.peer.port";
|
|
8
8
|
const DB_SYSTEM_VALUE_MYSQL = "mysql";
|
|
9
|
-
const METRIC_DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage";
|
|
10
9
|
|
|
11
|
-
export { ATTR_DB_CONNECTION_STRING, ATTR_DB_NAME, ATTR_DB_STATEMENT, ATTR_DB_SYSTEM, ATTR_DB_USER, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT, DB_SYSTEM_VALUE_MYSQL
|
|
10
|
+
export { ATTR_DB_CONNECTION_STRING, ATTR_DB_NAME, ATTR_DB_STATEMENT, ATTR_DB_SYSTEM, ATTR_DB_USER, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT, DB_SYSTEM_VALUE_MYSQL };
|
|
12
11
|
//# sourceMappingURL=semconv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/mysql/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql\n * - Upstream version: @opentelemetry/instrumentation-mysql@0.64.0\n */\n
|
|
1
|
+
{"version":3,"file":"semconv.js","sources":["../../../../../../src/integrations/tracing/mysql/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-mysql\n * - Upstream version: @opentelemetry/instrumentation-mysql@0.64.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * Deprecated, use `server.address`, `server.port` attributes instead.\n *\n * @example \"Server=(localdb)\\\\v11.0;Integrated Security=true;\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `server.address` and `server.port`.\n */\nexport const ATTR_DB_CONNECTION_STRING = 'db.connection_string' as const;\n\n/**\n * Deprecated, use `db.namespace` instead.\n *\n * @example customers\n * @example main\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.namespace`.\n */\nexport const ATTR_DB_NAME = 'db.name' as const;\n\n/**\n * The database statement being executed.\n *\n * @example SELECT * FROM wuser_table\n * @example SET mykey \"WuValue\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.query.text`.\n */\nexport const ATTR_DB_STATEMENT = 'db.statement' as const;\n\n/**\n * Deprecated, use `db.system.name` instead.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.system.name`.\n */\nexport const ATTR_DB_SYSTEM = 'db.system' as const;\n\n/**\n * Deprecated, no replacement at this time.\n *\n * @example readonly_user\n * @example reporting_user\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Removed, no replacement at this time.\n */\nexport const ATTR_DB_USER = 'db.user' as const;\n\n/**\n * Deprecated, use `server.address` on client spans and `client.address` on server spans.\n *\n * @example example.com\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `server.address` on client spans and `client.address` on server spans.\n */\nexport const ATTR_NET_PEER_NAME = 'net.peer.name' as const;\n\n/**\n * Deprecated, use `server.port` on client spans and `client.port` on server spans.\n *\n * @example 8080\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `server.port` on client spans and `client.port` on server spans.\n */\nexport const ATTR_NET_PEER_PORT = 'net.peer.port' as const;\n\n/**\n * Enum value \"mysql\" for attribute {@link ATTR_DB_SYSTEM}.\n *\n * MySQL\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const DB_SYSTEM_VALUE_MYSQL = 'mysql' as const;\n"],"names":[],"mappings":"AAwBO,MAAM,yBAAA,GAA4B;AAYlC,MAAM,YAAA,GAAe;AAYrB,MAAM,iBAAA,GAAoB;AAS1B,MAAM,cAAA,GAAiB;AAYvB,MAAM,YAAA,GAAe;AAWrB,MAAM,kBAAA,GAAqB;AAW3B,MAAM,kBAAA,GAAqB;AAS3B,MAAM,qBAAA,GAAwB;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function getConfig(config) {
|
|
2
|
-
const
|
|
2
|
+
const resolved = config?.connectionConfig || config || {};
|
|
3
|
+
const { host, port, database, user } = resolved;
|
|
3
4
|
return { host, port, database, user };
|
|
4
5
|
}
|
|
5
6
|
function getJDBCString(host, port, database) {
|
|
@@ -19,13 +20,6 @@ function getDbQueryText(query) {
|
|
|
19
20
|
return query.sql;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
function getDbValues(query, values) {
|
|
23
|
-
if (typeof query === "string") {
|
|
24
|
-
return arrayStringifyHelper(values);
|
|
25
|
-
} else {
|
|
26
|
-
return arrayStringifyHelper(values || query.values);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
23
|
function getSpanName(query) {
|
|
30
24
|
const rawQuery = typeof query === "object" ? query.sql : query;
|
|
31
25
|
const firstSpace = rawQuery?.indexOf(" ");
|
|
@@ -34,22 +28,6 @@ function getSpanName(query) {
|
|
|
34
28
|
}
|
|
35
29
|
return rawQuery;
|
|
36
30
|
}
|
|
37
|
-
function arrayStringifyHelper(arr) {
|
|
38
|
-
if (arr) return `[${arr.toString()}]`;
|
|
39
|
-
return "";
|
|
40
|
-
}
|
|
41
|
-
function getPoolNameOld(pool) {
|
|
42
|
-
const c = pool.config.connectionConfig;
|
|
43
|
-
let poolName = "";
|
|
44
|
-
poolName += c?.host ? `host: '${c.host}', ` : "";
|
|
45
|
-
poolName += c?.port ? `port: ${c.port}, ` : "";
|
|
46
|
-
poolName += c?.database ? `database: '${c.database}', ` : "";
|
|
47
|
-
poolName += c?.user ? `user: '${c.user}'` : "";
|
|
48
|
-
if (!c?.user) {
|
|
49
|
-
poolName = poolName.substring(0, poolName.length - 2);
|
|
50
|
-
}
|
|
51
|
-
return poolName.trim();
|
|
52
|
-
}
|
|
53
31
|
|
|
54
|
-
export {
|
|
32
|
+
export { getConfig, getDbQueryText, getJDBCString, getSpanName };
|
|
55
33
|
//# sourceMappingURL=utils.js.map
|