@sentry/server-utils 11.21.0 → 11.23.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/THIRD-PARTY-LICENSES.txt +10 -10
- package/build/cjs/chunks/config.js +4 -2
- package/build/cjs/chunks/config.js.map +1 -1
- package/build/cjs/chunks/core.js +0 -1
- package/build/cjs/chunks/exports.js +76 -28
- package/build/cjs/chunks/exports.js.map +1 -1
- package/build/cjs/chunks/module-details-from-path.js +427 -428
- package/build/cjs/chunks/module-details-from-path.js.map +1 -1
- package/build/cjs/chunks/moduleInjectedTransform.js +419 -421
- package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/chunks/rolldown-runtime.js +8 -6
- package/build/cjs/index.js +95 -41
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.request-handler.js +2 -2
- package/build/cjs/orchestrion/bundler/bun.js +1 -1
- package/build/cjs/orchestrion/bundler/esbuild.js +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +1 -1
- package/build/cjs/orchestrion/bundler/vite.js +2 -2
- package/build/cjs/orchestrion/bundler/webpack-loader.js +2 -2
- package/build/cjs/orchestrion/bundler/webpack.js +4 -4
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/defineProperty.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/assertClassBrand.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/checkPrivateRedeclaration.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldGet2.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldInitSpec.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldSet2.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateMethodInitSpec.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/defineProperty.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPrimitive.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPropertyKey.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/typeof.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/toPrimitive.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/toPropertyKey.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/typeof.js +1 -1
- package/build/esm/_virtual/_rolldown/runtime.js +8 -6
- package/build/esm/ai/anthropic-ai/index.js +2 -2
- package/build/esm/ai/anthropic-ai/streaming.js +11 -2
- package/build/esm/ai/anthropic-ai/streaming.js.map +1 -1
- package/build/esm/ai/anthropic-ai/tool-runner.js +3 -3
- package/build/esm/ai/anthropic-ai/utils.js +2 -2
- package/build/esm/ai/core/span-hooks.js +1 -1
- package/build/esm/ai/core/time-to-first-chunk.js +1 -1
- package/build/esm/ai/core/utils.js +2 -2
- package/build/esm/ai/flue/index.js +2 -2
- package/build/esm/ai/flue/utils.js +2 -2
- package/build/esm/ai/google-genai/decisions.js +1 -1
- package/build/esm/ai/google-genai/index.js +2 -2
- package/build/esm/ai/google-genai/streaming.js +9 -2
- package/build/esm/ai/google-genai/streaming.js.map +1 -1
- package/build/esm/ai/google-genai/utils.js +1 -1
- package/build/esm/ai/langchain/embeddings.js +3 -3
- package/build/esm/ai/langchain/index.js +15 -9
- package/build/esm/ai/langchain/index.js.map +1 -1
- package/build/esm/ai/langchain/typesafe-classifier.js +2 -2
- package/build/esm/ai/langchain/utils.js +3 -4
- package/build/esm/ai/langchain/utils.js.map +1 -1
- package/build/esm/ai/langgraph/agent-span.js +3 -3
- package/build/esm/ai/langgraph/index.js +1 -1
- package/build/esm/ai/langgraph/stream.js +2 -2
- package/build/esm/ai/langgraph/utils.js +3 -3
- package/build/esm/ai/mastra/index.js +2 -2
- package/build/esm/ai/mastra/span-registry.js +1 -1
- package/build/esm/ai/mastra/utils.js +2 -2
- package/build/esm/ai/mistral/index.js +2 -2
- package/build/esm/ai/mistral/streaming.js +18 -9
- package/build/esm/ai/mistral/streaming.js.map +1 -1
- package/build/esm/ai/openai/index.js +2 -2
- package/build/esm/ai/openai/mapping.js +1 -1
- package/build/esm/ai/openai/streaming.js +15 -2
- package/build/esm/ai/openai/streaming.js.map +1 -1
- package/build/esm/ai/openai/utils.js +2 -2
- package/build/esm/ai/pi-ai/chat.js +12 -4
- package/build/esm/ai/pi-ai/chat.js.map +1 -1
- package/build/esm/ai/pi-ai/providers.js +1 -1
- package/build/esm/ai/pi-ai/recording.js +1 -1
- package/build/esm/ai/pi-durable/index.js +2 -2
- package/build/esm/ai/pi-durable/runs.js +3 -3
- package/build/esm/ai/pi-durable/tools.js +3 -3
- package/build/esm/ai/tanstack-ai/index.js +2 -2
- package/build/esm/ai/tanstack-ai/utils.js +2 -2
- package/build/esm/ai/typesafe/index.js +3 -3
- package/build/esm/ai/workers-ai/index.js +2 -2
- package/build/esm/ai/workers-ai/streaming.js +7 -5
- package/build/esm/ai/workers-ai/streaming.js.map +1 -1
- package/build/esm/ai/workers-ai/utils.js +7 -4
- package/build/esm/ai/workers-ai/utils.js.map +1 -1
- package/build/esm/async-context.js +1 -1
- package/build/esm/cron/common.js +1 -1
- package/build/esm/cron/cron.js +1 -1
- package/build/esm/cron/node-cron.js +1 -1
- package/build/esm/cron/node-schedule.js +1 -1
- package/build/esm/eve.js +1 -1
- package/build/esm/integrations/amqplib.js +3 -3
- package/build/esm/integrations/anthropic.js +3 -4
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/aws-sdk/index.js +3 -3
- package/build/esm/integrations/aws-sdk/services/MessageAttributes.js +1 -1
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime-content.js +2 -2
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js +3 -3
- package/build/esm/integrations/aws-sdk/services/dynamodb.js +1 -1
- package/build/esm/integrations/aws-sdk/services/lambda.js +2 -2
- package/build/esm/integrations/aws-sdk/services/sns.js +3 -3
- package/build/esm/integrations/aws-sdk/services/sqs.js +2 -2
- package/build/esm/integrations/bullmq/meter.js +2 -2
- package/build/esm/integrations/bullmq/tracer.js +2 -2
- package/build/esm/integrations/clickhouse.js +3 -3
- package/build/esm/integrations/cron.js +1 -1
- package/build/esm/integrations/dataloader.js +3 -3
- package/build/esm/integrations/express/error-handler.js +1 -1
- package/build/esm/integrations/express/index.js +1 -1
- package/build/esm/integrations/express/instrumentation.js +3 -3
- package/build/esm/integrations/fastify/errors.js +1 -1
- package/build/esm/integrations/fastify/index.js +1 -1
- package/build/esm/integrations/fastify/instrumentation.js +8 -4
- package/build/esm/integrations/fastify/instrumentation.js.map +1 -1
- package/build/esm/integrations/firebase/firestore.js +2 -2
- package/build/esm/integrations/firebase/functions.js +1 -1
- package/build/esm/integrations/firebase/index.js +1 -1
- package/build/esm/integrations/flue.js +1 -1
- package/build/esm/integrations/generic-pool.js +3 -3
- package/build/esm/integrations/google-genai.js +2 -2
- package/build/esm/integrations/graphql/graphql-dc-subscriber.js +3 -3
- package/build/esm/integrations/graphql/index.js +1 -1
- package/build/esm/integrations/graphql/resolvers.js +2 -2
- package/build/esm/integrations/graphql/spans.js +3 -3
- package/build/esm/integrations/groq.js +1 -1
- package/build/esm/integrations/hapi/hapi-error-handler.js +1 -1
- package/build/esm/integrations/hapi/hapi-utils.js +4 -5
- package/build/esm/integrations/hapi/hapi-utils.js.map +1 -1
- package/build/esm/integrations/hapi/index.js +1 -1
- package/build/esm/integrations/hono/applyPatches.js +1 -1
- package/build/esm/integrations/hono/createHonoMiddleware.js +1 -1
- package/build/esm/integrations/hono/honoIntegration.js +3 -3
- package/build/esm/integrations/hono/matchResult.js +1 -1
- package/build/esm/integrations/hono/middlewareHandlers.js +2 -2
- package/build/esm/integrations/hono/patchAppRequest.js +3 -3
- package/build/esm/integrations/hono/patchAppUse.js +1 -1
- package/build/esm/integrations/hono/patchRoute.js +1 -1
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js +3 -3
- package/build/esm/integrations/kafkajs/consumer.js +2 -2
- package/build/esm/integrations/kafkajs/index.js +1 -1
- package/build/esm/integrations/kafkajs/spans.js +2 -2
- package/build/esm/integrations/knex.js +3 -3
- package/build/esm/integrations/koa/index.js +3 -3
- package/build/esm/integrations/langchain.js +1 -1
- package/build/esm/integrations/langgraph.js +1 -1
- package/build/esm/integrations/lru-memoizer.js +1 -1
- package/build/esm/integrations/mastra-classifier.js +2 -2
- package/build/esm/integrations/mastra.js +4 -4
- package/build/esm/integrations/mcp-server.js +2 -2
- package/build/esm/integrations/mistral.js +2 -2
- package/build/esm/integrations/mongodb/index.js +1 -1
- package/build/esm/integrations/mongodb/mongodb-span.js +1 -1
- package/build/esm/integrations/mongoose/index.js +1 -1
- package/build/esm/integrations/mongoose/mongoose-dc-subscriber.js +3 -3
- package/build/esm/integrations/mongoose/mongoose-legacy-span.js +1 -1
- package/build/esm/integrations/mysql.js +3 -3
- package/build/esm/integrations/mysql2/index.js +1 -1
- package/build/esm/integrations/mysql2/mysql2-dc-subscriber.js +3 -3
- package/build/esm/integrations/neon.js +13 -5
- package/build/esm/integrations/neon.js.map +1 -1
- package/build/esm/integrations/nitro/captureStorageEvents.js +3 -3
- package/build/esm/integrations/nitro/captureTracingEvents.js +3 -3
- package/build/esm/integrations/nitro/index.js +1 -1
- package/build/esm/integrations/nitro/setServerTimingHeaders.js +1 -1
- package/build/esm/integrations/node-cron.js +1 -1
- package/build/esm/integrations/node-schedule.js +1 -1
- package/build/esm/integrations/openai-compatible.js +2 -2
- package/build/esm/integrations/openai.js +2 -2
- package/build/esm/integrations/pg.js +43 -16
- package/build/esm/integrations/pg.js.map +1 -1
- package/build/esm/integrations/pi-ai.js +1 -1
- package/build/esm/integrations/pi-durable.js +1 -1
- package/build/esm/integrations/pino.js +1 -1
- package/build/esm/integrations/pino.js.map +1 -1
- package/build/esm/integrations/postgresjs/index.js +3 -3
- package/build/esm/integrations/postgresjs/postgresjs-dc-subscriber.js +3 -3
- package/build/esm/integrations/postgresjs-wrapper.js +1 -1
- package/build/esm/integrations/prisma/index.js +1 -1
- package/build/esm/integrations/prisma/orchestrion.js +8 -12
- package/build/esm/integrations/prisma/orchestrion.js.map +1 -1
- package/build/esm/integrations/prisma/tracing-helper.js +2 -2
- package/build/esm/integrations/redis/index.js +3 -3
- package/build/esm/integrations/redis/ioredis-channel-subscriber.js +3 -3
- package/build/esm/integrations/redis/redis-cache.js +1 -1
- package/build/esm/integrations/redis/redis-dc-subscriber.js +3 -3
- package/build/esm/integrations/serveTunnel.js +2 -2
- package/build/esm/integrations/tanstack-ai.js +1 -1
- package/build/esm/integrations/tedious.js +4 -4
- package/build/esm/integrations/together-ai.js +1 -1
- package/build/esm/integrations/typesafe.js +1 -1
- package/build/esm/integrations/vercel-ai/extract.js +2 -3
- package/build/esm/integrations/vercel-ai/extract.js.map +1 -1
- package/build/esm/integrations/vercel-ai/index.js +1 -1
- package/build/esm/integrations/vercel-ai/util.js +21 -2
- package/build/esm/integrations/vercel-ai/util.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +3 -3
- package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-tool-telemetry.js +3 -3
- package/build/esm/integrations/winston.js +1 -1
- package/build/esm/opentelemetry.js +1 -1
- package/build/esm/orchestrion/bundler/esbuild.js +1 -1
- package/build/esm/orchestrion/bundler/externalRequire.js +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +1 -1
- package/build/esm/orchestrion/bundler/webpack-loader.js +1 -1
- package/build/esm/orchestrion/bundler/webpack.js +1 -1
- package/build/esm/orchestrion/config/index.js +1 -1
- package/build/esm/orchestrion/config/mistral.js +1 -1
- package/build/esm/orchestrion/config/mistral.js.map +1 -1
- package/build/esm/orchestrion/config/prisma.js +2 -0
- package/build/esm/orchestrion/config/prisma.js.map +1 -1
- package/build/esm/orchestrion/detect.js +1 -1
- package/build/esm/orchestrion/instrumentation.js +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/tracing-channel.js +1 -2
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/utils/cronMonitoring.js +1 -1
- package/build/esm/utils/diagnosticsChannel.js +1 -1
- package/build/esm/utils/module.js +2 -2
- package/build/esm/utils/module.js.map +1 -1
- package/build/esm/utils/monitorStream.js +1 -1
- package/build/esm/utils/serverTimingTraceHeader.js +1 -1
- package/build/esm/utils/tunnelServer.js +1 -1
- package/build/esm/utils/wrapServerRequestHandler.js +4 -4
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/matcher.js +3 -3
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transformer.js +5 -5
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/core-BiWIBBjf.js +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js +1 -1
- package/build/esm/vendored/esquery/dist/esquery.min.js +1 -0
- package/build/esm/vendored/esquery/dist/esquery.min.js.map +1 -1
- package/build/esm/vendored/meriyah/dist/meriyah.js +416 -418
- package/build/esm/vendored/meriyah/dist/meriyah.js.map +1 -1
- package/build/esm/vendored/meriyah/dist/meriyah2.js +416 -418
- package/build/esm/vendored/meriyah/dist/meriyah2.js.map +1 -1
- package/build/esm/vendored/source-map/lib/base64-vlq.js +1 -1
- package/build/esm/vendored/source-map/lib/base64-vlq.js.map +1 -1
- package/build/types/ai/anthropic-ai/streaming.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/types.d.ts +1 -0
- package/build/types/ai/anthropic-ai/types.d.ts.map +1 -1
- package/build/types/ai/google-genai/streaming.d.ts.map +1 -1
- package/build/types/ai/langchain/index.d.ts.map +1 -1
- package/build/types/ai/mistral/streaming.d.ts.map +1 -1
- package/build/types/ai/openai/streaming.d.ts.map +1 -1
- package/build/types/ai/pi-ai/chat.d.ts.map +1 -1
- package/build/types/ai/workers-ai/streaming.d.ts.map +1 -1
- package/build/types/ai/workers-ai/utils.d.ts.map +1 -1
- package/build/types/integrations/fastify/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/neon.d.ts.map +1 -1
- package/build/types/integrations/pg.d.ts +6 -1
- package/build/types/integrations/pg.d.ts.map +1 -1
- package/build/types/integrations/pino.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/extract.d.ts +2 -5
- package/build/types/integrations/vercel-ai/extract.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/util.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +1 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/mistral.d.ts +3 -3
- package/build/types/orchestrion/config/prisma.d.ts +2 -1
- package/build/types/orchestrion/config/prisma.d.ts.map +1 -1
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -15,12 +15,14 @@ var __esmMin = (fn, res, err) => () => {
|
|
|
15
15
|
};
|
|
16
16
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
17
17
|
var __copyProps = (to, from, except, desc) => {
|
|
18
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
19
|
-
key
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
20
|
+
desc = __getOwnPropDesc(from, key);
|
|
21
|
+
__defProp(to, key, {
|
|
22
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
23
|
+
enumerable: !desc || desc.enumerable
|
|
24
|
+
});
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
return to;
|
|
26
28
|
};
|
package/build/cjs/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./chunks/rolldown-runtime.js");
|
|
3
3
|
const require_exports = require("./chunks/exports.js");
|
|
4
|
+
let _sentry_core = require("@sentry/core");
|
|
4
5
|
const require_debug_build = require("./chunks/debug-build.js");
|
|
5
|
-
const require_config = require("./chunks/config.js");
|
|
6
|
-
const require_pi_ai = require("./chunks/pi-ai.js");
|
|
7
6
|
let _sentry_conventions_attributes = require("@sentry/conventions/attributes");
|
|
8
|
-
let _sentry_core = require("@sentry/core");
|
|
9
7
|
let _sentry_conventions_op = require("@sentry/conventions/op");
|
|
10
|
-
let _sentry_core_server = require("@sentry/core/server");
|
|
11
8
|
let node_diagnostics_channel = require("node:diagnostics_channel");
|
|
12
|
-
|
|
9
|
+
const require_config = require("./chunks/config.js");
|
|
10
|
+
const require_pi_ai = require("./chunks/pi-ai.js");
|
|
13
11
|
let _sentry_conventions_metrics = require("@sentry/conventions/metrics");
|
|
14
12
|
let node_module = require("node:module");
|
|
15
13
|
let node_path = require("node:path");
|
|
16
14
|
let node_url = require("node:url");
|
|
15
|
+
let _sentry_core_server = require("@sentry/core/server");
|
|
17
16
|
let node_events = require("node:events");
|
|
18
17
|
let node_net = require("node:net");
|
|
18
|
+
node_diagnostics_channel = require_rolldown_runtime.__toESM(node_diagnostics_channel);
|
|
19
19
|
node_net = require_rolldown_runtime.__toESM(node_net);
|
|
20
20
|
// src/integrations/koa/koa-error-handler.ts
|
|
21
21
|
const ERROR_HANDLER_ATTACHED = "__SENTRY_KOA_ERROR_HANDLER_ATTACHED__";
|
|
@@ -260,8 +260,7 @@ function wrapExtArguments(args, pluginName) {
|
|
|
260
260
|
return;
|
|
261
261
|
} else if (isDirectExtInput(args)) {
|
|
262
262
|
const extInput = args;
|
|
263
|
-
|
|
264
|
-
args[1] = wrapExtMethods(method, extInput[0], pluginName);
|
|
263
|
+
args[1] = wrapExtMethods(extInput[1], extInput[0], pluginName);
|
|
265
264
|
return;
|
|
266
265
|
} else if (isLifecycleExtEventObj(args[0])) {
|
|
267
266
|
const lifecycleEventObj = args[0];
|
|
@@ -460,7 +459,6 @@ function getErrorInfo(error) {
|
|
|
460
459
|
};
|
|
461
460
|
}
|
|
462
461
|
function getStoreWithActiveSpan(asyncLocalStorage, span) {
|
|
463
|
-
if ((0, _sentry_core.spanIsIgnored)(span) && (0, _sentry_core.getRootSpan)(span) !== span) return asyncLocalStorage.getStore();
|
|
464
462
|
return (0, _sentry_core.withActiveSpan)(span, () => {
|
|
465
463
|
return asyncLocalStorage.getStore();
|
|
466
464
|
});
|
|
@@ -766,6 +764,10 @@ function onRequest(request, _reply, hookDone) {
|
|
|
766
764
|
const routeName = getRequestRouteUrl(request);
|
|
767
765
|
const method = request.method || "GET";
|
|
768
766
|
(0, _sentry_core.getIsolationScope)().setTransactionName(`${method} ${routeName}`);
|
|
767
|
+
if (!(0, _sentry_core.getActiveSpan)()) {
|
|
768
|
+
hookDone();
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
769
771
|
const attributes = {
|
|
770
772
|
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$23,
|
|
771
773
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.HANDLER,
|
|
@@ -864,7 +866,7 @@ function handlerWrapper(handler, hookName, spanAttributes = {}) {
|
|
|
864
866
|
if (!request) return handler.call(this, ...args);
|
|
865
867
|
const parentSpan = request[kRequestSpan] ?? void 0;
|
|
866
868
|
const effectiveParentSpan = parentSpan ?? (0, _sentry_core.getActiveSpan)();
|
|
867
|
-
if (effectiveParentSpan
|
|
869
|
+
if (!effectiveParentSpan || !(0, _sentry_core.spanIsSampled)(effectiveParentSpan)) return handler.call(this, ...args);
|
|
868
870
|
const handlerName = handler.name?.length > 0 ? handler.name : this.pluginName ?? ANONYMOUS_FUNCTION_NAME;
|
|
869
871
|
const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];
|
|
870
872
|
const op = hookType === HOOK_TYPE_INSTANCE ? _sentry_conventions_op.MIDDLEWARE : hookType === HOOK_TYPE_HANDLER ? _sentry_conventions_op.HANDLER : void 0;
|
|
@@ -1296,7 +1298,7 @@ function patchConsumption(result, span, end) {
|
|
|
1296
1298
|
const toArray = result.toArray;
|
|
1297
1299
|
const asyncIterator = result[Symbol.asyncIterator];
|
|
1298
1300
|
const patchedToArray = function() {
|
|
1299
|
-
return
|
|
1301
|
+
return (0, _sentry_core.withActiveSpan)(span, () => toArray.call(this)).then((value) => {
|
|
1300
1302
|
end();
|
|
1301
1303
|
return value;
|
|
1302
1304
|
}, (error) => {
|
|
@@ -1305,16 +1307,12 @@ function patchConsumption(result, span, end) {
|
|
|
1305
1307
|
});
|
|
1306
1308
|
};
|
|
1307
1309
|
const patchedAsyncIterator = function() {
|
|
1308
|
-
return wrapIterator(
|
|
1310
|
+
return wrapIterator((0, _sentry_core.withActiveSpan)(span, () => asyncIterator.call(this)), span, end);
|
|
1309
1311
|
};
|
|
1310
1312
|
result.toArray = patchedToArray;
|
|
1311
1313
|
result[Symbol.asyncIterator] = patchedAsyncIterator;
|
|
1312
1314
|
return true;
|
|
1313
1315
|
}
|
|
1314
|
-
function runUnderSpan(span, callback) {
|
|
1315
|
-
if ((0, _sentry_core.spanIsIgnored)(span) && (0, _sentry_core.getRootSpan)(span) !== span) return callback();
|
|
1316
|
-
return (0, _sentry_core.withActiveSpan)(span, callback);
|
|
1317
|
-
}
|
|
1318
1316
|
function wrapIterator(iterator, span, end) {
|
|
1319
1317
|
const settle = (step) => step.then((result) => {
|
|
1320
1318
|
if (result.done) end();
|
|
@@ -1324,7 +1322,7 @@ function wrapIterator(iterator, span, end) {
|
|
|
1324
1322
|
throw error;
|
|
1325
1323
|
});
|
|
1326
1324
|
return {
|
|
1327
|
-
next: (...args) => settle(
|
|
1325
|
+
next: (...args) => settle((0, _sentry_core.withActiveSpan)(span, () => iterator.next(...args))),
|
|
1328
1326
|
return: (value) => {
|
|
1329
1327
|
const iteratorReturn = iterator.return?.bind(iterator);
|
|
1330
1328
|
if (!iteratorReturn) {
|
|
@@ -1334,7 +1332,7 @@ function wrapIterator(iterator, span, end) {
|
|
|
1334
1332
|
value
|
|
1335
1333
|
});
|
|
1336
1334
|
}
|
|
1337
|
-
return settle(
|
|
1335
|
+
return settle((0, _sentry_core.withActiveSpan)(span, () => iteratorReturn(value)));
|
|
1338
1336
|
},
|
|
1339
1337
|
throw: (error) => {
|
|
1340
1338
|
const iteratorThrow = iterator.throw?.bind(iterator);
|
|
@@ -1342,7 +1340,7 @@ function wrapIterator(iterator, span, end) {
|
|
|
1342
1340
|
end(error);
|
|
1343
1341
|
return Promise.reject(error);
|
|
1344
1342
|
}
|
|
1345
|
-
return settle(
|
|
1343
|
+
return settle((0, _sentry_core.withActiveSpan)(span, () => iteratorThrow(error)));
|
|
1346
1344
|
},
|
|
1347
1345
|
[Symbol.asyncIterator]() {
|
|
1348
1346
|
return this;
|
|
@@ -1949,8 +1947,7 @@ function instrumentAnthropic(options) {
|
|
|
1949
1947
|
function createGenAiSpan$4(data, operation, options, stream) {
|
|
1950
1948
|
const args = data.arguments ?? [];
|
|
1951
1949
|
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$32)) return;
|
|
1952
|
-
|
|
1953
|
-
if (isStreamHelperRequest(requestOptions?.headers) && isInsideStreamHelperSpan()) return;
|
|
1950
|
+
if (isStreamHelperRequest(args[1]?.headers) && isInsideStreamHelperSpan()) return;
|
|
1954
1951
|
const params = typeof args[0] === "object" && args[0] !== null ? args[0] : void 0;
|
|
1955
1952
|
const call = {
|
|
1956
1953
|
operation,
|
|
@@ -3615,10 +3612,7 @@ function beforeSchedule(change, options) {
|
|
|
3615
3612
|
* keeps runs from an earlier spec, the job doesn't check in.
|
|
3616
3613
|
*/
|
|
3617
3614
|
function onSchedule(change) {
|
|
3618
|
-
if (change.result === true)
|
|
3619
|
-
const job = change.self;
|
|
3620
|
-
updateMonitorConfig(job?.job, addsToPendingRuns.has(change) ? void 0 : getMonitorConfig(change.arguments[0]));
|
|
3621
|
-
}
|
|
3615
|
+
if (change.result === true) updateMonitorConfig(change.self?.job, addsToPendingRuns.has(change) ? void 0 : getMonitorConfig(change.arguments[0]));
|
|
3622
3616
|
}
|
|
3623
3617
|
/** Whether node-schedule runs a job with this spec once: a `Date`, a timestamp, or a date string. */
|
|
3624
3618
|
function isOneOffSpec(spec) {
|
|
@@ -6361,6 +6355,14 @@ function getRequestContentAttributes(context) {
|
|
|
6361
6355
|
};
|
|
6362
6356
|
}
|
|
6363
6357
|
/**
|
|
6358
|
+
* Whether an event carries new model output. `start`, empty `*_start`, `*_end` and `done` events do not.
|
|
6359
|
+
*/
|
|
6360
|
+
function hasOutput$1(event) {
|
|
6361
|
+
const { type, delta } = event ?? {};
|
|
6362
|
+
if (type === "text_delta" || type === "thinking_delta" || type === "toolcall_delta") return !!delta;
|
|
6363
|
+
return type === "toolcall_start";
|
|
6364
|
+
}
|
|
6365
|
+
/**
|
|
6364
6366
|
* Records `gen_ai.response.time_to_first_chunk` for a streamed request. The stream has one consumer,
|
|
6365
6367
|
* so instead of reading it, this wraps `push`, which the provider calls for each event as it decodes
|
|
6366
6368
|
* it. The wrapper is removed after the first chunk.
|
|
@@ -6369,7 +6371,7 @@ function observePiAiFirstChunk(span, events) {
|
|
|
6369
6371
|
const push = events?.push;
|
|
6370
6372
|
if (!events || typeof push !== "function") return;
|
|
6371
6373
|
events.push = function(event) {
|
|
6372
|
-
if (event
|
|
6374
|
+
if (hasOutput$1(event)) {
|
|
6373
6375
|
require_exports.recordTimeToFirstChunk(span);
|
|
6374
6376
|
events.push = push;
|
|
6375
6377
|
}
|
|
@@ -8848,15 +8850,16 @@ function instrumentPostgres(options) {
|
|
|
8848
8850
|
* streamable `Submittable` result, so it's the only one that defers span-ending to the emitter.
|
|
8849
8851
|
*/
|
|
8850
8852
|
function bindPgQueryChannel(channelName, options) {
|
|
8851
|
-
subscribeQueryLikeChannel(channelName, (ctx) => querySpanOptions(ctx, options), {
|
|
8853
|
+
subscribeQueryLikeChannel(channelName, (ctx) => querySpanOptions(ctx, options), { isQuery: true });
|
|
8852
8854
|
}
|
|
8853
8855
|
/**
|
|
8854
8856
|
* Subscribe to a pg tracing-channel and manage a span across its lifecycle.
|
|
8855
8857
|
* Shared by the query/connect/pool-connect channels. They differ only in how
|
|
8856
8858
|
* the span's name + attributes are built (`getSpanOptions`), and whether the
|
|
8857
|
-
* result can be a streamable emitter
|
|
8859
|
+
* result is a query result that can be a streamable emitter and carries a row
|
|
8860
|
+
* count (`isQuery`).
|
|
8858
8861
|
*/
|
|
8859
|
-
function subscribeQueryLikeChannel(channelName, getSpanOptions, {
|
|
8862
|
+
function subscribeQueryLikeChannel(channelName, getSpanOptions, { isQuery = false } = {}) {
|
|
8860
8863
|
bindTracingChannelToSpan(tracingChannel(channelName), (data) => {
|
|
8861
8864
|
data._sentryCallerScope = (0, _sentry_core.getCurrentScope)();
|
|
8862
8865
|
const spanOptions = getSpanOptions(data);
|
|
@@ -8868,15 +8871,24 @@ function subscribeQueryLikeChannel(channelName, getSpanOptions, { deferStreamedR
|
|
|
8868
8871
|
[_sentry_conventions_attributes.SENTRY_KIND]: "client"
|
|
8869
8872
|
}
|
|
8870
8873
|
});
|
|
8871
|
-
},
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8874
|
+
}, isQuery ? {
|
|
8875
|
+
beforeSpanEnd(span, data) {
|
|
8876
|
+
if ("error" in data || (0, _sentry_core.isObjectLike)(data.result) && hasOnMethod(data.result)) return;
|
|
8877
|
+
setReturnedRows(span, data.result);
|
|
8878
|
+
},
|
|
8879
|
+
deferSpanEnd({ span, data, end }) {
|
|
8880
|
+
const result = data.result;
|
|
8881
|
+
if (!result || typeof result !== "object" || !hasOnMethod(result)) return false;
|
|
8882
|
+
const callerScope = data._sentryCallerScope;
|
|
8883
|
+
if (callerScope) (0, _sentry_core.bindScopeToEmitter)(result, callerScope);
|
|
8884
|
+
result.on("error", (err) => end(err));
|
|
8885
|
+
result.on("end", (endResult) => {
|
|
8886
|
+
if (!hasReadMethod(result)) setReturnedRows(span, endResult);
|
|
8887
|
+
end();
|
|
8888
|
+
});
|
|
8889
|
+
return true;
|
|
8890
|
+
}
|
|
8891
|
+
} : void 0);
|
|
8880
8892
|
}
|
|
8881
8893
|
function querySpanOptions(ctx, { origin, connectionString }) {
|
|
8882
8894
|
const params = ctx.self?.connectionParameters ?? {};
|
|
@@ -8916,6 +8928,23 @@ function poolConnectSpanOptions(ctx) {
|
|
|
8916
8928
|
function hasOnMethod(obj) {
|
|
8917
8929
|
return "on" in obj && typeof obj.on === "function";
|
|
8918
8930
|
}
|
|
8931
|
+
function hasReadMethod(obj) {
|
|
8932
|
+
return "read" in obj && typeof obj.read === "function";
|
|
8933
|
+
}
|
|
8934
|
+
/**
|
|
8935
|
+
* Sets `db.response.returned_rows` from a pg-style result (`{ rowCount, rows }`), or an array of them
|
|
8936
|
+
* (one per statement of a multi-statement query), summed. Sets nothing when no count is known.
|
|
8937
|
+
*/
|
|
8938
|
+
function setReturnedRows(span, results) {
|
|
8939
|
+
const counts = (Array.isArray(results) ? results : [results]).map(getRowCount).filter((count) => count !== void 0);
|
|
8940
|
+
if (counts.length) span.setAttribute(_sentry_conventions_attributes.DB_RESPONSE_RETURNED_ROWS, counts.reduce((sum, count) => sum + count, 0));
|
|
8941
|
+
}
|
|
8942
|
+
function getRowCount(result) {
|
|
8943
|
+
if (!(0, _sentry_core.isObjectLike)(result)) return;
|
|
8944
|
+
const { rowCount, rows } = result;
|
|
8945
|
+
if (typeof rowCount === "number") return rowCount;
|
|
8946
|
+
return Array.isArray(rows) ? rows.length : void 0;
|
|
8947
|
+
}
|
|
8919
8948
|
function extractQueryConfig(args) {
|
|
8920
8949
|
const arg0 = args[0];
|
|
8921
8950
|
if (typeof arg0 === "string") return { text: arg0 };
|
|
@@ -9209,7 +9238,11 @@ function instrumentNeon() {
|
|
|
9209
9238
|
const span = (0, _sentry_core.startInactiveSpan)(httpQuerySpanOptions(data.arguments));
|
|
9210
9239
|
httpQuerySpans.add(span);
|
|
9211
9240
|
return span;
|
|
9212
|
-
})
|
|
9241
|
+
}, { beforeSpanEnd(span, data) {
|
|
9242
|
+
if ("error" in data) return;
|
|
9243
|
+
const { result } = data;
|
|
9244
|
+
setReturnedRows(span, Array.isArray(data.arguments[0]) && Array.isArray(result) ? result.map(toPgResult) : toPgResult(result));
|
|
9245
|
+
} });
|
|
9213
9246
|
tracingChannel(CHANNELS.NEON_RESOLVE_CONNECTION).subscribe({
|
|
9214
9247
|
start: NOOP$2,
|
|
9215
9248
|
end: NOOP$2,
|
|
@@ -9251,6 +9284,9 @@ function httpQuerySpanOptions(args) {
|
|
|
9251
9284
|
attributes
|
|
9252
9285
|
};
|
|
9253
9286
|
}
|
|
9287
|
+
function toPgResult(result) {
|
|
9288
|
+
return Array.isArray(result) ? { rows: result } : result;
|
|
9289
|
+
}
|
|
9254
9290
|
function getBatchOperationName(statements) {
|
|
9255
9291
|
const operations = new Set(statements.map((s) => s[_sentry_conventions_attributes.DB_OPERATION_NAME]?.toUpperCase()));
|
|
9256
9292
|
const [operation] = operations;
|
|
@@ -9622,7 +9658,7 @@ function tapModelCallStream(span, stream, onFinal, onError) {
|
|
|
9622
9658
|
controller.close();
|
|
9623
9659
|
return;
|
|
9624
9660
|
}
|
|
9625
|
-
if (value
|
|
9661
|
+
if (hasOutput(value)) require_exports.recordTimeToFirstChunk(span);
|
|
9626
9662
|
text += accumulateChunk(state, value) ?? "";
|
|
9627
9663
|
controller.enqueue(value);
|
|
9628
9664
|
} catch (error) {
|
|
@@ -9637,6 +9673,25 @@ function tapModelCallStream(span, stream, onFinal, onError) {
|
|
|
9637
9673
|
});
|
|
9638
9674
|
}
|
|
9639
9675
|
/**
|
|
9676
|
+
* Whether a chunk carries new model output, which is what `gen_ai.response.time_to_first_chunk` measures.
|
|
9677
|
+
* `stream-start`, `response-metadata`, empty `*-start` and `finish` chunks do not.
|
|
9678
|
+
*/
|
|
9679
|
+
function hasOutput(chunk) {
|
|
9680
|
+
if (!(0, _sentry_core.isObjectLike)(chunk)) return false;
|
|
9681
|
+
const { type, delta, textDelta, argsTextDelta } = chunk;
|
|
9682
|
+
switch (type) {
|
|
9683
|
+
case "text-delta":
|
|
9684
|
+
case "reasoning-delta":
|
|
9685
|
+
case "tool-input-delta": return !!(delta ?? textDelta);
|
|
9686
|
+
case "reasoning": return !!textDelta;
|
|
9687
|
+
case "tool-call-delta": return !!argsTextDelta;
|
|
9688
|
+
case "tool-input-start":
|
|
9689
|
+
case "tool-call":
|
|
9690
|
+
case "file": return true;
|
|
9691
|
+
default: return false;
|
|
9692
|
+
}
|
|
9693
|
+
}
|
|
9694
|
+
/**
|
|
9640
9695
|
* Fold a single streamed chunk into the running aggregate. Returns any text delta so the caller can
|
|
9641
9696
|
* accumulate it (kept out of `state` until the end to avoid re-joining on every chunk).
|
|
9642
9697
|
*/
|
|
@@ -9672,7 +9727,6 @@ function mapObjectValues(record, fn) {
|
|
|
9672
9727
|
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, (0, _sentry_core.isObjectLike)(value) ? fn(value, key) : value]));
|
|
9673
9728
|
}
|
|
9674
9729
|
// src/integrations/vercel-ai/extract.ts
|
|
9675
|
-
/** Maps the AI SDK `experimental_extract` input and output to the Clairic shape of the `gen_ai.extract` schemas. */
|
|
9676
9730
|
/**
|
|
9677
9731
|
* Joins the text of the AI SDK state parts into one Clairic `state` string. The gateway does this join on
|
|
9678
9732
|
* the server and does not show its separator, so this one is our choice. It only makes the recorded text
|
|
@@ -9733,7 +9787,7 @@ function toExtractAnswers(answers, parts) {
|
|
|
9733
9787
|
return mapObjectValues(answers, ({ pNull, source, items, ...rest }) => {
|
|
9734
9788
|
const mapped = {
|
|
9735
9789
|
...rest,
|
|
9736
|
-
p_null: pNull
|
|
9790
|
+
p_null: asNumber(pNull)
|
|
9737
9791
|
};
|
|
9738
9792
|
const span = toExtractSpan(source, parts);
|
|
9739
9793
|
if (span) {
|