@sentry/server-utils 11.14.0 → 11.15.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/chunks/exports.js +526 -217
- package/build/cjs/chunks/exports.js.map +1 -1
- package/build/cjs/index.js +1028 -120
- package/build/cjs/index.js.map +1 -1
- package/build/esm/ai/anthropic-ai/index.js +32 -56
- package/build/esm/ai/anthropic-ai/index.js.map +1 -1
- package/build/esm/ai/anthropic-ai/streaming.js +10 -6
- package/build/esm/ai/anthropic-ai/streaming.js.map +1 -1
- package/build/esm/ai/anthropic-ai/tool-runner.js +18 -3
- package/build/esm/ai/anthropic-ai/tool-runner.js.map +1 -1
- package/build/esm/ai/anthropic-ai/utils.js +41 -3
- package/build/esm/ai/anthropic-ai/utils.js.map +1 -1
- package/build/esm/ai/core/span-hooks.js +23 -0
- package/build/esm/ai/core/span-hooks.js.map +1 -0
- package/build/esm/ai/core/time-to-first-chunk.js +14 -0
- package/build/esm/ai/core/time-to-first-chunk.js.map +1 -0
- package/build/esm/ai/core/utils.js +29 -3
- package/build/esm/ai/core/utils.js.map +1 -1
- package/build/esm/ai/flue/index.js +15 -12
- package/build/esm/ai/flue/index.js.map +1 -1
- package/build/esm/ai/flue/utils.js +24 -17
- package/build/esm/ai/flue/utils.js.map +1 -1
- package/build/esm/ai/google-genai/index.js +21 -8
- package/build/esm/ai/google-genai/index.js.map +1 -1
- package/build/esm/ai/google-genai/streaming.js +6 -2
- package/build/esm/ai/google-genai/streaming.js.map +1 -1
- package/build/esm/ai/langchain/embeddings.js +5 -2
- package/build/esm/ai/langchain/embeddings.js.map +1 -1
- package/build/esm/ai/langchain/index.js +82 -24
- package/build/esm/ai/langchain/index.js.map +1 -1
- package/build/esm/ai/langchain/utils.js +9 -1
- package/build/esm/ai/langchain/utils.js.map +1 -1
- package/build/esm/ai/langgraph/agent-span.js +13 -5
- package/build/esm/ai/langgraph/agent-span.js.map +1 -1
- package/build/esm/ai/langgraph/index.js +13 -15
- package/build/esm/ai/langgraph/index.js.map +1 -1
- package/build/esm/ai/langgraph/stream.js +4 -3
- package/build/esm/ai/langgraph/stream.js.map +1 -1
- package/build/esm/ai/langgraph/utils.js +17 -8
- package/build/esm/ai/langgraph/utils.js.map +1 -1
- package/build/esm/ai/mastra/classifier-evaluation.js.map +1 -1
- package/build/esm/ai/mastra/index.js +33 -16
- package/build/esm/ai/mastra/index.js.map +1 -1
- package/build/esm/ai/mastra/utils.js +3 -5
- package/build/esm/ai/mastra/utils.js.map +1 -1
- package/build/esm/ai/mistral/index.js +21 -7
- package/build/esm/ai/mistral/index.js.map +1 -1
- package/build/esm/ai/mistral/streaming.js +4 -2
- package/build/esm/ai/mistral/streaming.js.map +1 -1
- package/build/esm/ai/openai/index.js +19 -8
- package/build/esm/ai/openai/index.js.map +1 -1
- package/build/esm/ai/openai/streaming.js +7 -2
- package/build/esm/ai/openai/streaming.js.map +1 -1
- package/build/esm/ai/pi-ai/chat.js +18 -1
- package/build/esm/ai/pi-ai/chat.js.map +1 -1
- package/build/esm/ai/pi-ai/recording.js +34 -15
- package/build/esm/ai/pi-ai/recording.js.map +1 -1
- package/build/esm/ai/pi-durable/index.js +7 -2
- package/build/esm/ai/pi-durable/index.js.map +1 -1
- package/build/esm/ai/pi-durable/runs.js.map +1 -1
- package/build/esm/ai/pi-durable/tools.js +18 -3
- package/build/esm/ai/pi-durable/tools.js.map +1 -1
- package/build/esm/ai/typesafe/index.js +14 -6
- package/build/esm/ai/typesafe/index.js.map +1 -1
- package/build/esm/ai/workers-ai/index.js +26 -9
- package/build/esm/ai/workers-ai/index.js.map +1 -1
- package/build/esm/ai/workers-ai/streaming.js +6 -4
- package/build/esm/ai/workers-ai/streaming.js.map +1 -1
- package/build/esm/cron/common.js +16 -0
- package/build/esm/cron/common.js.map +1 -0
- package/build/esm/cron/cron.js +82 -0
- package/build/esm/cron/cron.js.map +1 -0
- package/build/esm/cron/index.js +13 -0
- package/build/esm/cron/index.js.map +1 -0
- package/build/esm/cron/node-cron.js +66 -0
- package/build/esm/cron/node-cron.js.map +1 -0
- package/build/esm/cron/node-schedule.js +43 -0
- package/build/esm/cron/node-schedule.js.map +1 -0
- package/build/esm/index.js +6 -2
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/anthropic.js +25 -16
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/aws-sdk/index.js +1 -0
- package/build/esm/integrations/aws-sdk/index.js.map +1 -1
- package/build/esm/integrations/aws-sdk/services/ServicesExtensions.js +3 -0
- package/build/esm/integrations/aws-sdk/services/ServicesExtensions.js.map +1 -1
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js +45 -12
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js.map +1 -1
- package/build/esm/integrations/bullmq/contextManager.js +45 -0
- package/build/esm/integrations/bullmq/contextManager.js.map +1 -0
- package/build/esm/integrations/bullmq/index.js +44 -0
- package/build/esm/integrations/bullmq/index.js.map +1 -0
- package/build/esm/integrations/bullmq/meter.js +86 -0
- package/build/esm/integrations/bullmq/meter.js.map +1 -0
- package/build/esm/integrations/bullmq/span.js +114 -0
- package/build/esm/integrations/bullmq/span.js.map +1 -0
- package/build/esm/integrations/bullmq/tracer.js +62 -0
- package/build/esm/integrations/bullmq/tracer.js.map +1 -0
- package/build/esm/integrations/express/instrumentation.js +10 -1
- package/build/esm/integrations/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/google-genai.js +17 -9
- package/build/esm/integrations/google-genai.js.map +1 -1
- package/build/esm/integrations/langgraph.js +5 -7
- package/build/esm/integrations/langgraph.js.map +1 -1
- package/build/esm/integrations/mastra-classifier.js +1 -1
- package/build/esm/integrations/mastra-classifier.js.map +1 -1
- package/build/esm/integrations/mistral.js +13 -4
- package/build/esm/integrations/mistral.js.map +1 -1
- package/build/esm/integrations/openai-compatible.js +16 -8
- package/build/esm/integrations/openai-compatible.js.map +1 -1
- package/build/esm/integrations/openai.js +16 -8
- package/build/esm/integrations/openai.js.map +1 -1
- package/build/esm/integrations/pi-ai.js +39 -18
- package/build/esm/integrations/pi-ai.js.map +1 -1
- package/build/esm/integrations/pino.js +131 -0
- package/build/esm/integrations/pino.js.map +1 -0
- package/build/esm/integrations/typesafe.js +17 -3
- package/build/esm/integrations/typesafe.js.map +1 -1
- package/build/esm/integrations/vercel-ai/index.js.map +1 -1
- package/build/esm/integrations/vercel-ai/util.js +3 -2
- package/build/esm/integrations/vercel-ai/util.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +44 -17
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js +22 -16
- package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
- package/build/esm/integrations/winston.js +90 -0
- package/build/esm/integrations/winston.js.map +1 -0
- package/build/esm/orchestrion/detect.js +1 -1
- package/build/esm/orchestrion/detect.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/ai/anthropic-ai/index.d.ts +1 -5
- package/build/types/ai/anthropic-ai/index.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/streaming.d.ts +3 -2
- package/build/types/ai/anthropic-ai/streaming.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/tool-runner.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/types.d.ts +24 -3
- package/build/types/ai/anthropic-ai/types.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/utils.d.ts +2 -3
- package/build/types/ai/anthropic-ai/utils.d.ts.map +1 -1
- package/build/types/ai/core/span-hooks.d.ts +31 -0
- package/build/types/ai/core/span-hooks.d.ts.map +1 -0
- package/build/types/ai/core/time-to-first-chunk.d.ts +7 -0
- package/build/types/ai/core/time-to-first-chunk.d.ts.map +1 -0
- package/build/types/ai/core/utils.d.ts +30 -1
- package/build/types/ai/core/utils.d.ts.map +1 -1
- package/build/types/ai/flue/index.d.ts +13 -5
- package/build/types/ai/flue/index.d.ts.map +1 -1
- package/build/types/ai/flue/types.d.ts +20 -2
- package/build/types/ai/flue/types.d.ts.map +1 -1
- package/build/types/ai/flue/utils.d.ts +5 -9
- package/build/types/ai/flue/utils.d.ts.map +1 -1
- package/build/types/ai/google-genai/index.d.ts.map +1 -1
- package/build/types/ai/google-genai/streaming.d.ts +2 -1
- package/build/types/ai/google-genai/streaming.d.ts.map +1 -1
- package/build/types/ai/google-genai/types.d.ts +17 -3
- package/build/types/ai/google-genai/types.d.ts.map +1 -1
- package/build/types/ai/langchain/index.d.ts.map +1 -1
- package/build/types/ai/langchain/types.d.ts +49 -3
- package/build/types/ai/langchain/types.d.ts.map +1 -1
- package/build/types/ai/langchain/utils.d.ts +6 -0
- package/build/types/ai/langchain/utils.d.ts.map +1 -1
- package/build/types/ai/langgraph/agent-span.d.ts +4 -1
- package/build/types/ai/langgraph/agent-span.d.ts.map +1 -1
- package/build/types/ai/langgraph/index.d.ts +1 -1
- package/build/types/ai/langgraph/index.d.ts.map +1 -1
- package/build/types/ai/langgraph/stream.d.ts.map +1 -1
- package/build/types/ai/langgraph/types.d.ts +14 -3
- package/build/types/ai/langgraph/types.d.ts.map +1 -1
- package/build/types/ai/langgraph/utils.d.ts +3 -0
- package/build/types/ai/langgraph/utils.d.ts.map +1 -1
- package/build/types/ai/mastra/classifier-evaluation.d.ts +3 -3
- package/build/types/ai/mastra/classifier-evaluation.d.ts.map +1 -1
- package/build/types/ai/mastra/index.d.ts +17 -3
- package/build/types/ai/mastra/index.d.ts.map +1 -1
- package/build/types/ai/mastra/types.d.ts +2 -0
- package/build/types/ai/mastra/types.d.ts.map +1 -1
- package/build/types/ai/mastra/utils.d.ts.map +1 -1
- package/build/types/ai/mistral/index.d.ts.map +1 -1
- package/build/types/ai/mistral/streaming.d.ts +2 -1
- package/build/types/ai/mistral/streaming.d.ts.map +1 -1
- package/build/types/ai/mistral/types.d.ts +14 -3
- package/build/types/ai/mistral/types.d.ts.map +1 -1
- package/build/types/ai/openai/index.d.ts.map +1 -1
- package/build/types/ai/openai/streaming.d.ts +3 -1
- package/build/types/ai/openai/streaming.d.ts.map +1 -1
- package/build/types/ai/openai/types.d.ts +14 -3
- package/build/types/ai/openai/types.d.ts.map +1 -1
- package/build/types/ai/pi-ai/chat.d.ts +7 -1
- package/build/types/ai/pi-ai/chat.d.ts.map +1 -1
- package/build/types/ai/pi-ai/recording.d.ts +21 -9
- package/build/types/ai/pi-ai/recording.d.ts.map +1 -1
- package/build/types/ai/pi-ai/types.d.ts +16 -0
- package/build/types/ai/pi-ai/types.d.ts.map +1 -1
- package/build/types/ai/pi-durable/index.d.ts +12 -3
- package/build/types/ai/pi-durable/index.d.ts.map +1 -1
- package/build/types/ai/pi-durable/runs.d.ts +2 -0
- package/build/types/ai/pi-durable/runs.d.ts.map +1 -1
- package/build/types/ai/pi-durable/tools.d.ts +4 -3
- package/build/types/ai/pi-durable/tools.d.ts.map +1 -1
- package/build/types/ai/pi-durable/types.d.ts +15 -0
- package/build/types/ai/pi-durable/types.d.ts.map +1 -1
- package/build/types/ai/typesafe/index.d.ts +10 -2
- package/build/types/ai/typesafe/index.d.ts.map +1 -1
- package/build/types/ai/workers-ai/index.d.ts.map +1 -1
- package/build/types/ai/workers-ai/streaming.d.ts +2 -1
- package/build/types/ai/workers-ai/streaming.d.ts.map +1 -1
- package/build/types/ai/workers-ai/types.d.ts +18 -3
- package/build/types/ai/workers-ai/types.d.ts.map +1 -1
- package/build/types/cron/common.d.ts +8 -0
- package/build/types/cron/common.d.ts.map +1 -0
- package/build/types/cron/cron.d.ts +45 -0
- package/build/types/cron/cron.d.ts.map +1 -0
- package/build/types/cron/index.d.ts +10 -0
- package/build/types/cron/index.d.ts.map +1 -0
- package/build/types/cron/node-cron.d.ts +33 -0
- package/build/types/cron/node-cron.d.ts.map +1 -0
- package/build/types/cron/node-schedule.d.ts +19 -0
- package/build/types/cron/node-schedule.d.ts.map +1 -0
- package/build/types/index.d.ts +5 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/anthropic.d.ts +2 -1
- package/build/types/integrations/anthropic.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/index.d.ts +3 -3
- package/build/types/integrations/aws-sdk/index.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/services/ServiceExtension.d.ts +1 -0
- package/build/types/integrations/aws-sdk/services/ServiceExtension.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/services/ServicesExtensions.d.ts +3 -2
- package/build/types/integrations/aws-sdk/services/ServicesExtensions.d.ts.map +1 -1
- package/build/types/integrations/aws-sdk/services/bedrock-runtime.d.ts +25 -4
- package/build/types/integrations/aws-sdk/services/bedrock-runtime.d.ts.map +1 -1
- package/build/types/integrations/bullmq/contextManager.d.ts +13 -0
- package/build/types/integrations/bullmq/contextManager.d.ts.map +1 -0
- package/build/types/integrations/bullmq/index.d.ts +43 -0
- package/build/types/integrations/bullmq/index.d.ts.map +1 -0
- package/build/types/integrations/bullmq/meter.d.ts +7 -0
- package/build/types/integrations/bullmq/meter.d.ts.map +1 -0
- package/build/types/integrations/bullmq/span.d.ts +35 -0
- package/build/types/integrations/bullmq/span.d.ts.map +1 -0
- package/build/types/integrations/bullmq/tracer.d.ts +5 -0
- package/build/types/integrations/bullmq/tracer.d.ts.map +1 -0
- package/build/types/integrations/bullmq/types.d.ts +72 -0
- package/build/types/integrations/bullmq/types.d.ts.map +1 -0
- package/build/types/integrations/express/types.d.ts +1 -0
- package/build/types/integrations/express/types.d.ts.map +1 -1
- package/build/types/integrations/flue.d.ts +2 -1
- package/build/types/integrations/flue.d.ts.map +1 -1
- package/build/types/integrations/google-genai.d.ts +2 -1
- package/build/types/integrations/google-genai.d.ts.map +1 -1
- package/build/types/integrations/groq.d.ts +1 -1
- package/build/types/integrations/langchain.d.ts +2 -1
- package/build/types/integrations/langchain.d.ts.map +1 -1
- package/build/types/integrations/langgraph.d.ts +2 -1
- package/build/types/integrations/langgraph.d.ts.map +1 -1
- package/build/types/integrations/mistral.d.ts +2 -1
- package/build/types/integrations/mistral.d.ts.map +1 -1
- package/build/types/integrations/openai-compatible.d.ts.map +1 -1
- package/build/types/integrations/openai.d.ts +2 -1
- package/build/types/integrations/openai.d.ts.map +1 -1
- package/build/types/integrations/pi-ai.d.ts +6 -3
- package/build/types/integrations/pi-ai.d.ts.map +1 -1
- package/build/types/integrations/pi-durable.d.ts +2 -1
- package/build/types/integrations/pi-durable.d.ts.map +1 -1
- package/build/types/integrations/pino.d.ts +61 -0
- package/build/types/integrations/pino.d.ts.map +1 -0
- package/build/types/integrations/together-ai.d.ts +1 -1
- package/build/types/integrations/typesafe.d.ts +2 -2
- package/build/types/integrations/typesafe.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/index.d.ts +3 -3
- package/build/types/integrations/vercel-ai/index.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/util.d.ts +2 -1
- package/build/types/integrations/vercel-ai/util.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts +20 -4
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -1
- package/build/types/integrations/winston.d.ts +55 -0
- package/build/types/integrations/winston.d.ts.map +1 -0
- package/package.json +3 -3
package/build/cjs/index.js
CHANGED
|
@@ -10,6 +10,7 @@ let _sentry_conventions_op = require("@sentry/conventions/op");
|
|
|
10
10
|
let _sentry_core_server = require("@sentry/core/server");
|
|
11
11
|
let node_diagnostics_channel = require("node:diagnostics_channel");
|
|
12
12
|
node_diagnostics_channel = require_rolldown_runtime.__toESM(node_diagnostics_channel);
|
|
13
|
+
let _sentry_conventions_metrics = require("@sentry/conventions/metrics");
|
|
13
14
|
let node_module = require("node:module");
|
|
14
15
|
let node_path = require("node:path");
|
|
15
16
|
let node_url = require("node:url");
|
|
@@ -1190,11 +1191,11 @@ var ActiveTracingHelper = class {
|
|
|
1190
1191
|
if (options.active === false) {
|
|
1191
1192
|
const span = (0, _sentry_core.startInactiveSpan)(spanOptions);
|
|
1192
1193
|
registerPrismaSpan(span.spanContext().spanId, span);
|
|
1193
|
-
return endSpan$
|
|
1194
|
+
return endSpan$2(span, () => callback(span, parentSpan));
|
|
1194
1195
|
}
|
|
1195
1196
|
return (0, _sentry_core.startSpanManual)(spanOptions, (span) => {
|
|
1196
1197
|
registerPrismaSpan(span.spanContext().spanId, span);
|
|
1197
|
-
return endSpan$
|
|
1198
|
+
return endSpan$2(span, () => callback(span, parentSpan));
|
|
1198
1199
|
});
|
|
1199
1200
|
}
|
|
1200
1201
|
};
|
|
@@ -1224,7 +1225,7 @@ function dispatchEngineSpan(engineSpan, allSpans, linkIds, ignoreSpanTypes) {
|
|
|
1224
1225
|
span.end(engineSpan.endTime);
|
|
1225
1226
|
});
|
|
1226
1227
|
}
|
|
1227
|
-
function endSpan$
|
|
1228
|
+
function endSpan$2(span, run) {
|
|
1228
1229
|
let result;
|
|
1229
1230
|
try {
|
|
1230
1231
|
result = run();
|
|
@@ -1917,12 +1918,13 @@ function instrumentAnthropic(options) {
|
|
|
1917
1918
|
for (const { channel, operation, stream } of INSTRUMENTED_CHANNELS$3) bindTracingChannelToSpan(tracingChannel(channel), (data) => createGenAiSpan$4(data, operation, options, stream), {
|
|
1918
1919
|
beforeSpanEnd: (span, data) => {
|
|
1919
1920
|
if ("error" in data) require_exports.markCancelledIfAborted(span, require_exports.getRequestSignal(data.arguments?.[1]));
|
|
1920
|
-
require_exports.addResponseAttributes$3(span, data.result,
|
|
1921
|
+
require_exports.addResponseAttributes$3(span, data.result, !!data._sentryRecordOutputs);
|
|
1922
|
+
data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result });
|
|
1921
1923
|
},
|
|
1922
|
-
deferSpanEnd: ({ span, data, end }) => wrapThreadStreamRequest(span, data, end
|
|
1924
|
+
deferSpanEnd: ({ span, data, end }) => wrapThreadStreamRequest(span, data, end) || wrapApiPromiseResponse(data.result, (response) => {
|
|
1923
1925
|
data.result = response;
|
|
1924
|
-
if (!wrapStreamResult$3(span, data, stream
|
|
1925
|
-
}, end) || wrapStreamResult$3(span, data, stream
|
|
1926
|
+
if (!wrapStreamResult$3(span, data, stream)) end();
|
|
1927
|
+
}, end) || wrapStreamResult$3(span, data, stream)
|
|
1926
1928
|
});
|
|
1927
1929
|
tracingChannel(CHANNELS.ANTHROPIC_TOOL_RUNNER).end.subscribe((message) => {
|
|
1928
1930
|
require_exports.instrumentToolRunner(message.result, options);
|
|
@@ -1949,7 +1951,12 @@ function createGenAiSpan$4(data, operation, options, stream) {
|
|
|
1949
1951
|
const requestOptions = args[1];
|
|
1950
1952
|
if (isStreamHelperRequest(requestOptions?.headers) && isInsideStreamHelperSpan()) return;
|
|
1951
1953
|
const params = typeof args[0] === "object" && args[0] !== null ? args[0] : void 0;
|
|
1952
|
-
const
|
|
1954
|
+
const call = {
|
|
1955
|
+
operation,
|
|
1956
|
+
request: params
|
|
1957
|
+
};
|
|
1958
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
1959
|
+
data._sentryRecordOutputs = recordOutputs;
|
|
1953
1960
|
const attributes = require_exports.extractRequestAttributes$2(args, operation, recordInputs, require_exports.getProviderName(data.self));
|
|
1954
1961
|
const model = attributes[_sentry_conventions_attributes.GEN_AI_REQUEST_MODEL] || "unknown";
|
|
1955
1962
|
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = require_exports.ANTHROPIC_AI_ORIGIN;
|
|
@@ -1960,6 +1967,8 @@ function createGenAiSpan$4(data, operation, options, stream) {
|
|
|
1960
1967
|
attributes
|
|
1961
1968
|
});
|
|
1962
1969
|
if (recordInputs && params) require_exports.addPrivateRequestAttributes$1(span, params);
|
|
1970
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
1971
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
1963
1972
|
if (stream === "message-stream") streamHelperSpans.add(span);
|
|
1964
1973
|
return span;
|
|
1965
1974
|
}
|
|
@@ -2001,18 +2010,18 @@ const threadStreams = /* @__PURE__ */ new WeakMap();
|
|
|
2001
2010
|
* End the span of a thread stream's `create()` call from the stream once the response arrives. A thread may
|
|
2002
2011
|
* retry a rejected call, so a failed call ends its own span and only the one that succeeds reads the stream.
|
|
2003
2012
|
*/
|
|
2004
|
-
function wrapThreadStreamRequest(span, data, end
|
|
2013
|
+
function wrapThreadStreamRequest(span, data, end) {
|
|
2005
2014
|
const signal = (data.arguments?.[1])?.signal;
|
|
2006
2015
|
const threadStream = signal && threadStreams.get(signal);
|
|
2007
2016
|
const request = data.result;
|
|
2008
2017
|
if (!threadStream || threadStream.stream.ended || typeof request?._responseProps !== "function") return false;
|
|
2009
2018
|
const { stream, callerSignal } = threadStream;
|
|
2010
|
-
const
|
|
2019
|
+
const recordOutputs = !!data._sentryRecordOutputs;
|
|
2011
2020
|
request._responseProps().then(() => {
|
|
2012
2021
|
threadStreams.delete(signal);
|
|
2013
|
-
require_exports.instrumentMessageStream(stream, span, recordOutputs, callerSignal);
|
|
2022
|
+
require_exports.instrumentMessageStream(stream, span, recordOutputs, callerSignal, data._sentryOnSpanEnd);
|
|
2014
2023
|
}, (error) => {
|
|
2015
|
-
if (signal.aborted) require_exports.instrumentMessageStream(stream, span, recordOutputs, callerSignal);
|
|
2024
|
+
if (signal.aborted) require_exports.instrumentMessageStream(stream, span, recordOutputs, callerSignal, data._sentryOnSpanEnd);
|
|
2016
2025
|
else end(error);
|
|
2017
2026
|
});
|
|
2018
2027
|
return true;
|
|
@@ -2025,17 +2034,17 @@ function wrapThreadStreamRequest(span, data, end, options) {
|
|
|
2025
2034
|
* the span when iteration finishes.
|
|
2026
2035
|
* - `message-stream`: `instrumentMessageStream` attaches `'message'`/`'error'`/`'end'` listeners that end the span.
|
|
2027
2036
|
*/
|
|
2028
|
-
function wrapStreamResult$3(span, data, stream
|
|
2029
|
-
const
|
|
2037
|
+
function wrapStreamResult$3(span, data, stream) {
|
|
2038
|
+
const recordOutputs = !!data._sentryRecordOutputs;
|
|
2030
2039
|
const result = data.result;
|
|
2031
2040
|
if (stream === "async-iterable" && isAsyncIterable$3(result)) {
|
|
2032
2041
|
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
2033
|
-
const instrumented = require_exports.instrumentAsyncIterableStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs);
|
|
2042
|
+
const instrumented = require_exports.instrumentAsyncIterableStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs, data._sentryOnSpanEnd);
|
|
2034
2043
|
result[Symbol.asyncIterator] = () => instrumented;
|
|
2035
2044
|
return true;
|
|
2036
2045
|
}
|
|
2037
2046
|
if (stream === "message-stream" && isMessageStream(result)) {
|
|
2038
|
-
require_exports.instrumentMessageStream(result, span, recordOutputs, require_exports.getRequestSignal(data.arguments?.[1]));
|
|
2047
|
+
require_exports.instrumentMessageStream(result, span, recordOutputs, require_exports.getRequestSignal(data.arguments?.[1]), data._sentryOnSpanEnd);
|
|
2039
2048
|
return true;
|
|
2040
2049
|
}
|
|
2041
2050
|
return false;
|
|
@@ -2205,9 +2214,33 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2205
2214
|
constructor(_options = {}) {
|
|
2206
2215
|
this._options = _options;
|
|
2207
2216
|
this._piAiRequests = /* @__PURE__ */ new WeakSet();
|
|
2217
|
+
this._calls = /* @__PURE__ */ new WeakMap();
|
|
2218
|
+
}
|
|
2219
|
+
_resolveRecording(request) {
|
|
2220
|
+
const info = {
|
|
2221
|
+
commandName: request.commandName,
|
|
2222
|
+
input: request.commandInput
|
|
2223
|
+
};
|
|
2224
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(this._options, info);
|
|
2225
|
+
this._calls.set(request, {
|
|
2226
|
+
info,
|
|
2227
|
+
recordOutputs
|
|
2228
|
+
});
|
|
2229
|
+
return recordInputs;
|
|
2230
|
+
}
|
|
2231
|
+
_shouldRecordOutputs(response) {
|
|
2232
|
+
return this._calls.get(response.request)?.recordOutputs ?? false;
|
|
2233
|
+
}
|
|
2234
|
+
_runSpanEnd(request, span, result) {
|
|
2235
|
+
const call = this._calls.get(request);
|
|
2236
|
+
if (call) require_exports.runGenAiSpanEnd(this._options, span, call.info, result);
|
|
2237
|
+
}
|
|
2238
|
+
requestPostSpanHook(request, span) {
|
|
2239
|
+
const call = this._calls.get(request);
|
|
2240
|
+
if (call) require_exports.runGenAiSpanStart(this._options, span, call.info);
|
|
2208
2241
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2242
|
+
errorHook(request, error, span) {
|
|
2243
|
+
this._runSpanEnd(request, span, { error });
|
|
2211
2244
|
}
|
|
2212
2245
|
requestPreSpanHook(request) {
|
|
2213
2246
|
if (require_exports.isInsidePiAiSpan()) {
|
|
@@ -2242,6 +2275,7 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2242
2275
|
[_sentry_conventions_attributes.GEN_AI_PROVIDER_NAME]: GEN_AI_SYSTEM_VALUE_AWS_BEDROCK,
|
|
2243
2276
|
[_sentry_conventions_attributes.GEN_AI_OPERATION_NAME]: GEN_AI_OPERATION_NAME_VALUE_CHAT
|
|
2244
2277
|
};
|
|
2278
|
+
const recordInputs = this._resolveRecording(request);
|
|
2245
2279
|
const modelId = request.commandInput.modelId;
|
|
2246
2280
|
if (modelId) {
|
|
2247
2281
|
spanAttributes[_sentry_conventions_attributes.GEN_AI_REQUEST_MODEL] = modelId;
|
|
@@ -2255,7 +2289,7 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2255
2289
|
if (topP !== void 0) spanAttributes[_sentry_conventions_attributes.GEN_AI_REQUEST_TOP_P] = topP;
|
|
2256
2290
|
if (stopSequences !== void 0) spanAttributes[_sentry_conventions_attributes.GEN_AI_REQUEST_STOP_SEQUENCES] = stopSequences;
|
|
2257
2291
|
}
|
|
2258
|
-
if (
|
|
2292
|
+
if (recordInputs) Object.assign(spanAttributes, getConverseInputAttributes(request.commandInput));
|
|
2259
2293
|
return {
|
|
2260
2294
|
spanName,
|
|
2261
2295
|
spanOp: _sentry_conventions_op.GEN_AI_CHAT,
|
|
@@ -2269,6 +2303,7 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2269
2303
|
[_sentry_conventions_attributes.GEN_AI_PROVIDER_NAME]: GEN_AI_SYSTEM_VALUE_AWS_BEDROCK,
|
|
2270
2304
|
[_sentry_conventions_attributes.GEN_AI_OPERATION_NAME]: GEN_AI_OPERATION_NAME_VALUE_GENERATE_CONTENT
|
|
2271
2305
|
};
|
|
2306
|
+
const recordInputs = this._resolveRecording(request);
|
|
2272
2307
|
const modelId = request.commandInput?.modelId;
|
|
2273
2308
|
if (modelId) {
|
|
2274
2309
|
spanAttributes[_sentry_conventions_attributes.GEN_AI_REQUEST_MODEL] = modelId;
|
|
@@ -2314,7 +2349,7 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2314
2349
|
if (requestBody.top_p !== void 0) spanAttributes[_sentry_conventions_attributes.GEN_AI_REQUEST_TOP_P] = requestBody.top_p;
|
|
2315
2350
|
if (requestBody.stop !== void 0) spanAttributes[_sentry_conventions_attributes.GEN_AI_REQUEST_STOP_SEQUENCES] = requestBody.stop;
|
|
2316
2351
|
}
|
|
2317
|
-
if (
|
|
2352
|
+
if (recordInputs) Object.assign(spanAttributes, getInvokeModelInputAttributes(modelId, requestBody));
|
|
2318
2353
|
}
|
|
2319
2354
|
return {
|
|
2320
2355
|
spanName,
|
|
@@ -2326,15 +2361,17 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2326
2361
|
_responseHookConverse(response, span) {
|
|
2327
2362
|
const { stopReason, usage, output } = response.data;
|
|
2328
2363
|
setStopReason(span, stopReason);
|
|
2329
|
-
if (this.
|
|
2364
|
+
if (this._shouldRecordOutputs(response)) setOutputMessages(span, contentBlocksToParts(output?.message?.content));
|
|
2330
2365
|
span.setAttributes(require_exports.getTokenUsageAttributes(typeof usage?.inputTokens === "number" ? usage.inputTokens + (usage.cacheReadInputTokens ?? 0) + (usage.cacheWriteInputTokens ?? 0) : void 0, usage?.outputTokens, usage?.cacheWriteInputTokens, usage?.cacheReadInputTokens));
|
|
2366
|
+
this._runSpanEnd(response.request, span, { response: response.data });
|
|
2331
2367
|
}
|
|
2332
2368
|
_responseHookConverseStream(response, span) {
|
|
2333
2369
|
if (!response.data?.stream) {
|
|
2370
|
+
this._runSpanEnd(response.request, span, { response: response.data });
|
|
2334
2371
|
span.end();
|
|
2335
2372
|
return;
|
|
2336
2373
|
}
|
|
2337
|
-
response.data.stream = instrumentStream(response.data.stream, span, response.request.abortSignal, this.
|
|
2374
|
+
response.data.stream = instrumentStream(response.data.stream, span, response.request.abortSignal, this._shouldRecordOutputs(response), processConverseStreamEvent, (result) => this._runSpanEnd(response.request, span, result));
|
|
2338
2375
|
}
|
|
2339
2376
|
_responseHookInvokeModel(response, span) {
|
|
2340
2377
|
const currentModelId = response.request.commandInput?.modelId;
|
|
@@ -2363,18 +2400,20 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2363
2400
|
} else if (currentModelId.includes("mistral")) {
|
|
2364
2401
|
if (responseBody.outputs?.[0]?.text !== void 0) span.setAttribute(_sentry_conventions_attributes.GEN_AI_USAGE_OUTPUT_TOKENS, Math.ceil(responseBody.outputs[0].text.length / 6));
|
|
2365
2402
|
}
|
|
2366
|
-
if (this.
|
|
2403
|
+
if (this._shouldRecordOutputs(response)) setOutputMessages(span, getInvokeModelOutputParts(responseBody));
|
|
2367
2404
|
}
|
|
2405
|
+
this._runSpanEnd(response.request, span, { response: response.data });
|
|
2368
2406
|
}
|
|
2369
2407
|
_responseHookInvokeModelWithResponseStream(response, span) {
|
|
2370
2408
|
const stream = response.data?.body;
|
|
2371
2409
|
const modelId = response.request.commandInput?.modelId;
|
|
2372
2410
|
if (!stream) {
|
|
2411
|
+
this._runSpanEnd(response.request, span, { response: response.data });
|
|
2373
2412
|
span.end();
|
|
2374
2413
|
return;
|
|
2375
2414
|
}
|
|
2376
2415
|
const processChunk = typeof modelId === "string" ? resolveStreamProcessor(modelId) : void 0;
|
|
2377
|
-
response.data.body = instrumentStream(stream, span, response.request.abortSignal, this.
|
|
2416
|
+
response.data.body = instrumentStream(stream, span, response.request.abortSignal, this._shouldRecordOutputs(response), (item, state) => {
|
|
2378
2417
|
if (processChunk) {
|
|
2379
2418
|
const parsedChunk = parseChunk(item?.chunk?.bytes);
|
|
2380
2419
|
if (parsedChunk) {
|
|
@@ -2382,7 +2421,7 @@ var BedrockRuntimeServiceExtension = class {
|
|
|
2382
2421
|
processChunk(parsedChunk, state);
|
|
2383
2422
|
}
|
|
2384
2423
|
}
|
|
2385
|
-
});
|
|
2424
|
+
}, (result) => this._runSpanEnd(response.request, span, result));
|
|
2386
2425
|
}
|
|
2387
2426
|
};
|
|
2388
2427
|
function getInvokeModelOutputParts(responseBody) {
|
|
@@ -2407,13 +2446,14 @@ function resolveStreamProcessor(modelId) {
|
|
|
2407
2446
|
if (modelId.includes("mistral")) return processMistralChunk;
|
|
2408
2447
|
}
|
|
2409
2448
|
/** Collects the stream items into a state and sets the span attributes from it when the stream ends. */
|
|
2410
|
-
async function* instrumentStream(stream, span, abortSignal, recordOutputs, processItem) {
|
|
2449
|
+
async function* instrumentStream(stream, span, abortSignal, recordOutputs, processItem, beforeSpanEnd) {
|
|
2411
2450
|
const state = {
|
|
2412
2451
|
finishReasons: [],
|
|
2413
2452
|
responseTexts: [],
|
|
2414
2453
|
toolCalls: [],
|
|
2415
2454
|
parts: recordOutputs ? [] : void 0
|
|
2416
2455
|
};
|
|
2456
|
+
const result = {};
|
|
2417
2457
|
try {
|
|
2418
2458
|
for await (const item of stream) {
|
|
2419
2459
|
processItem(item, state);
|
|
@@ -2421,10 +2461,11 @@ async function* instrumentStream(stream, span, abortSignal, recordOutputs, proce
|
|
|
2421
2461
|
}
|
|
2422
2462
|
} catch (error) {
|
|
2423
2463
|
span.setStatus(require_exports.getErrorStatus(abortSignal));
|
|
2464
|
+
result.error = error;
|
|
2424
2465
|
throw error;
|
|
2425
2466
|
} finally {
|
|
2426
2467
|
if (state.parts) setOutputMessages(span, state.parts);
|
|
2427
|
-
require_exports.endStreamSpan(span, state, false);
|
|
2468
|
+
require_exports.endStreamSpan(span, state, false, () => beforeSpanEnd(result));
|
|
2428
2469
|
}
|
|
2429
2470
|
}
|
|
2430
2471
|
function processConverseStreamEvent(event, state) {
|
|
@@ -2912,6 +2953,9 @@ var ServicesExtensions = class {
|
|
|
2912
2953
|
responseHook(response, span) {
|
|
2913
2954
|
this._services.get(response.request.serviceName)?.responseHook?.(response, span);
|
|
2914
2955
|
}
|
|
2956
|
+
errorHook(request, error, span) {
|
|
2957
|
+
this._services.get(request.serviceName)?.errorHook?.(request, error, span);
|
|
2958
|
+
}
|
|
2915
2959
|
};
|
|
2916
2960
|
// src/integrations/aws-sdk/utils.ts
|
|
2917
2961
|
function removeSuffixFromStringIfExists(str, suffixToRemove) {
|
|
@@ -3012,6 +3056,7 @@ function instrumentAwsSdk(servicesExtensions) {
|
|
|
3012
3056
|
httpStatusCode: errMetadata?.httpStatusCode,
|
|
3013
3057
|
extendedRequestId: err?.extendedRequestId ?? errMetadata?.extendedRequestId
|
|
3014
3058
|
});
|
|
3059
|
+
servicesExtensions.errorHook(normalizedRequest, data.error, span);
|
|
3015
3060
|
return;
|
|
3016
3061
|
}
|
|
3017
3062
|
const output = data.result;
|
|
@@ -3188,7 +3233,7 @@ function instrumentGenericPool() {
|
|
|
3188
3233
|
}));
|
|
3189
3234
|
}
|
|
3190
3235
|
// src/utils/cronMonitoring.ts
|
|
3191
|
-
const MONITORED = Symbol.for("sentry.cron.monitored");
|
|
3236
|
+
const MONITORED$1 = Symbol.for("sentry.cron.monitored");
|
|
3192
3237
|
/**
|
|
3193
3238
|
* Calls `onJob` with the arguments of each call on a scheduler's job-creation channel, so it can wrap the job.
|
|
3194
3239
|
* Errors are logged and the job is created unmonitored.
|
|
@@ -3220,7 +3265,7 @@ function subscribeToScheduleChange(channelName, integrationName, onChange, onSta
|
|
|
3220
3265
|
}
|
|
3221
3266
|
/** Whether a job is named, not excluded, and not already monitored by `Sentry.cron.instrument*` or `wrapScheduledJob`. */
|
|
3222
3267
|
function shouldMonitorJob(name, job, excludeJobs) {
|
|
3223
|
-
return typeof name === "string" && !!name && typeof job === "function" && !job[MONITORED] && !(0, _sentry_core.stringMatchesSomePattern)(name, excludeJobs, true);
|
|
3268
|
+
return typeof name === "string" && !!name && typeof job === "function" && !job[MONITORED$1] && !(0, _sentry_core.stringMatchesSomePattern)(name, excludeJobs, true);
|
|
3224
3269
|
}
|
|
3225
3270
|
const COMMON_NICKNAMES = {
|
|
3226
3271
|
"@yearly": "0 0 1 1 *",
|
|
@@ -3432,7 +3477,7 @@ function wrapScheduledJob(func, monitorSlug, monitorConfig, mechanismType) {
|
|
|
3432
3477
|
return (0, _sentry_core.startNewTrace)(() => currentConfig ? (0, _sentry_core.withMonitor)(monitorSlug, run, currentConfig) : run());
|
|
3433
3478
|
};
|
|
3434
3479
|
monitorConfigs.set(wrapped, monitorConfig);
|
|
3435
|
-
(0, _sentry_core.addNonEnumerableProperty)(wrapped, MONITORED, true);
|
|
3480
|
+
(0, _sentry_core.addNonEnumerableProperty)(wrapped, MONITORED$1, true);
|
|
3436
3481
|
return wrapped;
|
|
3437
3482
|
}
|
|
3438
3483
|
/** Sets the monitor config a job from `wrapScheduledJob` sends on its next runs. Other functions are ignored. */
|
|
@@ -3590,6 +3635,520 @@ function getMonitorConfig(spec) {
|
|
|
3590
3635
|
const { rule, tz, start, end } = spec || {};
|
|
3591
3636
|
return typeof rule === "string" && !start && !end ? cronExpressionToMonitorConfig(rule, tz, "cron-parser") : void 0;
|
|
3592
3637
|
}
|
|
3638
|
+
// src/cron/common.ts
|
|
3639
|
+
/**
|
|
3640
|
+
* The monitor config for a cron expression, or `undefined` if Sentry would read the expression differently than the
|
|
3641
|
+
* scheduler runs it.
|
|
3642
|
+
*/
|
|
3643
|
+
function getCronMonitorConfig(expression, timezone, dialect, isReadAlike = () => true) {
|
|
3644
|
+
const monitorConfig = isReadAlike(expression) ? cronExpressionToMonitorConfig(expression, timezone, dialect) : void 0;
|
|
3645
|
+
if (!monitorConfig) require_debug_build.DEBUG_BUILD && _sentry_core.debug.warn(`[Cron] Can't convert "${expression}" to a Sentry schedule, sending check-ins without a monitor config.`);
|
|
3646
|
+
return monitorConfig;
|
|
3647
|
+
}
|
|
3648
|
+
// src/cron/cron.ts
|
|
3649
|
+
const MONITORED = Symbol.for("sentry.cron.monitored");
|
|
3650
|
+
const ERROR_TEXT = "Automatic instrumentation of CronJob only supports crontab string";
|
|
3651
|
+
/**
|
|
3652
|
+
* Instruments the `cron` library to send a check-in event to Sentry for each job execution.
|
|
3653
|
+
*
|
|
3654
|
+
* ```ts
|
|
3655
|
+
* import * as Sentry from '@sentry/node';
|
|
3656
|
+
* import { CronJob } from 'cron';
|
|
3657
|
+
*
|
|
3658
|
+
* const CronJobWithCheckIn = Sentry.cron.instrumentCron(CronJob, 'my-cron-job');
|
|
3659
|
+
*
|
|
3660
|
+
* // use the constructor
|
|
3661
|
+
* const job = new CronJobWithCheckIn('* * * * *', () => {
|
|
3662
|
+
* console.log('You will see this message every minute');
|
|
3663
|
+
* });
|
|
3664
|
+
*
|
|
3665
|
+
* // or from
|
|
3666
|
+
* const job = CronJobWithCheckIn.from({ cronTime: '* * * * *', onTick: () => {
|
|
3667
|
+
* console.log('You will see this message every minute');
|
|
3668
|
+
* });
|
|
3669
|
+
* ```
|
|
3670
|
+
*
|
|
3671
|
+
* @deprecated Use `cronJobIntegration` instead.
|
|
3672
|
+
*/
|
|
3673
|
+
function instrumentCron(lib, monitorSlug) {
|
|
3674
|
+
let jobScheduled = false;
|
|
3675
|
+
return new Proxy(lib, {
|
|
3676
|
+
construct(target, args) {
|
|
3677
|
+
const [cronTime, onTick, onComplete, start, timeZone, ...rest] = args;
|
|
3678
|
+
if (typeof cronTime !== "string") throw new Error(ERROR_TEXT);
|
|
3679
|
+
if (jobScheduled) throw new Error(`A job named '${monitorSlug}' has already been scheduled`);
|
|
3680
|
+
jobScheduled = true;
|
|
3681
|
+
const monitorConfig = args[7] == null ? getCronMonitorConfig(cronTime, timeZone, "cron") : void 0;
|
|
3682
|
+
async function monitoredTick(context, onComplete) {
|
|
3683
|
+
return (0, _sentry_core.withMonitor)(monitorSlug, async () => {
|
|
3684
|
+
try {
|
|
3685
|
+
await onTick(context, onComplete);
|
|
3686
|
+
} catch (e) {
|
|
3687
|
+
(0, _sentry_core.captureException)(e, { mechanism: {
|
|
3688
|
+
handled: false,
|
|
3689
|
+
type: "auto.function.cron.instrumentCron"
|
|
3690
|
+
} });
|
|
3691
|
+
throw e;
|
|
3692
|
+
}
|
|
3693
|
+
}, monitorConfig);
|
|
3694
|
+
}
|
|
3695
|
+
(0, _sentry_core.addNonEnumerableProperty)(monitoredTick, MONITORED, true);
|
|
3696
|
+
return new target(cronTime, monitoredTick, onComplete, start, timeZone, ...rest);
|
|
3697
|
+
},
|
|
3698
|
+
get(target, prop) {
|
|
3699
|
+
if (prop === "from") return (param) => {
|
|
3700
|
+
const { cronTime, onTick, timeZone, utcOffset } = param;
|
|
3701
|
+
if (typeof cronTime !== "string") throw new Error(ERROR_TEXT);
|
|
3702
|
+
if (jobScheduled) throw new Error(`A job named '${monitorSlug}' has already been scheduled`);
|
|
3703
|
+
jobScheduled = true;
|
|
3704
|
+
const monitorConfig = utcOffset == null ? getCronMonitorConfig(cronTime, timeZone, "cron") : void 0;
|
|
3705
|
+
param.onTick = async (context, onComplete) => {
|
|
3706
|
+
return (0, _sentry_core.withMonitor)(monitorSlug, async () => {
|
|
3707
|
+
try {
|
|
3708
|
+
await onTick(context, onComplete);
|
|
3709
|
+
} catch (e) {
|
|
3710
|
+
(0, _sentry_core.captureException)(e, { mechanism: {
|
|
3711
|
+
handled: false,
|
|
3712
|
+
type: "auto.function.cron.instrumentCron"
|
|
3713
|
+
} });
|
|
3714
|
+
throw e;
|
|
3715
|
+
}
|
|
3716
|
+
}, monitorConfig);
|
|
3717
|
+
};
|
|
3718
|
+
(0, _sentry_core.addNonEnumerableProperty)(param.onTick, MONITORED, true);
|
|
3719
|
+
return target.from(param);
|
|
3720
|
+
};
|
|
3721
|
+
else return target[prop];
|
|
3722
|
+
}
|
|
3723
|
+
});
|
|
3724
|
+
}
|
|
3725
|
+
// src/cron/node-cron.ts
|
|
3726
|
+
/**
|
|
3727
|
+
* Wraps the `node-cron` library with check-in monitoring.
|
|
3728
|
+
*
|
|
3729
|
+
* ```ts
|
|
3730
|
+
* import * as Sentry from "@sentry/node";
|
|
3731
|
+
* import * as cron from "node-cron";
|
|
3732
|
+
*
|
|
3733
|
+
* const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron);
|
|
3734
|
+
*
|
|
3735
|
+
* cronWithCheckIn.schedule(
|
|
3736
|
+
* "* * * * *",
|
|
3737
|
+
* () => {
|
|
3738
|
+
* console.log("running a task every minute");
|
|
3739
|
+
* },
|
|
3740
|
+
* { name: "my-cron-job" },
|
|
3741
|
+
* );
|
|
3742
|
+
* ```
|
|
3743
|
+
*
|
|
3744
|
+
* On node-cron 4, steps on `*` in the day-of-month or month field (such as every second day) aren't sent as a
|
|
3745
|
+
* schedule, because this wrapper can't tell the node-cron version. `nodeCronIntegration` can.
|
|
3746
|
+
*
|
|
3747
|
+
* @deprecated Use `nodeCronIntegration` instead.
|
|
3748
|
+
*/
|
|
3749
|
+
function instrumentNodeCron(lib, monitorConfig = {}) {
|
|
3750
|
+
return new Proxy(lib, { get(target, prop) {
|
|
3751
|
+
if (prop === "schedule" && target.schedule) return new Proxy(target.schedule, { apply(target, thisArg, argArray) {
|
|
3752
|
+
const [expression, callback, options] = argArray;
|
|
3753
|
+
const name = options?.name;
|
|
3754
|
+
const timezone = options?.timezone;
|
|
3755
|
+
if (!name) throw new Error("Missing \"name\" for scheduled job. A name is required for Sentry check-in monitoring.");
|
|
3756
|
+
const cronConfig = getCronMonitorConfig(expression, timezone, "node-cron", isReadAlikeByNodeCron3);
|
|
3757
|
+
const upsertMonitorConfig = cronConfig && {
|
|
3758
|
+
...cronConfig,
|
|
3759
|
+
...monitorConfig
|
|
3760
|
+
};
|
|
3761
|
+
const monitoredCallback = async (...args) => {
|
|
3762
|
+
const runWithMonitor = () => (0, _sentry_core.withMonitor)(name, async () => {
|
|
3763
|
+
try {
|
|
3764
|
+
return await callback(...args);
|
|
3765
|
+
} catch (e) {
|
|
3766
|
+
(0, _sentry_core.captureException)(e, { mechanism: {
|
|
3767
|
+
handled: false,
|
|
3768
|
+
type: "auto.function.node-cron.instrumentNodeCron"
|
|
3769
|
+
} });
|
|
3770
|
+
throw e;
|
|
3771
|
+
}
|
|
3772
|
+
}, upsertMonitorConfig);
|
|
3773
|
+
return !upsertMonitorConfig && monitorConfig.isolateTrace ? (0, _sentry_core.startNewTrace)(runWithMonitor) : runWithMonitor();
|
|
3774
|
+
};
|
|
3775
|
+
(0, _sentry_core.addNonEnumerableProperty)(monitoredCallback, Symbol.for("sentry.cron.monitored"), true);
|
|
3776
|
+
return target.apply(thisArg, [
|
|
3777
|
+
expression,
|
|
3778
|
+
monitoredCallback,
|
|
3779
|
+
options
|
|
3780
|
+
]);
|
|
3781
|
+
} });
|
|
3782
|
+
else return target[prop];
|
|
3783
|
+
} });
|
|
3784
|
+
}
|
|
3785
|
+
// src/cron/node-schedule.ts
|
|
3786
|
+
/**
|
|
3787
|
+
* Instruments the `node-schedule` library to send a check-in event to Sentry for each job execution.
|
|
3788
|
+
*
|
|
3789
|
+
* ```ts
|
|
3790
|
+
* import * as Sentry from '@sentry/node';
|
|
3791
|
+
* import * as schedule from 'node-schedule';
|
|
3792
|
+
*
|
|
3793
|
+
* const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule);
|
|
3794
|
+
*
|
|
3795
|
+
* const job = scheduleWithCheckIn.scheduleJob('my-cron-job', '* * * * *', () => {
|
|
3796
|
+
* console.log('You will see this message every minute');
|
|
3797
|
+
* });
|
|
3798
|
+
* ```
|
|
3799
|
+
*/
|
|
3800
|
+
function instrumentNodeSchedule(lib) {
|
|
3801
|
+
return new Proxy(lib, { get(target, prop) {
|
|
3802
|
+
if (prop === "scheduleJob") return new Proxy(target.scheduleJob, { apply(target, thisArg, argArray) {
|
|
3803
|
+
const [nameOrExpression, expressionOrCallback, callback] = argArray;
|
|
3804
|
+
if (typeof nameOrExpression !== "string" || typeof expressionOrCallback !== "string" || typeof callback !== "function") throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");
|
|
3805
|
+
const monitorSlug = nameOrExpression;
|
|
3806
|
+
const expression = expressionOrCallback;
|
|
3807
|
+
const monitorConfig = getCronMonitorConfig(expression, void 0, "cron-parser");
|
|
3808
|
+
async function monitoredCallback() {
|
|
3809
|
+
return (0, _sentry_core.withMonitor)(monitorSlug, async () => {
|
|
3810
|
+
await callback?.();
|
|
3811
|
+
}, monitorConfig);
|
|
3812
|
+
}
|
|
3813
|
+
(0, _sentry_core.addNonEnumerableProperty)(monitoredCallback, Symbol.for("sentry.cron.monitored"), true);
|
|
3814
|
+
return target.apply(thisArg, [
|
|
3815
|
+
monitorSlug,
|
|
3816
|
+
expression,
|
|
3817
|
+
monitoredCallback
|
|
3818
|
+
]);
|
|
3819
|
+
} });
|
|
3820
|
+
return target[prop];
|
|
3821
|
+
} });
|
|
3822
|
+
}
|
|
3823
|
+
// src/cron/index.ts
|
|
3824
|
+
/** Methods to instrument cron libraries for Sentry check-ins */
|
|
3825
|
+
const cron = {
|
|
3826
|
+
instrumentCron,
|
|
3827
|
+
instrumentNodeCron,
|
|
3828
|
+
instrumentNodeSchedule
|
|
3829
|
+
};
|
|
3830
|
+
// src/integrations/bullmq/contextManager.ts
|
|
3831
|
+
var SentryBullMQContextManager = class {
|
|
3832
|
+
active() {
|
|
3833
|
+
return {
|
|
3834
|
+
span: (0, _sentry_core.getActiveSpan)(),
|
|
3835
|
+
scope: (0, _sentry_core.getCurrentScope)()
|
|
3836
|
+
};
|
|
3837
|
+
}
|
|
3838
|
+
with(context, fn) {
|
|
3839
|
+
if (context.span) return (0, _sentry_core.withIsolationScope)(() => {
|
|
3840
|
+
return (0, _sentry_core.withActiveSpan)(context.span, fn);
|
|
3841
|
+
});
|
|
3842
|
+
return (0, _sentry_core.withIsolationScope)(() => (0, _sentry_core.withActiveSpan)(null, fn));
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Returns a context without a span. BullMQ 6.3.11+ runs the stalled jobs checker in it, so the
|
|
3846
|
+
* checker does not stay attached to the span that was active when the worker started.
|
|
3847
|
+
*/
|
|
3848
|
+
root() {
|
|
3849
|
+
return {
|
|
3850
|
+
span: void 0,
|
|
3851
|
+
scope: (0, _sentry_core.getCurrentScope)()
|
|
3852
|
+
};
|
|
3853
|
+
}
|
|
3854
|
+
getMetadata(context) {
|
|
3855
|
+
if (context.span) return (0, _sentry_core.spanToTraceHeader)(context.span);
|
|
3856
|
+
return "";
|
|
3857
|
+
}
|
|
3858
|
+
fromMetadata(activeContext, metadata) {
|
|
3859
|
+
const traceparent = (0, _sentry_core.extractTraceparentData)(metadata);
|
|
3860
|
+
if (!traceparent?.traceId || !traceparent?.parentSpanId) return activeContext;
|
|
3861
|
+
return {
|
|
3862
|
+
...activeContext,
|
|
3863
|
+
producerSpanContext: {
|
|
3864
|
+
traceId: traceparent.traceId,
|
|
3865
|
+
spanId: traceparent.parentSpanId,
|
|
3866
|
+
sampled: traceparent.parentSampled === true
|
|
3867
|
+
}
|
|
3868
|
+
};
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
// src/integrations/bullmq/span.ts
|
|
3872
|
+
const DROPPED_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
3873
|
+
"bullmq.job.options",
|
|
3874
|
+
"bullmq.job.progress",
|
|
3875
|
+
"bullmq.queue.options",
|
|
3876
|
+
"bullmq.worker.options",
|
|
3877
|
+
"bullmq.job.finished.timestamp"
|
|
3878
|
+
]);
|
|
3879
|
+
const MESSAGING_BULLMQ_KEYS = /* @__PURE__ */ new Map([
|
|
3880
|
+
["bullmq.flow.name", _sentry_conventions_attributes.MESSAGING_BULLMQ_FLOW_NAME],
|
|
3881
|
+
["bullmq.job.attempt_finished_timestamp", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_ATTEMPT_FINISHED_TIMESTAMP],
|
|
3882
|
+
["bullmq.job.bulk.names", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_BULK_NAMES],
|
|
3883
|
+
["bullmq.job.deduplication.key", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_DEDUPLICATION_KEY],
|
|
3884
|
+
["bullmq.job.ids", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_IDS],
|
|
3885
|
+
["bullmq.job.key", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_KEY],
|
|
3886
|
+
["bullmq.job.name", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_NAME],
|
|
3887
|
+
["bullmq.job.processed.timestamp", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_PROCESSED_TIMESTAMP],
|
|
3888
|
+
["bullmq.job.scheduler.id", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_SCHEDULER_ID],
|
|
3889
|
+
["bullmq.job.type", _sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_TYPE],
|
|
3890
|
+
["bullmq.queue.clean.count", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_CLEAN_COUNT],
|
|
3891
|
+
["bullmq.queue.clean.limit", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_CLEAN_LIMIT],
|
|
3892
|
+
["bullmq.queue.drain.delay", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_DRAIN_DELAY],
|
|
3893
|
+
["bullmq.queue.event.max.length", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_EVENT_MAX_LENGTH],
|
|
3894
|
+
["bullmq.queue.grace", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_GRACE],
|
|
3895
|
+
["bullmq.queue.jobs.state", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_JOBS_STATE],
|
|
3896
|
+
["bullmq.queue.rate.limit", _sentry_conventions_attributes.MESSAGING_BULLMQ_QUEUE_RATE_LIMIT],
|
|
3897
|
+
["bullmq.worker.do.not.wait.active", _sentry_conventions_attributes.MESSAGING_BULLMQ_WORKER_DO_NOT_WAIT_ACTIVE],
|
|
3898
|
+
["bullmq.worker.force.close", _sentry_conventions_attributes.MESSAGING_BULLMQ_WORKER_FORCE_CLOSE],
|
|
3899
|
+
["bullmq.worker.jobs.to.extend.locks", _sentry_conventions_attributes.MESSAGING_BULLMQ_WORKER_JOBS_TO_EXTEND_LOCKS],
|
|
3900
|
+
["bullmq.worker.name", _sentry_conventions_attributes.MESSAGING_BULLMQ_WORKER_NAME],
|
|
3901
|
+
["bullmq.worker.rate.limit", _sentry_conventions_attributes.MESSAGING_BULLMQ_WORKER_RATE_LIMIT],
|
|
3902
|
+
["bullmq.worker.stalled.jobs", _sentry_conventions_attributes.MESSAGING_BULLMQ_WORKER_STALLED_JOBS]
|
|
3903
|
+
]);
|
|
3904
|
+
/**
|
|
3905
|
+
* Returns the Sentry key for a `bullmq.*` attribute key or metric name: the key from `MESSAGING_BULLMQ_KEYS`, or
|
|
3906
|
+
* `messaging.<key>` for the keys that are not in it, such as the metric names. Returns all other keys unchanged.
|
|
3907
|
+
*/
|
|
3908
|
+
function toMessagingKey(key) {
|
|
3909
|
+
return MESSAGING_BULLMQ_KEYS.get(key) ?? (key.startsWith("bullmq.") ? `messaging.${key}` : key);
|
|
3910
|
+
}
|
|
3911
|
+
/**
|
|
3912
|
+
* Returns the BullMQ attributes with Sentry keys: the `messaging.*` convention where one exists, and the
|
|
3913
|
+
* `messaging.bullmq.*` key for all others. The attributes that hold JSON strings and the deprecated ones are left out.
|
|
3914
|
+
*/
|
|
3915
|
+
function toSentryAttributes(attributes) {
|
|
3916
|
+
const { "bullmq.queue.name": queueName, "bullmq.queue.operation": operation, "bullmq.job.id": jobId, "bullmq.job.attempts.made": attemptsMade, "bullmq.job.bulk.count": bulkCount, "bullmq.worker.id": workerId, "bullmq.job.state": jobState, "bullmq.job.status": jobStatus, ...rest } = attributes;
|
|
3917
|
+
const result = {};
|
|
3918
|
+
for (const [key, value] of Object.entries(rest)) if (!DROPPED_ATTRIBUTES.has(key)) result[toMessagingKey(key)] = value;
|
|
3919
|
+
if (typeof queueName === "string") result[_sentry_conventions_attributes.MESSAGING_DESTINATION_NAME] = queueName;
|
|
3920
|
+
if (typeof operation === "string") result[_sentry_conventions_attributes.MESSAGING_OPERATION_NAME] = operation;
|
|
3921
|
+
if (jobId !== void 0) result[_sentry_conventions_attributes.MESSAGING_MESSAGE_ID] = String(jobId);
|
|
3922
|
+
if (typeof attemptsMade === "number") result[_sentry_conventions_attributes.MESSAGING_MESSAGE_RETRY_COUNT] = Math.max(attemptsMade - 1, 0);
|
|
3923
|
+
if (typeof bulkCount === "number") result[_sentry_conventions_attributes.MESSAGING_BATCH_MESSAGE_COUNT] = bulkCount;
|
|
3924
|
+
if (typeof workerId === "string") result[_sentry_conventions_attributes.MESSAGING_CLIENT_ID] = workerId;
|
|
3925
|
+
const state = jobState ?? jobStatus;
|
|
3926
|
+
if (typeof state === "string") result[_sentry_conventions_attributes.MESSAGING_BULLMQ_JOB_STATE] = state;
|
|
3927
|
+
return result;
|
|
3928
|
+
}
|
|
3929
|
+
var SentryBullMQSpan = class {
|
|
3930
|
+
constructor(span, scope) {
|
|
3931
|
+
this._span = span;
|
|
3932
|
+
this._scope = scope;
|
|
3933
|
+
}
|
|
3934
|
+
setAttribute(key, value) {
|
|
3935
|
+
this.setAttributes({ [key]: value });
|
|
3936
|
+
}
|
|
3937
|
+
setAttributes(attributes) {
|
|
3938
|
+
this._span.setAttributes(toSentryAttributes(attributes));
|
|
3939
|
+
}
|
|
3940
|
+
addEvent(name, attributes) {
|
|
3941
|
+
this._span.addEvent(name, attributes);
|
|
3942
|
+
if (name === "job failed") {
|
|
3943
|
+
this._span.setStatus({
|
|
3944
|
+
code: _sentry_core.SPAN_STATUS_ERROR,
|
|
3945
|
+
message: "internal_error"
|
|
3946
|
+
});
|
|
3947
|
+
let error = this._recordedError;
|
|
3948
|
+
this._recordedError = void 0;
|
|
3949
|
+
if (!error) {
|
|
3950
|
+
error = new Error(String(attributes?.["bullmq.job.failed.reason"] || "Unknown error"));
|
|
3951
|
+
error.stack = void 0;
|
|
3952
|
+
}
|
|
3953
|
+
(0, _sentry_core.captureException)(error, { mechanism: {
|
|
3954
|
+
handled: false,
|
|
3955
|
+
type: "auto.queue.bullmq"
|
|
3956
|
+
} });
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
/**
|
|
3960
|
+
* Does not capture to Sentry. BullMQ calls this for Redis, lock and serialization errors that it
|
|
3961
|
+
* retries itself, often several times for one fault, and for the job error right before the `job failed` event.
|
|
3962
|
+
* Job failures are captured in `addEvent`.
|
|
3963
|
+
*/
|
|
3964
|
+
recordException(exception) {
|
|
3965
|
+
this._recordedError = exception instanceof Error ? exception : void 0;
|
|
3966
|
+
const error = this._recordedError ?? new Error(typeof exception === "string" ? exception : exception.message || "Unknown error");
|
|
3967
|
+
this._span.recordException(error);
|
|
3968
|
+
}
|
|
3969
|
+
setSpanOnContext(context) {
|
|
3970
|
+
return {
|
|
3971
|
+
...context,
|
|
3972
|
+
span: this._span,
|
|
3973
|
+
scope: this._scope
|
|
3974
|
+
};
|
|
3975
|
+
}
|
|
3976
|
+
end() {
|
|
3977
|
+
this._span.end();
|
|
3978
|
+
}
|
|
3979
|
+
};
|
|
3980
|
+
// src/integrations/bullmq/meter.ts
|
|
3981
|
+
function toMetricAttributes(attributes) {
|
|
3982
|
+
if (!attributes) return;
|
|
3983
|
+
const result = {};
|
|
3984
|
+
for (const [key, value] of Object.entries(toSentryAttributes(attributes))) if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") result[key] = value;
|
|
3985
|
+
return result;
|
|
3986
|
+
}
|
|
3987
|
+
/**
|
|
3988
|
+
* Converts the OpenTelemetry (UCUM) unit that BullMQ passes to the matching Sentry unit.
|
|
3989
|
+
*/
|
|
3990
|
+
function toSentryUnit(unit) {
|
|
3991
|
+
if (unit === "ms") return "millisecond";
|
|
3992
|
+
if (unit === "1" || unit?.startsWith("{")) return "none";
|
|
3993
|
+
return unit;
|
|
3994
|
+
}
|
|
3995
|
+
var SentryBullMQCounter = class {
|
|
3996
|
+
constructor(name, unit) {
|
|
3997
|
+
this._name = name;
|
|
3998
|
+
this._unit = unit;
|
|
3999
|
+
}
|
|
4000
|
+
add(value, attributes) {
|
|
4001
|
+
_sentry_core.metrics.count(this._name, value, {
|
|
4002
|
+
unit: this._unit,
|
|
4003
|
+
attributes: toMetricAttributes(attributes)
|
|
4004
|
+
});
|
|
4005
|
+
}
|
|
4006
|
+
};
|
|
4007
|
+
var SentryBullMQHistogram = class {
|
|
4008
|
+
constructor(name, unit) {
|
|
4009
|
+
this._name = name;
|
|
4010
|
+
this._unit = unit;
|
|
4011
|
+
}
|
|
4012
|
+
record(value, attributes) {
|
|
4013
|
+
_sentry_core.metrics.distribution(this._name, value, {
|
|
4014
|
+
unit: this._unit,
|
|
4015
|
+
attributes: toMetricAttributes(attributes)
|
|
4016
|
+
});
|
|
4017
|
+
}
|
|
4018
|
+
};
|
|
4019
|
+
var SentryBullMQGauge = class {
|
|
4020
|
+
constructor(name, unit) {
|
|
4021
|
+
this._name = name;
|
|
4022
|
+
this._unit = unit;
|
|
4023
|
+
}
|
|
4024
|
+
record(value, attributes) {
|
|
4025
|
+
_sentry_core.metrics.gauge(this._name, value, {
|
|
4026
|
+
unit: this._unit,
|
|
4027
|
+
attributes: toMetricAttributes(attributes)
|
|
4028
|
+
});
|
|
4029
|
+
}
|
|
4030
|
+
};
|
|
4031
|
+
/**
|
|
4032
|
+
* Records BullMQ's `bullmq.job.duration` histogram, which is in milliseconds, as the OTel
|
|
4033
|
+
* `messaging.process.duration` metric in seconds.
|
|
4034
|
+
*/
|
|
4035
|
+
var SentryBullMQProcessDuration = class {
|
|
4036
|
+
record(value, attributes) {
|
|
4037
|
+
_sentry_core.metrics.distribution(_sentry_conventions_metrics.MESSAGING_PROCESS_DURATION, value / 1e3, {
|
|
4038
|
+
unit: "second",
|
|
4039
|
+
attributes: {
|
|
4040
|
+
...toMetricAttributes(attributes),
|
|
4041
|
+
[_sentry_conventions_attributes.MESSAGING_SYSTEM]: "bullmq",
|
|
4042
|
+
[_sentry_conventions_attributes.MESSAGING_OPERATION_NAME]: "process"
|
|
4043
|
+
}
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
};
|
|
4047
|
+
var SentryBullMQMeter = class {
|
|
4048
|
+
createCounter(name, options) {
|
|
4049
|
+
return new SentryBullMQCounter(toMessagingKey(name), toSentryUnit(options?.unit));
|
|
4050
|
+
}
|
|
4051
|
+
createHistogram(name, options) {
|
|
4052
|
+
if (name === "bullmq.job.duration") return new SentryBullMQProcessDuration();
|
|
4053
|
+
return new SentryBullMQHistogram(toMessagingKey(name), toSentryUnit(options?.unit));
|
|
4054
|
+
}
|
|
4055
|
+
createGauge(name, options) {
|
|
4056
|
+
return new SentryBullMQGauge(toMessagingKey(name), toSentryUnit(options?.unit));
|
|
4057
|
+
}
|
|
4058
|
+
};
|
|
4059
|
+
// src/integrations/bullmq/tracer.ts
|
|
4060
|
+
const PRODUCER_OPERATIONS = /* @__PURE__ */ new Set([
|
|
4061
|
+
"add",
|
|
4062
|
+
"addbulk",
|
|
4063
|
+
"addflow",
|
|
4064
|
+
"addbulkflows"
|
|
4065
|
+
]);
|
|
4066
|
+
const CONSUMER_OPERATIONS = /* @__PURE__ */ new Set(["process"]);
|
|
4067
|
+
function getOperation$1(name) {
|
|
4068
|
+
return name.split(" ")[0].toLowerCase();
|
|
4069
|
+
}
|
|
4070
|
+
function getOpFromSpanName(name) {
|
|
4071
|
+
const operation = getOperation$1(name);
|
|
4072
|
+
if (CONSUMER_OPERATIONS.has(operation)) return _sentry_conventions_op.QUEUE_PROCESS;
|
|
4073
|
+
if (PRODUCER_OPERATIONS.has(operation)) return _sentry_conventions_op.QUEUE_PUBLISH;
|
|
4074
|
+
return _sentry_conventions_op.QUEUE;
|
|
4075
|
+
}
|
|
4076
|
+
function getOriginFromSpanName(name) {
|
|
4077
|
+
const operation = getOperation$1(name);
|
|
4078
|
+
if (CONSUMER_OPERATIONS.has(operation)) return "auto.queue.bullmq.consumer";
|
|
4079
|
+
if (PRODUCER_OPERATIONS.has(operation)) return "auto.queue.bullmq.producer";
|
|
4080
|
+
return "auto.queue.bullmq";
|
|
4081
|
+
}
|
|
4082
|
+
var SentryBullMQTracer = class {
|
|
4083
|
+
startSpan(name, options, context) {
|
|
4084
|
+
const op = getOpFromSpanName(name);
|
|
4085
|
+
const origin = getOriginFromSpanName(name);
|
|
4086
|
+
const attributes = {
|
|
4087
|
+
[_sentry_conventions_attributes.SENTRY_OP]: op,
|
|
4088
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: origin,
|
|
4089
|
+
[_sentry_conventions_attributes.MESSAGING_SYSTEM]: "bullmq",
|
|
4090
|
+
...options?.attributes && toSentryAttributes(options.attributes)
|
|
4091
|
+
};
|
|
4092
|
+
const span = op === _sentry_conventions_op.QUEUE_PROCESS ? (0, _sentry_core.startNewTrace)(() => (0, _sentry_core.startInactiveSpan)({
|
|
4093
|
+
name,
|
|
4094
|
+
attributes
|
|
4095
|
+
})) : (0, _sentry_core.startInactiveSpan)({
|
|
4096
|
+
name,
|
|
4097
|
+
attributes,
|
|
4098
|
+
onlyIfParent: op === _sentry_conventions_op.QUEUE
|
|
4099
|
+
});
|
|
4100
|
+
if (context?.producerSpanContext) {
|
|
4101
|
+
const producerSpanCtx = {
|
|
4102
|
+
traceId: context.producerSpanContext.traceId,
|
|
4103
|
+
spanId: context.producerSpanContext.spanId,
|
|
4104
|
+
traceFlags: context.producerSpanContext.sampled ? 1 : 0
|
|
4105
|
+
};
|
|
4106
|
+
span.addLink({
|
|
4107
|
+
context: producerSpanCtx,
|
|
4108
|
+
attributes: { [_sentry_conventions_attributes.SENTRY_LINK_TYPE]: "message_origin" }
|
|
4109
|
+
});
|
|
4110
|
+
}
|
|
4111
|
+
return new SentryBullMQSpan(span, (0, _sentry_core.getCurrentScope)());
|
|
4112
|
+
}
|
|
4113
|
+
};
|
|
4114
|
+
// src/integrations/bullmq/index.ts
|
|
4115
|
+
/**
|
|
4116
|
+
* A Sentry-specific telemetry implementation for BullMQ.
|
|
4117
|
+
*
|
|
4118
|
+
* This implements BullMQ's Telemetry interface to provide automatic tracing
|
|
4119
|
+
* for queue operations with proper Queue Insights attributes.
|
|
4120
|
+
*
|
|
4121
|
+
* @example
|
|
4122
|
+
* ```javascript
|
|
4123
|
+
* import * as Sentry from '@sentry/node';
|
|
4124
|
+
* import { Queue, Worker } from 'bullmq';
|
|
4125
|
+
*
|
|
4126
|
+
* const telemetry = new Sentry.BullMQTelemetry();
|
|
4127
|
+
*
|
|
4128
|
+
* const queue = new Queue('myQueue', {
|
|
4129
|
+
* connection: { host: '127.0.0.1', port: 6379 },
|
|
4130
|
+
* telemetry,
|
|
4131
|
+
* });
|
|
4132
|
+
*
|
|
4133
|
+
* const worker = new Worker('myQueue', async (job) => {
|
|
4134
|
+
* // Process job
|
|
4135
|
+
* }, {
|
|
4136
|
+
* connection: { host: '127.0.0.1', port: 6379 },
|
|
4137
|
+
* telemetry,
|
|
4138
|
+
* });
|
|
4139
|
+
* ```
|
|
4140
|
+
*
|
|
4141
|
+
* To also send BullMQ's job metrics to Sentry, use `new Sentry.BullMQTelemetry({ enableMetrics: true })`.
|
|
4142
|
+
*
|
|
4143
|
+
* @see https://docs.bullmq.io/guide/telemetry
|
|
4144
|
+
*/
|
|
4145
|
+
var BullMQTelemetry = class {
|
|
4146
|
+
constructor(options = {}) {
|
|
4147
|
+
this.tracer = new SentryBullMQTracer();
|
|
4148
|
+
this.contextManager = new SentryBullMQContextManager();
|
|
4149
|
+
if (options.enableMetrics) this.meter = new SentryBullMQMeter();
|
|
4150
|
+
}
|
|
4151
|
+
};
|
|
3593
4152
|
// src/integrations/google-genai.ts
|
|
3594
4153
|
const INTEGRATION_NAME$24 = "Google_GenAI";
|
|
3595
4154
|
const ORIGIN$20 = "auto.ai.google_genai";
|
|
@@ -3626,9 +4185,10 @@ function instrumentGoogleGenai(options) {
|
|
|
3626
4185
|
const params = require_exports.resolveChatParams(operation, data.arguments?.[0], data.self);
|
|
3627
4186
|
require_exports.markCancelledIfAborted(span, require_exports.getCallAbortSignal(operation, params, data.arguments?.[1]));
|
|
3628
4187
|
}
|
|
3629
|
-
if (operation !== "embeddings") require_exports.addResponseAttributes$2(span, data.result,
|
|
4188
|
+
if (operation !== "embeddings") require_exports.addResponseAttributes$2(span, data.result, !!data._sentryRecordOutputs, operation);
|
|
4189
|
+
data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result });
|
|
3630
4190
|
},
|
|
3631
|
-
deferSpanEnd: ({ span, data }) => wrapStreamResult$2(span, data, operation
|
|
4191
|
+
deferSpanEnd: ({ span, data }) => wrapStreamResult$2(span, data, operation)
|
|
3632
4192
|
});
|
|
3633
4193
|
}
|
|
3634
4194
|
/**
|
|
@@ -3644,9 +4204,14 @@ function createGenAiSpan$3(data, operation, options) {
|
|
|
3644
4204
|
if (origin === ORIGIN$20 && op === "gen_ai.chat") return;
|
|
3645
4205
|
}
|
|
3646
4206
|
}
|
|
3647
|
-
const
|
|
3648
|
-
const params = require_exports.resolveChatParams(operation,
|
|
3649
|
-
const
|
|
4207
|
+
const request = (data.arguments ?? [])[0];
|
|
4208
|
+
const params = require_exports.resolveChatParams(operation, request, data.self);
|
|
4209
|
+
const call = {
|
|
4210
|
+
operation,
|
|
4211
|
+
request
|
|
4212
|
+
};
|
|
4213
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
4214
|
+
data._sentryRecordOutputs = recordOutputs;
|
|
3650
4215
|
const attributes = require_exports.extractRequestAttributes$1(operation, params, data.self, recordInputs);
|
|
3651
4216
|
const model = attributes[_sentry_conventions_attributes.GEN_AI_REQUEST_MODEL] || "unknown";
|
|
3652
4217
|
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$20;
|
|
@@ -3657,6 +4222,8 @@ function createGenAiSpan$3(data, operation, options) {
|
|
|
3657
4222
|
attributes
|
|
3658
4223
|
});
|
|
3659
4224
|
if (recordInputs && params) require_exports.addPrivateRequestAttributes(span, params, operation);
|
|
4225
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
4226
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
3660
4227
|
return span;
|
|
3661
4228
|
}
|
|
3662
4229
|
function isAsyncIterable$2(value) {
|
|
@@ -3667,13 +4234,12 @@ function isAsyncIterable$2(value) {
|
|
|
3667
4234
|
* For a stream we patch `result[Symbol.asyncIterator]` in place so `instrumentStream` ends the
|
|
3668
4235
|
* span when iteration finishes.
|
|
3669
4236
|
*/
|
|
3670
|
-
function wrapStreamResult$2(span, data, operation
|
|
4237
|
+
function wrapStreamResult$2(span, data, operation) {
|
|
3671
4238
|
const result = data.result;
|
|
3672
4239
|
if (!isAsyncIterable$2(result)) return false;
|
|
3673
|
-
const { recordOutputs } = require_exports.resolveAIRecordingOptions(options);
|
|
3674
4240
|
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
3675
4241
|
const params = require_exports.resolveChatParams(operation, data.arguments?.[0], data.self);
|
|
3676
|
-
const instrumented = require_exports.instrumentStream({ [Symbol.asyncIterator]: iterate }, span,
|
|
4242
|
+
const instrumented = require_exports.instrumentStream({ [Symbol.asyncIterator]: iterate }, span, !!data._sentryRecordOutputs, require_exports.getAbortSignal(params), data._sentryOnSpanEnd);
|
|
3677
4243
|
result[Symbol.asyncIterator] = () => instrumented;
|
|
3678
4244
|
return true;
|
|
3679
4245
|
}
|
|
@@ -4850,7 +5416,7 @@ function instrumentIoredis(options) {
|
|
|
4850
5416
|
const INTEGRATION_NAME$19 = "Redis";
|
|
4851
5417
|
const ORIGIN$15 = "auto.db.redis";
|
|
4852
5418
|
const DB_SYSTEM_VALUE_REDIS = "redis";
|
|
4853
|
-
function endSpan(span, err) {
|
|
5419
|
+
function endSpan$1(span, err) {
|
|
4854
5420
|
if (err) span.setStatus({
|
|
4855
5421
|
code: _sentry_core.SPAN_STATUS_ERROR,
|
|
4856
5422
|
message: err instanceof Error ? err.message : String(err)
|
|
@@ -4917,14 +5483,14 @@ function subscribeLegacyRedisCommand(cacheOptions) {
|
|
|
4917
5483
|
const parentSpan = (0, _sentry_core.getActiveSpan)();
|
|
4918
5484
|
command.callback = function(err, reply) {
|
|
4919
5485
|
if (!err) applyCacheResponseAttributes(span, reply);
|
|
4920
|
-
endSpan(span, err);
|
|
5486
|
+
endSpan$1(span, err);
|
|
4921
5487
|
const args = arguments;
|
|
4922
5488
|
return (0, _sentry_core.withActiveSpan)(parentSpan ?? null, () => originalCallback.apply(this, args));
|
|
4923
5489
|
};
|
|
4924
5490
|
},
|
|
4925
5491
|
error(data) {
|
|
4926
5492
|
const span = data._sentrySpan;
|
|
4927
|
-
if (span) endSpan(span, data.error);
|
|
5493
|
+
if (span) endSpan$1(span, data.error);
|
|
4928
5494
|
}
|
|
4929
5495
|
});
|
|
4930
5496
|
}
|
|
@@ -5436,12 +6002,13 @@ function createOpenAiCompatibleIntegration(provider) {
|
|
|
5436
6002
|
for (const { channel, operation } of instrumentedChannels) bindTracingChannelToSpan(tracingChannel(channel), (data) => createGenAiSpan$2(data, operation, provider, options), {
|
|
5437
6003
|
beforeSpanEnd: (span, data) => {
|
|
5438
6004
|
if ("error" in data) require_exports.markCancelledIfAborted(span, require_exports.getRequestSignal(data.arguments?.[1]));
|
|
5439
|
-
require_exports.addResponseAttributes$4(span, data.result,
|
|
6005
|
+
require_exports.addResponseAttributes$4(span, data.result, !!data._sentryRecordOutputs);
|
|
6006
|
+
data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result });
|
|
5440
6007
|
},
|
|
5441
6008
|
deferSpanEnd: ({ span, data, end }) => wrapApiPromiseResponse(data.result, (response) => {
|
|
5442
6009
|
data.result = response;
|
|
5443
|
-
if (!wrapStreamResult$1(span, data
|
|
5444
|
-
}, end) || wrapStreamResult$1(span, data
|
|
6010
|
+
if (!wrapStreamResult$1(span, data)) end();
|
|
6011
|
+
}, end) || wrapStreamResult$1(span, data)
|
|
5445
6012
|
});
|
|
5446
6013
|
}
|
|
5447
6014
|
return ((options = {}) => {
|
|
@@ -5461,7 +6028,12 @@ function createGenAiSpan$2(data, operation, provider, options) {
|
|
|
5461
6028
|
if ((0, _sentry_core._INTERNAL_shouldSkipAiProviderWrapping)(provider.integrationName)) return;
|
|
5462
6029
|
const args = data.arguments ?? [];
|
|
5463
6030
|
const params = args[0];
|
|
5464
|
-
const
|
|
6031
|
+
const call = {
|
|
6032
|
+
operation,
|
|
6033
|
+
request: params
|
|
6034
|
+
};
|
|
6035
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
6036
|
+
data._sentryRecordOutputs = recordOutputs;
|
|
5465
6037
|
const attributes = require_exports.extractRequestAttributes$3(args, operation, recordInputs);
|
|
5466
6038
|
attributes[_sentry_conventions_attributes.GEN_AI_PROVIDER_NAME] = provider.providerName;
|
|
5467
6039
|
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = provider.origin;
|
|
@@ -5473,6 +6045,8 @@ function createGenAiSpan$2(data, operation, provider, options) {
|
|
|
5473
6045
|
attributes
|
|
5474
6046
|
});
|
|
5475
6047
|
if (recordInputs && params) require_exports.addRequestAttributes$1(span, params, operation);
|
|
6048
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
6049
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
5476
6050
|
return span;
|
|
5477
6051
|
}
|
|
5478
6052
|
function isAsyncIterable$1(value) {
|
|
@@ -5487,12 +6061,11 @@ function isAsyncIterable$1(value) {
|
|
|
5487
6061
|
* to hand span-ending ownership to `instrumentStream`; `false` for non-streaming/errored results, which end
|
|
5488
6062
|
* via the normal `beforeSpanEnd` path.
|
|
5489
6063
|
*/
|
|
5490
|
-
function wrapStreamResult$1(span, data
|
|
6064
|
+
function wrapStreamResult$1(span, data) {
|
|
5491
6065
|
const result = data.result;
|
|
5492
6066
|
if (!isAsyncIterable$1(result)) return false;
|
|
5493
|
-
const { recordOutputs } = require_exports.resolveAIRecordingOptions(options);
|
|
5494
6067
|
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
5495
|
-
const instrumented = require_exports.instrumentStream$1({ [Symbol.asyncIterator]: iterate }, span,
|
|
6068
|
+
const instrumented = require_exports.instrumentStream$1({ [Symbol.asyncIterator]: iterate }, span, !!data._sentryRecordOutputs, data._sentryOnSpanEnd);
|
|
5496
6069
|
result[Symbol.asyncIterator] = () => instrumented;
|
|
5497
6070
|
return true;
|
|
5498
6071
|
}
|
|
@@ -5587,12 +6160,11 @@ const _langGraphIntegration = ((options = {}) => {
|
|
|
5587
6160
|
};
|
|
5588
6161
|
});
|
|
5589
6162
|
function instrumentLanggraph(options) {
|
|
5590
|
-
const
|
|
5591
|
-
const sentryHandler = require_exports.createLangChainCallbackHandler(resolvedOptions);
|
|
6163
|
+
const sentryHandler = require_exports.createLangChainCallbackHandler(require_exports.getBooleanRecordingOptions(options));
|
|
5592
6164
|
tracingChannel(CHANNELS.LANGGRAPH_STATE_GRAPH_COMPILE).end.subscribe((message) => {
|
|
5593
6165
|
if (insideCreateReactAgent || require_exports.isInsideManualLangGraphInstrumentation()) return;
|
|
5594
6166
|
const { arguments: args, result } = message;
|
|
5595
|
-
require_exports.instrumentCompiledGraph(result, getFirstArgObject(args) ?? {},
|
|
6167
|
+
require_exports.instrumentCompiledGraph(result, getFirstArgObject(args) ?? {}, options, null, sentryHandler);
|
|
5596
6168
|
});
|
|
5597
6169
|
const reactAgentChannel = tracingChannel(CHANNELS.LANGGRAPH_CREATE_REACT_AGENT);
|
|
5598
6170
|
reactAgentChannel.start.subscribe((message) => {
|
|
@@ -5600,7 +6172,7 @@ function instrumentLanggraph(options) {
|
|
|
5600
6172
|
try {
|
|
5601
6173
|
const { arguments: args } = message;
|
|
5602
6174
|
const params = getFirstArgObject(args);
|
|
5603
|
-
if (params && Array.isArray(params.tools) && params.tools.length > 0) require_exports.wrapToolsWithSpans(params.tools,
|
|
6175
|
+
if (params && Array.isArray(params.tools) && params.tools.length > 0) require_exports.wrapToolsWithSpans(params.tools, options, require_exports.extractAgentNameFromParams(args) ?? void 0);
|
|
5604
6176
|
} catch (error) {
|
|
5605
6177
|
require_debug_build.DEBUG_BUILD && _sentry_core.debug.error("[instrumentation:langgraph] failed to wrap createReactAgent tools", error);
|
|
5606
6178
|
}
|
|
@@ -5610,7 +6182,7 @@ function instrumentLanggraph(options) {
|
|
|
5610
6182
|
if (require_exports.isInsideManualLangGraphInstrumentation()) return;
|
|
5611
6183
|
const { arguments: args, result } = message;
|
|
5612
6184
|
const agentName = require_exports.extractAgentNameFromParams(args) ?? void 0;
|
|
5613
|
-
require_exports.instrumentCompiledGraph(result, agentName ? { name: agentName } : {},
|
|
6185
|
+
require_exports.instrumentCompiledGraph(result, agentName ? { name: agentName } : {}, options, require_exports.extractLLMFromParams(args), sentryHandler);
|
|
5614
6186
|
});
|
|
5615
6187
|
reactAgentChannel.error.subscribe(() => {
|
|
5616
6188
|
insideCreateReactAgent = false;
|
|
@@ -5767,6 +6339,22 @@ function getRequestContentAttributes(context) {
|
|
|
5767
6339
|
[_sentry_conventions_attributes.GEN_AI_TOOL_DEFINITIONS]: tools.length ? (0, _sentry_core.stringify)(tools) : void 0
|
|
5768
6340
|
};
|
|
5769
6341
|
}
|
|
6342
|
+
/**
|
|
6343
|
+
* Records `gen_ai.response.time_to_first_chunk` for a streamed request. The stream has one consumer,
|
|
6344
|
+
* so instead of reading it, this wraps `push`, which the provider calls for each event as it decodes
|
|
6345
|
+
* it. The wrapper is removed after the first chunk.
|
|
6346
|
+
*/
|
|
6347
|
+
function observePiAiFirstChunk(span, events) {
|
|
6348
|
+
const push = events?.push;
|
|
6349
|
+
if (!events || typeof push !== "function") return;
|
|
6350
|
+
events.push = function(event) {
|
|
6351
|
+
if (event?.type !== "start") {
|
|
6352
|
+
require_exports.recordTimeToFirstChunk(span);
|
|
6353
|
+
events.push = push;
|
|
6354
|
+
}
|
|
6355
|
+
return push.call(this, event);
|
|
6356
|
+
};
|
|
6357
|
+
}
|
|
5770
6358
|
// src/integrations/pi-ai.ts
|
|
5771
6359
|
const _piAiIntegration = ((options = {}) => {
|
|
5772
6360
|
return {
|
|
@@ -5782,32 +6370,52 @@ function instrumentPiAi(options) {
|
|
|
5782
6370
|
const startSpan = (data, streaming) => {
|
|
5783
6371
|
if (require_exports.isInsidePiAiSpan()) return;
|
|
5784
6372
|
const [model, context, callOptions] = data.arguments ?? [];
|
|
5785
|
-
const
|
|
6373
|
+
const call = {
|
|
6374
|
+
model,
|
|
6375
|
+
context,
|
|
6376
|
+
options: callOptions
|
|
6377
|
+
};
|
|
6378
|
+
const driver = require_exports.getPiAiDriver();
|
|
6379
|
+
const { recordInputs, recordOutputs } = require_exports.resolvePiAiRecordingOptions(options, call, driver);
|
|
5786
6380
|
data._sentryRecordOutputs = recordOutputs;
|
|
5787
|
-
|
|
6381
|
+
const span = (0, _sentry_core.startInactiveSpan)(getPiAiChatSpanOptions({
|
|
5788
6382
|
model: model ?? {},
|
|
5789
6383
|
context,
|
|
5790
6384
|
callOptions,
|
|
5791
6385
|
streaming,
|
|
5792
6386
|
recordInputs
|
|
5793
6387
|
}));
|
|
6388
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
6389
|
+
driver?.onSpanStart(span);
|
|
6390
|
+
data._sentryOnSpanEnd = (result) => {
|
|
6391
|
+
require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
6392
|
+
driver?.onSpanEnd(span, result);
|
|
6393
|
+
};
|
|
6394
|
+
return span;
|
|
5794
6395
|
};
|
|
5795
|
-
const
|
|
6396
|
+
const beforeSpanEnd = (span, data, message) => {
|
|
6397
|
+
if ("error" in data) {
|
|
6398
|
+
data._sentryOnSpanEnd?.({ error: data.error });
|
|
6399
|
+
return;
|
|
6400
|
+
}
|
|
5796
6401
|
if (message && typeof message === "object") setPiAiResponseAttributes(span, message, !!data._sentryRecordOutputs);
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
6402
|
+
data._sentryOnSpanEnd?.({ response: message });
|
|
6403
|
+
};
|
|
6404
|
+
bindTracingChannelToSpan(streamChannel, (data) => startSpan(data, true), {
|
|
6405
|
+
deferSpanEnd: ({ span, data, end }) => {
|
|
6406
|
+
const events = data.result;
|
|
6407
|
+
const settled = "error" in data || typeof events?.result !== "function" ? void 0 : events.result();
|
|
6408
|
+
if (!(0, _sentry_core.isThenable)(settled)) return false;
|
|
6409
|
+
observePiAiFirstChunk(span, events);
|
|
6410
|
+
settled.then((message) => {
|
|
6411
|
+
data._sentryMessage = message;
|
|
6412
|
+
end();
|
|
6413
|
+
}, end);
|
|
6414
|
+
return true;
|
|
6415
|
+
},
|
|
6416
|
+
beforeSpanEnd: (span, data) => beforeSpanEnd(span, data, data._sentryMessage)
|
|
6417
|
+
});
|
|
6418
|
+
bindTracingChannelToSpan(completeChannel, (data) => startSpan(data, false), { beforeSpanEnd: (span, data) => beforeSpanEnd(span, data, data.result) });
|
|
5811
6419
|
}
|
|
5812
6420
|
/**
|
|
5813
6421
|
* Traces the requests sent with pi-ai (`@earendil-works/pi-ai` >= 0.80.0 < 2) as `gen_ai.chat` spans,
|
|
@@ -6028,7 +6636,14 @@ function instrumentToolPhase(runtime, runs, wrapTool) {
|
|
|
6028
6636
|
/** Wrap a tool so each call gets a `gen_ai.execute_tool` span. */
|
|
6029
6637
|
function instrumentTool(tool, runs, options) {
|
|
6030
6638
|
const execute = (args, api, context) => {
|
|
6031
|
-
const
|
|
6639
|
+
const toolCall = {
|
|
6640
|
+
operation: "execute_tool",
|
|
6641
|
+
tool,
|
|
6642
|
+
args,
|
|
6643
|
+
api,
|
|
6644
|
+
context
|
|
6645
|
+
};
|
|
6646
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, toolCall);
|
|
6032
6647
|
const phaseCalls = runs.toolCalls.get(api?.taskId);
|
|
6033
6648
|
const calls = phaseCalls?.some((call) => call.callId !== void 0 && call.callId === api?.callId) ? void 0 : phaseCalls;
|
|
6034
6649
|
return (0, _sentry_core.startSpanManual)({
|
|
@@ -6050,9 +6665,11 @@ function instrumentTool(tool, runs, options) {
|
|
|
6050
6665
|
recordOutputs
|
|
6051
6666
|
};
|
|
6052
6667
|
calls?.push(call);
|
|
6668
|
+
require_exports.runGenAiSpanStart(options, span, toolCall);
|
|
6053
6669
|
try {
|
|
6054
6670
|
const result = await tool.execute(args, trackOwnedConversations(api, span, runs), context);
|
|
6055
6671
|
call.endTimestamp = (0, _sentry_core.timestampInSeconds)();
|
|
6672
|
+
call.onSpanEnd = () => require_exports.runGenAiSpanEnd(options, span, toolCall, { response: result });
|
|
6056
6673
|
if (!calls) finishToolCall(call, {
|
|
6057
6674
|
content: result?.output ?? result?.content,
|
|
6058
6675
|
isError: result?.isError
|
|
@@ -6061,6 +6678,7 @@ function instrumentTool(tool, runs, options) {
|
|
|
6061
6678
|
} catch (error) {
|
|
6062
6679
|
call.endTimestamp = (0, _sentry_core.timestampInSeconds)();
|
|
6063
6680
|
call.failed = true;
|
|
6681
|
+
call.onSpanEnd = () => require_exports.runGenAiSpanEnd(options, span, toolCall, { error });
|
|
6064
6682
|
if (context?.abortSignal?.aborted) span.setStatus({
|
|
6065
6683
|
code: _sentry_core.SPAN_STATUS_ERROR,
|
|
6066
6684
|
message: "cancelled"
|
|
@@ -6075,7 +6693,10 @@ function instrumentTool(tool, runs, options) {
|
|
|
6075
6693
|
type: PI_DURABLE_ORIGIN
|
|
6076
6694
|
} });
|
|
6077
6695
|
}
|
|
6078
|
-
if (!calls)
|
|
6696
|
+
if (!calls) {
|
|
6697
|
+
call.onSpanEnd();
|
|
6698
|
+
span.end(call.endTimestamp);
|
|
6699
|
+
}
|
|
6079
6700
|
throw error;
|
|
6080
6701
|
}
|
|
6081
6702
|
});
|
|
@@ -6093,6 +6714,7 @@ function finishToolCall(call, message) {
|
|
|
6093
6714
|
message: "internal_error"
|
|
6094
6715
|
});
|
|
6095
6716
|
}
|
|
6717
|
+
call.onSpanEnd?.();
|
|
6096
6718
|
call.span.end(call.endTimestamp);
|
|
6097
6719
|
}
|
|
6098
6720
|
function observeToolResultEntries(tx, committed) {
|
|
@@ -6196,6 +6818,7 @@ function endRunsOnClose(harnessOptions, harness) {
|
|
|
6196
6818
|
code: _sentry_core.SPAN_STATUS_ERROR,
|
|
6197
6819
|
message: "cancelled"
|
|
6198
6820
|
});
|
|
6821
|
+
call.onSpanEnd?.();
|
|
6199
6822
|
call.span.end(call.endTimestamp);
|
|
6200
6823
|
}
|
|
6201
6824
|
runs.toolCalls.clear();
|
|
@@ -6273,7 +6896,11 @@ function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, option
|
|
|
6273
6896
|
}
|
|
6274
6897
|
}
|
|
6275
6898
|
scope.setConversationId(sessionId ?? toSentryConversationId(runs, conversationId));
|
|
6276
|
-
require_exports.
|
|
6899
|
+
require_exports.setPiAiDriverOptions(scope, options, {
|
|
6900
|
+
operation: "chat",
|
|
6901
|
+
runtime,
|
|
6902
|
+
context
|
|
6903
|
+
});
|
|
6277
6904
|
try {
|
|
6278
6905
|
return await phase(observed);
|
|
6279
6906
|
} catch (error) {
|
|
@@ -6375,7 +7002,7 @@ function finishClassifierEvaluation(call, message) {
|
|
|
6375
7002
|
});
|
|
6376
7003
|
if ((0, _sentry_core.isObjectLike)(data?.input)) span.setAttribute(_sentry_conventions_attributes.GEN_AI_INPUT_MESSAGES, require_exports.getEvaluationInputMessages(data.input));
|
|
6377
7004
|
if (data?.output !== void 0) span.setAttribute(_sentry_conventions_attributes.GEN_AI_OUTPUT_MESSAGES, require_exports.getEvaluationOutputMessages(data.output));
|
|
6378
|
-
|
|
7005
|
+
call.end?.();
|
|
6379
7006
|
}
|
|
6380
7007
|
// src/integrations/mastra.ts
|
|
6381
7008
|
/** Mastra AISpan → the id the exporter keys its Sentry span on. */
|
|
@@ -7200,9 +7827,10 @@ function instrumentMistral(options) {
|
|
|
7200
7827
|
for (const { channel, operation, streaming } of INSTRUMENTED_CHANNELS$1) bindTracingChannelToSpan(tracingChannel(channel), (data) => createGenAiSpan$1(data, operation, streaming, options), {
|
|
7201
7828
|
beforeSpanEnd: (span, data) => {
|
|
7202
7829
|
if ("error" in data) require_exports.markCancelledIfAborted(span, require_exports.getMistralRequestSignal(data.arguments?.[1]));
|
|
7203
|
-
require_exports.addResponseAttributes$1(span, data.result,
|
|
7830
|
+
require_exports.addResponseAttributes$1(span, data.result, !!data._sentryRecordOutputs);
|
|
7831
|
+
data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result });
|
|
7204
7832
|
},
|
|
7205
|
-
deferSpanEnd: ({ span, data }) => streaming && require_exports.instrumentEventStream(data.result, span,
|
|
7833
|
+
deferSpanEnd: ({ span, data }) => streaming && require_exports.instrumentEventStream(data.result, span, !!data._sentryRecordOutputs, require_exports.getMistralRequestSignal(data.arguments?.[1]), data._sentryOnSpanEnd)
|
|
7206
7834
|
});
|
|
7207
7835
|
}
|
|
7208
7836
|
/**
|
|
@@ -7213,7 +7841,12 @@ function createGenAiSpan$1(data, operation, streaming, options) {
|
|
|
7213
7841
|
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$10)) return;
|
|
7214
7842
|
const args = data.arguments ?? [];
|
|
7215
7843
|
const params = args[0];
|
|
7216
|
-
const
|
|
7844
|
+
const call = {
|
|
7845
|
+
operation,
|
|
7846
|
+
request: params
|
|
7847
|
+
};
|
|
7848
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
7849
|
+
data._sentryRecordOutputs = recordOutputs;
|
|
7217
7850
|
const attributes = require_exports.extractRequestAttributes(args, operation, recordInputs, streaming);
|
|
7218
7851
|
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = require_exports.MISTRAL_ORIGIN;
|
|
7219
7852
|
const span = (0, _sentry_core.startInactiveSpan)({
|
|
@@ -7222,6 +7855,8 @@ function createGenAiSpan$1(data, operation, streaming, options) {
|
|
|
7222
7855
|
attributes
|
|
7223
7856
|
});
|
|
7224
7857
|
if (recordInputs && params) require_exports.addRequestAttributes(span, params, operation);
|
|
7858
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
7859
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
7225
7860
|
return span;
|
|
7226
7861
|
}
|
|
7227
7862
|
/**
|
|
@@ -7254,9 +7889,22 @@ const _typesafeIntegration = ((options = {}) => {
|
|
|
7254
7889
|
};
|
|
7255
7890
|
});
|
|
7256
7891
|
function instrumentTypeSafe(options) {
|
|
7257
|
-
bindTracingChannelToSpan(tracingChannel(CHANNELS.TYPESAFE_SYSTEM_ONE), (data) =>
|
|
7892
|
+
bindTracingChannelToSpan(tracingChannel(CHANNELS.TYPESAFE_SYSTEM_ONE), (data) => {
|
|
7893
|
+
const request = data.arguments?.[0];
|
|
7894
|
+
const call = { request };
|
|
7895
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
7896
|
+
data._sentryRecordOutputs = recordOutputs;
|
|
7897
|
+
const span = require_exports.startDecideSpan(request, data.self, recordInputs);
|
|
7898
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
7899
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
7900
|
+
return span;
|
|
7901
|
+
}, {
|
|
7258
7902
|
beforeSpanEnd: (span, data) => {
|
|
7259
|
-
if (
|
|
7903
|
+
if ("error" in data) data._sentryOnSpanEnd?.({ error: data.error });
|
|
7904
|
+
else {
|
|
7905
|
+
require_exports.addResponseAttributes(span, data.result, !!data._sentryRecordOutputs);
|
|
7906
|
+
data._sentryOnSpanEnd?.({ response: data.result });
|
|
7907
|
+
}
|
|
7260
7908
|
},
|
|
7261
7909
|
deferSpanEnd: ({ data, end }) => require_exports.onSystemOneResponse(data.result, (body) => {
|
|
7262
7910
|
data.result = body;
|
|
@@ -7494,6 +8142,215 @@ const _mysql2Integration = (() => {
|
|
|
7494
8142
|
* (the common case) are fully instrumented.
|
|
7495
8143
|
*/
|
|
7496
8144
|
const mysql2Integration = (0, _sentry_core.defineIntegration)(_mysql2Integration);
|
|
8145
|
+
// src/integrations/pino.ts
|
|
8146
|
+
const SENTRY_TRACK_SYMBOL = Symbol("sentry-track-pino-logger");
|
|
8147
|
+
/**
|
|
8148
|
+
* Gets a custom Pino key from a logger instance by searching for the symbol.
|
|
8149
|
+
* Pino uses non-global symbols like Symbol('pino.messageKey'): https://github.com/pinojs/pino/blob/8a816c0b1f72de5ae9181f3bb402109b66f7d812/lib/symbols.js
|
|
8150
|
+
*/
|
|
8151
|
+
function getPinoKey(logger, symbolName, defaultKey) {
|
|
8152
|
+
const symbols = Object.getOwnPropertySymbols(logger);
|
|
8153
|
+
const symbolString = `Symbol(${symbolName})`;
|
|
8154
|
+
for (const sym of symbols) if (sym.toString() === symbolString) {
|
|
8155
|
+
const value = logger[sym];
|
|
8156
|
+
return typeof value === "string" ? value : defaultKey;
|
|
8157
|
+
}
|
|
8158
|
+
return defaultKey;
|
|
8159
|
+
}
|
|
8160
|
+
const DEFAULT_OPTIONS = {
|
|
8161
|
+
autoInstrument: true,
|
|
8162
|
+
error: {
|
|
8163
|
+
levels: [],
|
|
8164
|
+
handled: true
|
|
8165
|
+
},
|
|
8166
|
+
log: { levels: [
|
|
8167
|
+
"trace",
|
|
8168
|
+
"debug",
|
|
8169
|
+
"info",
|
|
8170
|
+
"warn",
|
|
8171
|
+
"error",
|
|
8172
|
+
"fatal"
|
|
8173
|
+
] }
|
|
8174
|
+
};
|
|
8175
|
+
function stripIgnoredFields(result) {
|
|
8176
|
+
const { level, time, pid, hostname, ...rest } = result;
|
|
8177
|
+
return rest;
|
|
8178
|
+
}
|
|
8179
|
+
const _pinoIntegration = (0, _sentry_core.defineIntegration)((userOptions = {}) => {
|
|
8180
|
+
const options = {
|
|
8181
|
+
autoInstrument: userOptions.autoInstrument !== false,
|
|
8182
|
+
error: {
|
|
8183
|
+
...DEFAULT_OPTIONS.error,
|
|
8184
|
+
...userOptions.error
|
|
8185
|
+
},
|
|
8186
|
+
log: {
|
|
8187
|
+
...DEFAULT_OPTIONS.log,
|
|
8188
|
+
...userOptions.log
|
|
8189
|
+
}
|
|
8190
|
+
};
|
|
8191
|
+
function shouldTrackLogger(logger) {
|
|
8192
|
+
const override = logger[SENTRY_TRACK_SYMBOL];
|
|
8193
|
+
return override === "track" || override !== "ignore" && options.autoInstrument;
|
|
8194
|
+
}
|
|
8195
|
+
return {
|
|
8196
|
+
name: "Pino",
|
|
8197
|
+
setup: () => {
|
|
8198
|
+
const integratedChannel = tracingChannel("pino_asJson");
|
|
8199
|
+
function onPinoStart(self, args, result) {
|
|
8200
|
+
if (!shouldTrackLogger(self)) return;
|
|
8201
|
+
const resultObj = stripIgnoredFields(result);
|
|
8202
|
+
const [captureObj, message, levelNumber] = args;
|
|
8203
|
+
const level = self?.levels?.labels?.[levelNumber] || "info";
|
|
8204
|
+
const messageKey = getPinoKey(self, "pino.messageKey", "msg");
|
|
8205
|
+
const logMessage = message || resultObj?.[messageKey] || "";
|
|
8206
|
+
if (options.log.levels.includes(level)) {
|
|
8207
|
+
const attributes = {
|
|
8208
|
+
...resultObj,
|
|
8209
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: "auto.log.pino",
|
|
8210
|
+
"pino.logger.level": levelNumber
|
|
8211
|
+
};
|
|
8212
|
+
(0, _sentry_core._INTERNAL_captureLog)({
|
|
8213
|
+
level,
|
|
8214
|
+
message: logMessage,
|
|
8215
|
+
attributes
|
|
8216
|
+
});
|
|
8217
|
+
}
|
|
8218
|
+
if (options.error.levels.includes(level)) {
|
|
8219
|
+
const errorKey = getPinoKey(self, "pino.errorKey", "err");
|
|
8220
|
+
const pinoContext = {};
|
|
8221
|
+
for (const [key, value] of Object.entries(resultObj)) if (key !== errorKey && key !== messageKey) pinoContext[key] = value;
|
|
8222
|
+
if (logMessage) pinoContext[messageKey] = logMessage;
|
|
8223
|
+
const captureContext = {
|
|
8224
|
+
level: (0, _sentry_core.severityLevelFromString)(level),
|
|
8225
|
+
contexts: { pino: pinoContext }
|
|
8226
|
+
};
|
|
8227
|
+
(0, _sentry_core.withScope)((scope) => {
|
|
8228
|
+
scope.addEventProcessor((event) => {
|
|
8229
|
+
event.logger = "pino";
|
|
8230
|
+
(0, _sentry_core.addExceptionMechanism)(event, {
|
|
8231
|
+
handled: options.error.handled,
|
|
8232
|
+
type: "auto.log.pino"
|
|
8233
|
+
});
|
|
8234
|
+
return event;
|
|
8235
|
+
});
|
|
8236
|
+
const error = captureObj[errorKey];
|
|
8237
|
+
if (error) {
|
|
8238
|
+
(0, _sentry_core.captureException)(error, captureContext);
|
|
8239
|
+
return;
|
|
8240
|
+
}
|
|
8241
|
+
(0, _sentry_core.captureMessage)(logMessage, captureContext);
|
|
8242
|
+
});
|
|
8243
|
+
}
|
|
8244
|
+
}
|
|
8245
|
+
integratedChannel.end.subscribe((data) => {
|
|
8246
|
+
const { instance, arguments: args, result } = data;
|
|
8247
|
+
onPinoStart(instance, args, JSON.parse(result));
|
|
8248
|
+
});
|
|
8249
|
+
}
|
|
8250
|
+
};
|
|
8251
|
+
});
|
|
8252
|
+
/**
|
|
8253
|
+
* Integration for Pino logging library.
|
|
8254
|
+
* Captures Pino logs as Sentry logs and optionally captures some log levels as events.
|
|
8255
|
+
*
|
|
8256
|
+
* By default, all Pino loggers will be captured. To ignore a specific logger, use `pinoIntegration.untrackLogger(logger)`.
|
|
8257
|
+
*
|
|
8258
|
+
* If you disable automatic instrumentation with `autoInstrument: false`, you can mark specific loggers to be tracked with `pinoIntegration.trackLogger(logger)`.
|
|
8259
|
+
*
|
|
8260
|
+
* Requires Pino >=v8.0.0
|
|
8261
|
+
*/
|
|
8262
|
+
const pinoIntegration = Object.assign(_pinoIntegration, {
|
|
8263
|
+
trackLogger(logger) {
|
|
8264
|
+
if ((0, _sentry_core.isObjectLike)(logger) && "levels" in logger) logger[SENTRY_TRACK_SYMBOL] = "track";
|
|
8265
|
+
},
|
|
8266
|
+
untrackLogger(logger) {
|
|
8267
|
+
if ((0, _sentry_core.isObjectLike)(logger) && "levels" in logger) logger[SENTRY_TRACK_SYMBOL] = "ignore";
|
|
8268
|
+
}
|
|
8269
|
+
});
|
|
8270
|
+
// src/integrations/winston.ts
|
|
8271
|
+
const DEFAULT_CAPTURED_LEVELS = [
|
|
8272
|
+
"trace",
|
|
8273
|
+
"debug",
|
|
8274
|
+
"info",
|
|
8275
|
+
"warn",
|
|
8276
|
+
"error",
|
|
8277
|
+
"fatal"
|
|
8278
|
+
];
|
|
8279
|
+
const LEVEL_SYMBOL = Symbol.for("level");
|
|
8280
|
+
const MESSAGE_SYMBOL = Symbol.for("message");
|
|
8281
|
+
const SPLAT_SYMBOL = Symbol.for("splat");
|
|
8282
|
+
/**
|
|
8283
|
+
* Creates a new Sentry Winston transport that fowards logs to Sentry.
|
|
8284
|
+
*
|
|
8285
|
+
* Supports Winston 3.x.x.
|
|
8286
|
+
*
|
|
8287
|
+
* @param TransportClass - The Winston transport class to extend.
|
|
8288
|
+
* @returns The extended transport class.
|
|
8289
|
+
*
|
|
8290
|
+
* @example
|
|
8291
|
+
* ```ts
|
|
8292
|
+
* const winston = require('winston');
|
|
8293
|
+
* const Transport = require('winston-transport');
|
|
8294
|
+
*
|
|
8295
|
+
* const SentryWinstonTransport = Sentry.createSentryWinstonTransport(Transport);
|
|
8296
|
+
*
|
|
8297
|
+
* const logger = winston.createLogger({
|
|
8298
|
+
* transports: [new SentryWinstonTransport()],
|
|
8299
|
+
* });
|
|
8300
|
+
* ```
|
|
8301
|
+
*/
|
|
8302
|
+
function createSentryWinstonTransport(TransportClass, sentryWinstonOptions) {
|
|
8303
|
+
class SentryWinstonTransport extends TransportClass {
|
|
8304
|
+
constructor(options) {
|
|
8305
|
+
super(options);
|
|
8306
|
+
this._levels = new Set(sentryWinstonOptions?.levels ?? DEFAULT_CAPTURED_LEVELS);
|
|
8307
|
+
}
|
|
8308
|
+
/**
|
|
8309
|
+
* Forwards a winston log to the Sentry SDK.
|
|
8310
|
+
*/
|
|
8311
|
+
log(info, callback) {
|
|
8312
|
+
try {
|
|
8313
|
+
setImmediate(() => {
|
|
8314
|
+
this.emit("logged", info);
|
|
8315
|
+
});
|
|
8316
|
+
if (!(0, _sentry_core.isObjectLike)(info)) return;
|
|
8317
|
+
const levelFromSymbol = info[LEVEL_SYMBOL];
|
|
8318
|
+
const { level, message, timestamp, ...attributes } = info;
|
|
8319
|
+
attributes[LEVEL_SYMBOL] = void 0;
|
|
8320
|
+
attributes[MESSAGE_SYMBOL] = void 0;
|
|
8321
|
+
attributes[SPLAT_SYMBOL] = void 0;
|
|
8322
|
+
const customLevel = sentryWinstonOptions?.customLevelMap?.[levelFromSymbol];
|
|
8323
|
+
const winstonLogLevel = WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP[levelFromSymbol];
|
|
8324
|
+
const logSeverityLevel = customLevel ?? winstonLogLevel ?? "info";
|
|
8325
|
+
if (this._levels.has(logSeverityLevel)) (0, _sentry_core._INTERNAL_captureLog)({
|
|
8326
|
+
level: logSeverityLevel,
|
|
8327
|
+
message,
|
|
8328
|
+
attributes: {
|
|
8329
|
+
...attributes,
|
|
8330
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: "auto.log.winston"
|
|
8331
|
+
}
|
|
8332
|
+
});
|
|
8333
|
+
else if (!customLevel && !winstonLogLevel) require_debug_build.DEBUG_BUILD && _sentry_core.debug.log(`Winston log level ${levelFromSymbol} is not captured by Sentry. Please add ${levelFromSymbol} to the "customLevelMap" option of the Sentry Winston transport.`);
|
|
8334
|
+
} catch {}
|
|
8335
|
+
if (callback) callback();
|
|
8336
|
+
}
|
|
8337
|
+
}
|
|
8338
|
+
return SentryWinstonTransport;
|
|
8339
|
+
}
|
|
8340
|
+
const WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP = {
|
|
8341
|
+
silly: "trace",
|
|
8342
|
+
debug: "debug",
|
|
8343
|
+
verbose: "debug",
|
|
8344
|
+
http: "debug",
|
|
8345
|
+
info: "info",
|
|
8346
|
+
notice: "info",
|
|
8347
|
+
warn: "warn",
|
|
8348
|
+
warning: "warn",
|
|
8349
|
+
error: "error",
|
|
8350
|
+
emerg: "fatal",
|
|
8351
|
+
alert: "fatal",
|
|
8352
|
+
crit: "fatal"
|
|
8353
|
+
};
|
|
7497
8354
|
// src/integrations/openai.ts
|
|
7498
8355
|
const INTEGRATION_NAME$7 = "OpenAI";
|
|
7499
8356
|
const ORIGIN$8 = "auto.ai.openai";
|
|
@@ -7523,12 +8380,13 @@ function instrumentOpenai(options) {
|
|
|
7523
8380
|
for (const { channel, operation } of INSTRUMENTED_CHANNELS) bindTracingChannelToSpan(tracingChannel(channel), (data) => createGenAiSpan(data, operation, options), {
|
|
7524
8381
|
beforeSpanEnd: (span, data) => {
|
|
7525
8382
|
if ("error" in data) require_exports.markCancelledIfAborted(span, require_exports.getRequestSignal(data.arguments?.[1]));
|
|
7526
|
-
require_exports.addResponseAttributes$4(span, data.result,
|
|
8383
|
+
require_exports.addResponseAttributes$4(span, data.result, !!data._sentryRecordOutputs, operation);
|
|
8384
|
+
data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result });
|
|
7527
8385
|
},
|
|
7528
8386
|
deferSpanEnd: ({ span, data, end }) => wrapApiPromiseResponse(data.result, (response) => {
|
|
7529
8387
|
data.result = response;
|
|
7530
|
-
if (!wrapStreamResult(span, data
|
|
7531
|
-
}, end) || wrapStreamResult(span, data
|
|
8388
|
+
if (!wrapStreamResult(span, data)) end();
|
|
8389
|
+
}, end) || wrapStreamResult(span, data)
|
|
7532
8390
|
});
|
|
7533
8391
|
}
|
|
7534
8392
|
/**
|
|
@@ -7539,7 +8397,12 @@ function createGenAiSpan(data, operation, options) {
|
|
|
7539
8397
|
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$7)) return;
|
|
7540
8398
|
const args = data.arguments ?? [];
|
|
7541
8399
|
const params = args[0];
|
|
7542
|
-
const
|
|
8400
|
+
const call = {
|
|
8401
|
+
operation,
|
|
8402
|
+
request: params
|
|
8403
|
+
};
|
|
8404
|
+
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
8405
|
+
data._sentryRecordOutputs = recordOutputs;
|
|
7543
8406
|
const attributes = require_exports.extractRequestAttributes$3(args, operation, recordInputs);
|
|
7544
8407
|
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$8;
|
|
7545
8408
|
const model = params?.model || "unknown";
|
|
@@ -7550,6 +8413,8 @@ function createGenAiSpan(data, operation, options) {
|
|
|
7550
8413
|
attributes
|
|
7551
8414
|
});
|
|
7552
8415
|
if (recordInputs && params) require_exports.addRequestAttributes$1(span, params, operation);
|
|
8416
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
8417
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
7553
8418
|
return span;
|
|
7554
8419
|
}
|
|
7555
8420
|
function isAsyncIterable(value) {
|
|
@@ -7564,12 +8429,11 @@ function isAsyncIterable(value) {
|
|
|
7564
8429
|
* to hand span-ending ownership to `instrumentStream`; `false` for non-streaming/errored results, which end
|
|
7565
8430
|
* via the normal `beforeSpanEnd` path.
|
|
7566
8431
|
*/
|
|
7567
|
-
function wrapStreamResult(span, data
|
|
8432
|
+
function wrapStreamResult(span, data) {
|
|
7568
8433
|
const result = data.result;
|
|
7569
8434
|
if (!isAsyncIterable(result)) return false;
|
|
7570
|
-
const { recordOutputs } = require_exports.resolveAIRecordingOptions(options);
|
|
7571
8435
|
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
7572
|
-
const instrumented = require_exports.instrumentStream$1({ [Symbol.asyncIterator]: iterate }, span,
|
|
8436
|
+
const instrumented = require_exports.instrumentStream$1({ [Symbol.asyncIterator]: iterate }, span, !!data._sentryRecordOutputs, data._sentryOnSpanEnd);
|
|
7573
8437
|
result[Symbol.asyncIterator] = () => instrumented;
|
|
7574
8438
|
return true;
|
|
7575
8439
|
}
|
|
@@ -8250,7 +9114,6 @@ function setAttributeIfDefined(attributes, key, value) {
|
|
|
8250
9114
|
if (value != null) attributes[key] = value;
|
|
8251
9115
|
}
|
|
8252
9116
|
// src/integrations/vercel-ai/util.ts
|
|
8253
|
-
/** Shared, state-free helpers for the Vercel AI (`ai`) channel subscribers, plus the streamed model-call tap. */
|
|
8254
9117
|
/** Narrow to a string, or `undefined` for anything else. */
|
|
8255
9118
|
function asString(value) {
|
|
8256
9119
|
return typeof value === "string" ? value : void 0;
|
|
@@ -8272,7 +9135,7 @@ function sum(a, b) {
|
|
|
8272
9135
|
* `try/catch` around every read guarantees the owning span is always ended — a leaked open span on a
|
|
8273
9136
|
* mid-stream failure would be worse than a slightly-less-enriched one.
|
|
8274
9137
|
*/
|
|
8275
|
-
function tapModelCallStream(stream, onFinal, onError) {
|
|
9138
|
+
function tapModelCallStream(span, stream, onFinal, onError) {
|
|
8276
9139
|
const reader = stream.getReader();
|
|
8277
9140
|
const state = { toolCalls: [] };
|
|
8278
9141
|
let text = "";
|
|
@@ -8297,6 +9160,7 @@ function tapModelCallStream(stream, onFinal, onError) {
|
|
|
8297
9160
|
controller.close();
|
|
8298
9161
|
return;
|
|
8299
9162
|
}
|
|
9163
|
+
if (value?.type !== "stream-start") require_exports.recordTimeToFirstChunk(span);
|
|
8300
9164
|
text += accumulateChunk(state, value) ?? "";
|
|
8301
9165
|
controller.enqueue(value);
|
|
8302
9166
|
} catch (error) {
|
|
@@ -8460,7 +9324,13 @@ function resolveToolDescription(callId, toolName, tools) {
|
|
|
8460
9324
|
return (0, _sentry_core.isObjectLike)(tool) ? asString(tool.description) : void 0;
|
|
8461
9325
|
}
|
|
8462
9326
|
}
|
|
9327
|
+
const integrationRecordingBySpan = /* @__PURE__ */ new WeakMap();
|
|
8463
9328
|
const fallbackChannelResults = /* @__PURE__ */ new WeakMap();
|
|
9329
|
+
const spanEndHooks = /* @__PURE__ */ new WeakMap();
|
|
9330
|
+
/** Runs the `onSpanEnd` hook of a span that `createSpanFromMessage` started. Call it right before the span ends. */
|
|
9331
|
+
function runVercelAiSpanEnd(span, result) {
|
|
9332
|
+
spanEndHooks.get(span)?.(result);
|
|
9333
|
+
}
|
|
8464
9334
|
/**
|
|
8465
9335
|
* Subscribe Sentry span handlers to the `ai` SDK's native telemetry tracing channel (`ai:telemetry`,
|
|
8466
9336
|
* available in `ai` >= 7) and emit fully-formed `gen_ai.*` spans directly — no OpenTelemetry span
|
|
@@ -8476,33 +9346,39 @@ const fallbackChannelResults = /* @__PURE__ */ new WeakMap();
|
|
|
8476
9346
|
function subscribeVercelAiTracingChannel(tracingChannel, options = {}) {
|
|
8477
9347
|
bindTracingChannelToSpan(tracingChannel(AI_SDK_TELEMETRY_TRACING_CHANNEL), (data) => createSpanFromMessage(data, options), {
|
|
8478
9348
|
beforeSpanEnd: (span, data) => {
|
|
8479
|
-
enrichSpanOnEnd(span, data
|
|
9349
|
+
enrichSpanOnEnd(span, data);
|
|
9350
|
+
runVercelAiSpanEnd(span, "error" in data ? { error: data.error } : { response: getNonStreamResult(span, data) });
|
|
8480
9351
|
fallbackChannelResults.delete(span);
|
|
8481
9352
|
clearOperationId(data);
|
|
8482
9353
|
},
|
|
8483
|
-
deferSpanEnd: ({ span, data, end }) => deferStreamedModelCallEnd(span, data,
|
|
9354
|
+
deferSpanEnd: ({ span, data, end }) => deferStreamedModelCallEnd(span, data, end)
|
|
8484
9355
|
});
|
|
8485
9356
|
}
|
|
9357
|
+
function getNonStreamResult(span, data) {
|
|
9358
|
+
const result = fallbackChannelResults.get(span) ?? data.result;
|
|
9359
|
+
return (0, _sentry_core.isObjectLike)(result) && require_exports.isReadableStream(result.stream) ? void 0 : result;
|
|
9360
|
+
}
|
|
8486
9361
|
/**
|
|
8487
9362
|
* When a `languageModelCall` resolves to a live `ReadableStream`, defer ending its span: swap in a
|
|
8488
9363
|
* passthrough that forwards chunks to the SDK untouched while aggregating usage/finish/output, then
|
|
8489
9364
|
* enrich and end the span once the stream settles. Returns `false` for anything that isn't a streamed
|
|
8490
9365
|
* model call so the helper ends the span as usual.
|
|
8491
9366
|
*/
|
|
8492
|
-
function deferStreamedModelCallEnd(span, data,
|
|
9367
|
+
function deferStreamedModelCallEnd(span, data, end) {
|
|
8493
9368
|
const result = fallbackChannelResults.get(span) ?? data.result;
|
|
8494
9369
|
if (data.type !== "languageModelCall" || !(0, _sentry_core.isObjectLike)(result)) return false;
|
|
8495
9370
|
const stream = result.stream;
|
|
8496
9371
|
if (!require_exports.isReadableStream(stream)) return false;
|
|
8497
9372
|
const callId = asString(data.event.callId);
|
|
8498
|
-
const
|
|
8499
|
-
|
|
9373
|
+
const invokeAgentSpan = callId ? invokeAgentSpanByCallId.get(callId) : void 0;
|
|
9374
|
+
const { recordOutputs } = getRecordingOptions(data.event, invokeAgentSpan && integrationRecordingBySpan.get(invokeAgentSpan), data.result === void 0);
|
|
9375
|
+
result.stream = tapModelCallStream(span, stream, (final) => {
|
|
8500
9376
|
fallbackChannelResults.set(span, {
|
|
8501
9377
|
...result,
|
|
8502
9378
|
...streamedResultToChannelResult(final)
|
|
8503
9379
|
});
|
|
8504
9380
|
end();
|
|
8505
|
-
enrichInvokeAgentFromStream(
|
|
9381
|
+
if (invokeAgentSpan) enrichInvokeAgentFromStream(invokeAgentSpan, final, recordOutputs);
|
|
8506
9382
|
}, (error) => end(error));
|
|
8507
9383
|
return true;
|
|
8508
9384
|
}
|
|
@@ -8533,9 +9409,7 @@ function streamedResultToChannelResult(final) {
|
|
|
8533
9409
|
* the enclosing `invoke_agent` span, which has no channel result of its own. Runs before that span ends
|
|
8534
9410
|
* because the operation's completion promise settles only after every model-call stream has drained.
|
|
8535
9411
|
*/
|
|
8536
|
-
function enrichInvokeAgentFromStream(
|
|
8537
|
-
const span = callId ? invokeAgentSpanByCallId.get(callId) : void 0;
|
|
8538
|
-
if (!span) return;
|
|
9412
|
+
function enrichInvokeAgentFromStream(span, final, recordOutputs) {
|
|
8539
9413
|
const usage = (0, _sentry_core.isObjectLike)(final.usage) ? final.usage : void 0;
|
|
8540
9414
|
if (usage) {
|
|
8541
9415
|
const input = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);
|
|
@@ -8567,7 +9441,23 @@ function addTokensToSpan(span, attribute, value) {
|
|
|
8567
9441
|
function createSpanFromMessage(data, channelOptions) {
|
|
8568
9442
|
const { type, event } = data;
|
|
8569
9443
|
if (type === "step" || !event || typeof event !== "object") return;
|
|
8570
|
-
const
|
|
9444
|
+
const call = {
|
|
9445
|
+
type,
|
|
9446
|
+
event
|
|
9447
|
+
};
|
|
9448
|
+
const integrationRecording = {
|
|
9449
|
+
recordInputs: require_exports.resolveRecordingOption(channelOptions.recordInputs, call),
|
|
9450
|
+
recordOutputs: require_exports.resolveRecordingOption(channelOptions.recordOutputs, call)
|
|
9451
|
+
};
|
|
9452
|
+
const span = startSpanFromEvent(type, event, getRecordingOptions(event, integrationRecording).recordInputs);
|
|
9453
|
+
if (span) {
|
|
9454
|
+
integrationRecordingBySpan.set(span, integrationRecording);
|
|
9455
|
+
require_exports.runGenAiSpanStart(channelOptions, span, call);
|
|
9456
|
+
spanEndHooks.set(span, (result) => require_exports.runGenAiSpanEnd(channelOptions, span, call, result));
|
|
9457
|
+
}
|
|
9458
|
+
return span;
|
|
9459
|
+
}
|
|
9460
|
+
function startSpanFromEvent(type, event, recordInputs) {
|
|
8571
9461
|
const provider = asString(event.provider);
|
|
8572
9462
|
const modelId = asString(event.modelId);
|
|
8573
9463
|
const callId = asString(event.callId);
|
|
@@ -8704,11 +9594,11 @@ function buildToolSpan(event, recordInputs, conversationId, runtimeContextAttrib
|
|
|
8704
9594
|
* Everything here is guarded: when a field is missing or the shape differs across `ai` versions,
|
|
8705
9595
|
* we simply don't set the attribute rather than emit a malformed span.
|
|
8706
9596
|
*/
|
|
8707
|
-
function enrichSpanOnEnd(span, data
|
|
9597
|
+
function enrichSpanOnEnd(span, data) {
|
|
8708
9598
|
const { type } = data;
|
|
8709
9599
|
const result = fallbackChannelResults.get(span) ?? data.result;
|
|
8710
9600
|
if (!(0, _sentry_core.isObjectLike)(result)) return;
|
|
8711
|
-
const { recordOutputs } = getRecordingOptions(data.event,
|
|
9601
|
+
const { recordOutputs } = getRecordingOptions(data.event, integrationRecordingBySpan.get(span), data.result === void 0);
|
|
8712
9602
|
if (type === "executeTool") {
|
|
8713
9603
|
const output = (0, _sentry_core.isObjectLike)(result.output) ? result.output : void 0;
|
|
8714
9604
|
if (output?.type === "tool-error") captureToolError(span, data, output.error);
|
|
@@ -8858,13 +9748,13 @@ function captureToolError(span, data, error) {
|
|
|
8858
9748
|
} });
|
|
8859
9749
|
});
|
|
8860
9750
|
}
|
|
8861
|
-
function getRecordingOptions(event,
|
|
9751
|
+
function getRecordingOptions(event, integrationRecording = {}, channelWithheldResult = false) {
|
|
8862
9752
|
const client = (0, _sentry_core.getClient)();
|
|
8863
9753
|
const genAI = client?.getDataCollectionOptions().genAI;
|
|
8864
9754
|
const eveMode = client && !channelWithheldResult ? isEveGenAiRecordingDefault(client) : false;
|
|
8865
9755
|
return {
|
|
8866
|
-
recordInputs: resolveRecording(
|
|
8867
|
-
recordOutputs: resolveRecording(
|
|
9756
|
+
recordInputs: resolveRecording(integrationRecording.recordInputs, event.recordInputs, genAI?.inputs, eveMode),
|
|
9757
|
+
recordOutputs: resolveRecording(integrationRecording.recordOutputs, event.recordOutputs, genAI?.outputs, eveMode)
|
|
8868
9758
|
};
|
|
8869
9759
|
}
|
|
8870
9760
|
/**
|
|
@@ -9080,12 +9970,14 @@ function bindOperation(tracingChannel, channelName, build, options) {
|
|
|
9080
9970
|
if (callSiteSpan && (0, _sentry_core.isObjectLike)(data.error)) (0, _sentry_core.addNonEnumerableProperty)(data.error, "_sentry_active_span", callSiteSpan);
|
|
9081
9971
|
} else {
|
|
9082
9972
|
message.result = message.type === "executeTool" ? { output: data.result } : data.result;
|
|
9083
|
-
enrichSpanOnEnd(span, message
|
|
9973
|
+
enrichSpanOnEnd(span, message);
|
|
9084
9974
|
}
|
|
9085
|
-
|
|
9975
|
+
const isStream = message.type === "streamText" || message.type === "streamObject";
|
|
9976
|
+
runVercelAiSpanEnd(span, "error" in data ? { error: data.error } : { response: isStream ? void 0 : message.result });
|
|
9977
|
+
if (!isStream) clearOperationId(message);
|
|
9086
9978
|
messages.delete(data);
|
|
9087
9979
|
},
|
|
9088
|
-
deferSpanEnd: ({ span, data, end }) => deferStreamTextOperationEnd(span, data, end
|
|
9980
|
+
deferSpanEnd: ({ span, data, end }) => deferStreamTextOperationEnd(span, data, end)
|
|
9089
9981
|
});
|
|
9090
9982
|
}
|
|
9091
9983
|
/**
|
|
@@ -9098,7 +9990,7 @@ function bindOperation(tracingChannel, channelName, build, options) {
|
|
|
9098
9990
|
* succeeded and `usage` resolved. It's awaited separately so that case still records the token usage on
|
|
9099
9991
|
* the span before ending it as an error.
|
|
9100
9992
|
*/
|
|
9101
|
-
function deferStreamTextOperationEnd(span, data, end
|
|
9993
|
+
function deferStreamTextOperationEnd(span, data, end) {
|
|
9102
9994
|
const message = messages.get(data);
|
|
9103
9995
|
const type = message?.type;
|
|
9104
9996
|
if (!message || type !== "streamText" && type !== "streamObject" || "error" in data || !isStreamingResult(data.result)) return false;
|
|
@@ -9123,7 +10015,7 @@ function deferStreamTextOperationEnd(span, data, end, options) {
|
|
|
9123
10015
|
finishReason,
|
|
9124
10016
|
response
|
|
9125
10017
|
};
|
|
9126
|
-
enrichSpanOnEnd(span, message
|
|
10018
|
+
enrichSpanOnEnd(span, message);
|
|
9127
10019
|
end(objectOutcome.error);
|
|
9128
10020
|
return;
|
|
9129
10021
|
}
|
|
@@ -9252,34 +10144,34 @@ function patchModelMethod(model, method, options) {
|
|
|
9252
10144
|
code: _sentry_core.SPAN_STATUS_ERROR,
|
|
9253
10145
|
message: error instanceof Error ? error.message : "unknown_error"
|
|
9254
10146
|
});
|
|
9255
|
-
span
|
|
10147
|
+
endSpan(span, { error });
|
|
9256
10148
|
clearStreamCallId();
|
|
9257
10149
|
throw error;
|
|
9258
10150
|
};
|
|
9259
10151
|
try {
|
|
9260
10152
|
return Promise.resolve(original.apply(this, args)).then((value) => {
|
|
9261
10153
|
if (method === "doStream" && (0, _sentry_core.isObjectLike)(value) && require_exports.isReadableStream(value.stream)) {
|
|
9262
|
-
value.stream = tapModelCallStream(value.stream, (final) => {
|
|
10154
|
+
value.stream = tapModelCallStream(span, value.stream, (final) => {
|
|
9263
10155
|
message.result = {
|
|
9264
10156
|
...value,
|
|
9265
10157
|
...streamedResultToChannelResult(final)
|
|
9266
10158
|
};
|
|
9267
|
-
enrichSpanOnEnd(span, message
|
|
9268
|
-
span
|
|
10159
|
+
enrichSpanOnEnd(span, message);
|
|
10160
|
+
endSpan(span, {});
|
|
9269
10161
|
clearStreamCallId();
|
|
9270
10162
|
}, (error) => {
|
|
9271
10163
|
span.setStatus({
|
|
9272
10164
|
code: _sentry_core.SPAN_STATUS_ERROR,
|
|
9273
10165
|
message: error instanceof Error ? error.message : "unknown_error"
|
|
9274
10166
|
});
|
|
9275
|
-
span
|
|
10167
|
+
endSpan(span, { error });
|
|
9276
10168
|
clearStreamCallId();
|
|
9277
10169
|
});
|
|
9278
10170
|
return value;
|
|
9279
10171
|
}
|
|
9280
10172
|
message.result = value;
|
|
9281
|
-
enrichSpanOnEnd(span, message
|
|
9282
|
-
span
|
|
10173
|
+
enrichSpanOnEnd(span, message);
|
|
10174
|
+
endSpan(span, { response: value });
|
|
9283
10175
|
clearStreamCallId();
|
|
9284
10176
|
return value;
|
|
9285
10177
|
}, failSpan);
|
|
@@ -9331,14 +10223,14 @@ function patchToolExecute(toolName, tool, tools, options) {
|
|
|
9331
10223
|
message: error instanceof Error ? error.message : "tool_error"
|
|
9332
10224
|
});
|
|
9333
10225
|
else captureToolError(span, message, error);
|
|
9334
|
-
span
|
|
10226
|
+
endSpan(span, { error });
|
|
9335
10227
|
throw error;
|
|
9336
10228
|
};
|
|
9337
10229
|
try {
|
|
9338
10230
|
return Promise.resolve(original.apply(this, [input, ...rest])).then((value) => {
|
|
9339
10231
|
message.result = { output: value };
|
|
9340
|
-
enrichSpanOnEnd(span, message
|
|
9341
|
-
span.
|
|
10232
|
+
enrichSpanOnEnd(span, message);
|
|
10233
|
+
endSpan(span, { response: message.result });
|
|
9342
10234
|
return value;
|
|
9343
10235
|
}, failSpan);
|
|
9344
10236
|
} catch (error) {
|
|
@@ -9346,6 +10238,10 @@ function patchToolExecute(toolName, tool, tools, options) {
|
|
|
9346
10238
|
}
|
|
9347
10239
|
};
|
|
9348
10240
|
}
|
|
10241
|
+
function endSpan(span, result) {
|
|
10242
|
+
runVercelAiSpanEnd(span, result);
|
|
10243
|
+
span.end();
|
|
10244
|
+
}
|
|
9349
10245
|
function buildTextMessage(type) {
|
|
9350
10246
|
return (options, telemetry) => ({
|
|
9351
10247
|
type,
|
|
@@ -9649,7 +10545,7 @@ function getSpanForLayer(data, options) {
|
|
|
9649
10545
|
if (!req) return;
|
|
9650
10546
|
if (!(0, _sentry_core.getActiveSpan)()) return;
|
|
9651
10547
|
const type = getLayerType(layer);
|
|
9652
|
-
const registeredPath = getLayerRegisteredPath(layer);
|
|
10548
|
+
const registeredPath = getLayerRegisteredPath(layer) ?? getMatchedLayerPath(layer);
|
|
9653
10549
|
if (registeredPath != null) {
|
|
9654
10550
|
pushLayerPath(req, registeredPath);
|
|
9655
10551
|
data._sentryStoredLayer = true;
|
|
@@ -9701,6 +10597,15 @@ function getSpanForLayer(data, options) {
|
|
|
9701
10597
|
}
|
|
9702
10598
|
return span;
|
|
9703
10599
|
}
|
|
10600
|
+
/**
|
|
10601
|
+
* The path of a matched layer for which no registration event recorded a path. That is the case when the events
|
|
10602
|
+
* arrive after the registration calls: Cloudflare delivers the events of calls at module scope with the first
|
|
10603
|
+
* request.
|
|
10604
|
+
*/
|
|
10605
|
+
function getMatchedLayerPath(layer) {
|
|
10606
|
+
if (layer.route) return getLayerPath([layer.route.path]);
|
|
10607
|
+
return layer.keys?.length ? void 0 : layer.path || void 0;
|
|
10608
|
+
}
|
|
9704
10609
|
function getLayerType(layer) {
|
|
9705
10610
|
if (layer.name === "router") return "router";
|
|
9706
10611
|
if (layer.name === "bound dispatch" || layer.name === "handle") return "request_handler";
|
|
@@ -10409,11 +11314,11 @@ function getErrorIntegrations() {
|
|
|
10409
11314
|
* @deprecated This is a temporary export to avoid breaking changes. It will be removed in the next major version.
|
|
10410
11315
|
*/
|
|
10411
11316
|
const attachHapiErrorHandler = attachHapiErrorHandler$1;
|
|
11317
|
+
exports.BullMQTelemetry = BullMQTelemetry;
|
|
10412
11318
|
exports.SentryMastraExporter = require_exports.SentryMastraExporter;
|
|
10413
11319
|
exports._INTERNAL_cronExpressionToMonitorConfig = cronExpressionToMonitorConfig;
|
|
10414
11320
|
exports._INTERNAL_instrumentTunnelServer = instrumentTunnelServer;
|
|
10415
11321
|
exports._INTERNAL_instrumentTunnelServers = instrumentTunnelServers;
|
|
10416
|
-
exports._INTERNAL_isReadAlikeByNodeCron3 = isReadAlikeByNodeCron3;
|
|
10417
11322
|
exports.amqplibIntegration = amqplibIntegration;
|
|
10418
11323
|
exports.anthropicAIIntegration = anthropicAIIntegration;
|
|
10419
11324
|
exports.applyHonoPatches = require_exports.applyHonoPatches;
|
|
@@ -10424,6 +11329,8 @@ exports.bindTracingChannelToSpan = bindTracingChannelToSpan;
|
|
|
10424
11329
|
exports.createFlueInstrumentation = require_exports.createFlueInstrumentation;
|
|
10425
11330
|
exports.createHonoRequestMiddleware = require_exports.createHonoRequestMiddleware;
|
|
10426
11331
|
exports.createLangChainCallbackHandler = require_exports.createLangChainCallbackHandler;
|
|
11332
|
+
exports.createSentryWinstonTransport = createSentryWinstonTransport;
|
|
11333
|
+
exports.cron = cron;
|
|
10427
11334
|
exports.cronJobIntegration = cronJobIntegration;
|
|
10428
11335
|
exports.dataloaderIntegration = dataloaderIntegration;
|
|
10429
11336
|
exports.detectOrchestrionSetup = require_exports.detectOrchestrionSetup;
|
|
@@ -10488,6 +11395,7 @@ exports.openTelemetryIntegration = require_exports.openTelemetryIntegration;
|
|
|
10488
11395
|
exports.orchestrionModuleInjected = orchestrionModuleInjected;
|
|
10489
11396
|
exports.piAiIntegration = piAiIntegration;
|
|
10490
11397
|
exports.piDurableIntegration = piDurableIntegration;
|
|
11398
|
+
exports.pinoIntegration = pinoIntegration;
|
|
10491
11399
|
exports.postgresIntegration = postgresIntegration;
|
|
10492
11400
|
exports.postgresJsIntegration = postgresJsIntegration;
|
|
10493
11401
|
exports.prismaIntegration = prismaIntegration;
|