@sentry/server-utils 10.63.0 → 10.64.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/index.js +6 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/anthropic.js +101 -0
- package/build/cjs/integrations/tracing-channel/anthropic.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi-types.js +30 -0
- package/build/cjs/integrations/tracing-channel/hapi-types.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi-utils.js +177 -0
- package/build/cjs/integrations/tracing-channel/hapi-utils.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi.js +52 -0
- package/build/cjs/integrations/tracing-channel/hapi.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js +96 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mysql.js +1 -0
- package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/openai.js +83 -0
- package/build/cjs/integrations/tracing-channel/openai.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/postgres.js +170 -0
- package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js +25 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -0
- package/build/cjs/mongoose/index.js +23 -0
- package/build/cjs/mongoose/index.js.map +1 -0
- package/build/cjs/mongoose/mongoose-dc-subscriber.js +97 -0
- package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -0
- package/build/cjs/orchestrion/bundler/vite.js +3 -3
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +17 -2
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js +43 -0
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -0
- package/build/cjs/orchestrion/config/hapi.js +26 -0
- package/build/cjs/orchestrion/config/hapi.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +35 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -0
- package/build/cjs/orchestrion/config/ioredis.js +35 -0
- package/build/cjs/orchestrion/config/ioredis.js.map +1 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js +17 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -0
- package/build/cjs/orchestrion/config/mysql.js +16 -0
- package/build/cjs/orchestrion/config/mysql.js.map +1 -0
- package/build/cjs/orchestrion/config/openai.js +40 -0
- package/build/cjs/orchestrion/config/openai.js.map +1 -0
- package/build/cjs/orchestrion/config/pg.js +51 -0
- package/build/cjs/orchestrion/config/pg.js.map +1 -0
- package/build/cjs/orchestrion/config/vercel-ai.js +44 -0
- package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -0
- package/build/cjs/orchestrion/detect.js +6 -1
- package/build/cjs/orchestrion/detect.js.map +1 -1
- package/build/cjs/orchestrion/index.js +27 -5
- package/build/cjs/orchestrion/index.js.map +1 -1
- package/build/cjs/orchestrion/runtime/register.js +10 -7
- package/build/cjs/orchestrion/runtime/register.js.map +1 -1
- package/build/cjs/redis/redis-statement-serializer.js +34 -0
- package/build/cjs/redis/redis-statement-serializer.js.map +1 -0
- package/build/cjs/tracing-channel.js +1 -1
- package/build/cjs/tracing-channel.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +11 -4
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js +256 -0
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +1 -0
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing-channel/anthropic.js +99 -0
- package/build/esm/integrations/tracing-channel/anthropic.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi-types.js +25 -0
- package/build/esm/integrations/tracing-channel/hapi-types.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi-utils.js +172 -0
- package/build/esm/integrations/tracing-channel/hapi-utils.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi.js +50 -0
- package/build/esm/integrations/tracing-channel/hapi.js.map +1 -0
- package/build/esm/integrations/tracing-channel/ioredis.js +94 -0
- package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mysql.js +2 -1
- package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/esm/integrations/tracing-channel/openai.js +81 -0
- package/build/esm/integrations/tracing-channel/openai.js.map +1 -0
- package/build/esm/integrations/tracing-channel/postgres.js +168 -0
- package/build/esm/integrations/tracing-channel/postgres.js.map +1 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js +23 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -0
- package/build/esm/mongoose/index.js +21 -0
- package/build/esm/mongoose/index.js.map +1 -0
- package/build/esm/mongoose/mongoose-dc-subscriber.js +89 -0
- package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -0
- package/build/esm/orchestrion/bundler/vite.js +1 -1
- package/build/esm/orchestrion/channels.js +17 -2
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js +40 -0
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -0
- package/build/esm/orchestrion/config/hapi.js +23 -0
- package/build/esm/orchestrion/config/hapi.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +31 -0
- package/build/esm/orchestrion/config/index.js.map +1 -0
- package/build/esm/orchestrion/config/ioredis.js +32 -0
- package/build/esm/orchestrion/config/ioredis.js.map +1 -0
- package/build/esm/orchestrion/config/lru-memoizer.js +14 -0
- package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -0
- package/build/esm/orchestrion/config/mysql.js +13 -0
- package/build/esm/orchestrion/config/mysql.js.map +1 -0
- package/build/esm/orchestrion/config/openai.js +37 -0
- package/build/esm/orchestrion/config/openai.js.map +1 -0
- package/build/esm/orchestrion/config/pg.js +48 -0
- package/build/esm/orchestrion/config/pg.js.map +1 -0
- package/build/esm/orchestrion/config/vercel-ai.js +41 -0
- package/build/esm/orchestrion/config/vercel-ai.js.map +1 -0
- package/build/esm/orchestrion/detect.js +6 -2
- package/build/esm/orchestrion/detect.js.map +1 -1
- package/build/esm/orchestrion/index.js +21 -3
- package/build/esm/orchestrion/index.js.map +1 -1
- package/build/esm/orchestrion/runtime/register.js +8 -4
- package/build/esm/orchestrion/runtime/register.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/redis/redis-statement-serializer.js +32 -0
- package/build/esm/redis/redis-statement-serializer.js.map +1 -0
- package/build/esm/tracing-channel.js +2 -2
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +14 -8
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js +254 -0
- package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +1 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/anthropic.d.ts +10 -0
- package/build/types/integrations/tracing-channel/anthropic.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi-types.d.ts +53 -0
- package/build/types/integrations/tracing-channel/hapi-types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi-utils.d.ts +25 -0
- package/build/types/integrations/tracing-channel/hapi-utils.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi.d.ts +9 -0
- package/build/types/integrations/tracing-channel/hapi.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts +17 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/openai.d.ts +10 -0
- package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/postgres.d.ts +15 -0
- package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts +13 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -0
- package/build/types/mongoose/index.d.ts +11 -0
- package/build/types/mongoose/index.d.ts.map +1 -0
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts +63 -0
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -0
- package/build/types/orchestrion/channels.d.ts +21 -1
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/anthropic-ai.d.ts +31 -0
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -0
- package/build/types/orchestrion/config/hapi.d.ts +17 -0
- package/build/types/orchestrion/config/hapi.d.ts.map +1 -0
- package/build/types/orchestrion/{config.d.ts → config/index.d.ts} +1 -12
- package/build/types/orchestrion/config/index.d.ts.map +1 -0
- package/build/types/orchestrion/config/ioredis.d.ts +7 -0
- package/build/types/orchestrion/config/ioredis.d.ts.map +1 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts +16 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -0
- package/build/types/orchestrion/config/mysql.d.ts +16 -0
- package/build/types/orchestrion/config/mysql.d.ts.map +1 -0
- package/build/types/orchestrion/config/openai.d.ts +20 -0
- package/build/types/orchestrion/config/openai.d.ts.map +1 -0
- package/build/types/orchestrion/config/pg.d.ts +33 -0
- package/build/types/orchestrion/config/pg.d.ts.map +1 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts +11 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -0
- package/build/types/orchestrion/detect.d.ts +10 -0
- package/build/types/orchestrion/detect.d.ts.map +1 -1
- package/build/types/orchestrion/index.d.ts +53 -3
- package/build/types/orchestrion/index.d.ts.map +1 -1
- package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
- package/build/types/redis/redis-statement-serializer.d.ts +6 -0
- package/build/types/redis/redis-statement-serializer.d.ts.map +1 -0
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +10 -4
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts +12 -0
- package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts.map +1 -0
- package/build/types-ts3.8/index.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing-channel/anthropic.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi-types.d.ts +65 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi-utils.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +17 -0
- package/build/types-ts3.8/integrations/tracing-channel/openai.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/postgres.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +13 -0
- package/build/types-ts3.8/mongoose/index.d.ts +11 -0
- package/build/types-ts3.8/mongoose/mongoose-dc-subscriber.d.ts +63 -0
- package/build/types-ts3.8/orchestrion/channels.d.ts +21 -1
- package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +31 -0
- package/build/types-ts3.8/orchestrion/config/hapi.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/{config.d.ts → config/index.d.ts} +1 -12
- package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +7 -0
- package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +16 -0
- package/build/types-ts3.8/orchestrion/config/mysql.d.ts +16 -0
- package/build/types-ts3.8/orchestrion/config/openai.d.ts +20 -0
- package/build/types-ts3.8/orchestrion/config/pg.d.ts +33 -0
- package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +11 -0
- package/build/types-ts3.8/orchestrion/detect.d.ts +10 -0
- package/build/types-ts3.8/orchestrion/index.d.ts +53 -3
- package/build/types-ts3.8/redis/redis-statement-serializer.d.ts +6 -0
- package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +10 -4
- package/build/types-ts3.8/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts +12 -0
- package/package.json +9 -9
- package/build/cjs/orchestrion/config.js +0 -44
- package/build/cjs/orchestrion/config.js.map +0 -1
- package/build/esm/orchestrion/config.js +0 -40
- package/build/esm/orchestrion/config.js.map +0 -1
- package/build/types/orchestrion/config.d.ts.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { debug, withActiveSpan, getActiveSpan, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
2
|
+
import { DEBUG_BUILD } from '../debug-build.js';
|
|
3
|
+
import { CHANNELS } from '../orchestrion/channels.js';
|
|
4
|
+
import { bindTracingChannelToSpan } from '../tracing-channel.js';
|
|
5
|
+
import { createSpanFromMessage, enrichSpanOnEnd, clearOperationCallId, clearOperationId } from './vercel-ai-dc-subscriber.js';
|
|
6
|
+
|
|
7
|
+
const PATCHED = /* @__PURE__ */ Symbol("SentryVercelAiModelPatched");
|
|
8
|
+
let callIdCounter = 0;
|
|
9
|
+
function nextCallId() {
|
|
10
|
+
return `v6-${++callIdCounter}`;
|
|
11
|
+
}
|
|
12
|
+
const messages = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
const operationSpans = /* @__PURE__ */ new WeakSet();
|
|
14
|
+
const callIdBySpan = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
const recordingBySpan = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
const suppressedTelemetry = /* @__PURE__ */ new WeakSet();
|
|
17
|
+
let subscribed = false;
|
|
18
|
+
function subscribeVercelAiOrchestrionChannels(tracingChannel, options = {}) {
|
|
19
|
+
if (subscribed) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
subscribed = true;
|
|
23
|
+
try {
|
|
24
|
+
bindOperation(tracingChannel, CHANNELS.VERCEL_AI_GENERATE_TEXT, buildTextMessage("generateText"), options);
|
|
25
|
+
bindOperation(tracingChannel, CHANNELS.VERCEL_AI_STREAM_TEXT, buildTextMessage("streamText"), options);
|
|
26
|
+
bindOperation(
|
|
27
|
+
tracingChannel,
|
|
28
|
+
CHANNELS.VERCEL_AI_EMBED,
|
|
29
|
+
(callOptions, telemetry) => ({
|
|
30
|
+
type: "embed",
|
|
31
|
+
event: {
|
|
32
|
+
callId: nextCallId(),
|
|
33
|
+
...modelFields(callOptions.model),
|
|
34
|
+
maxRetries: callOptions.maxRetries,
|
|
35
|
+
value: callOptions.value,
|
|
36
|
+
...recording(telemetry)
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
options
|
|
40
|
+
);
|
|
41
|
+
bindOperation(
|
|
42
|
+
tracingChannel,
|
|
43
|
+
CHANNELS.VERCEL_AI_EMBED_MANY,
|
|
44
|
+
// `embedMany` takes a `values` array (vs `embed`'s single `value`); the shared core reads it as the
|
|
45
|
+
// embeddings input, matching the OTel path's batch `ai.embedMany` span.
|
|
46
|
+
(callOptions, telemetry) => ({
|
|
47
|
+
type: "embedMany",
|
|
48
|
+
event: {
|
|
49
|
+
callId: nextCallId(),
|
|
50
|
+
...modelFields(callOptions.model),
|
|
51
|
+
maxRetries: callOptions.maxRetries,
|
|
52
|
+
values: callOptions.values,
|
|
53
|
+
...recording(telemetry)
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
options
|
|
57
|
+
);
|
|
58
|
+
bindOperation(
|
|
59
|
+
tracingChannel,
|
|
60
|
+
CHANNELS.VERCEL_AI_EXECUTE_TOOL_CALL,
|
|
61
|
+
(callOptions, telemetry) => ({
|
|
62
|
+
type: "executeTool",
|
|
63
|
+
// v6 carries the tool definitions on the executeToolCall args (a record keyed by name);
|
|
64
|
+
// the shared core reads the matching tool's `description` for the span.
|
|
65
|
+
event: {
|
|
66
|
+
callId: nextCallId(),
|
|
67
|
+
toolCall: callOptions.toolCall,
|
|
68
|
+
tools: callOptions.tools,
|
|
69
|
+
...recording(telemetry)
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
options
|
|
73
|
+
);
|
|
74
|
+
subscribeResolveLanguageModel(tracingChannel, CHANNELS.VERCEL_AI_RESOLVE_LANGUAGE_MODEL, options);
|
|
75
|
+
} catch {
|
|
76
|
+
DEBUG_BUILD && debug.log("Vercel AI orchestrion channel subscription failed.");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function bindOperation(tracingChannel, channelName, build, options) {
|
|
80
|
+
const channel = tracingChannel(channelName);
|
|
81
|
+
const buildOperationSpan = (data) => {
|
|
82
|
+
const callOptions = isRecord(data.arguments[0]) ? data.arguments[0] : {};
|
|
83
|
+
const telemetry = isRecord(callOptions.experimental_telemetry) ? callOptions.experimental_telemetry : {};
|
|
84
|
+
if (telemetry.isEnabled === false && !suppressedTelemetry.has(telemetry)) {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
const message = build(callOptions, telemetry);
|
|
88
|
+
suppressNativeTelemetry(callOptions, telemetry);
|
|
89
|
+
const span = createSpanFromMessage(message, options);
|
|
90
|
+
if (span) {
|
|
91
|
+
messages.set(data, message);
|
|
92
|
+
operationSpans.add(span);
|
|
93
|
+
const callId = asString(message.event.callId);
|
|
94
|
+
if (callId) {
|
|
95
|
+
callIdBySpan.set(span, callId);
|
|
96
|
+
}
|
|
97
|
+
recordingBySpan.set(span, recording(telemetry));
|
|
98
|
+
}
|
|
99
|
+
return span;
|
|
100
|
+
};
|
|
101
|
+
bindTracingChannelToSpan(
|
|
102
|
+
channel,
|
|
103
|
+
(data) => buildOperationSpan(data),
|
|
104
|
+
{
|
|
105
|
+
beforeSpanEnd: (span, data) => {
|
|
106
|
+
const message = messages.get(data);
|
|
107
|
+
if (!message) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!("error" in data)) {
|
|
111
|
+
message.result = message.type === "executeTool" ? { output: data.result } : data.result;
|
|
112
|
+
enrichSpanOnEnd(span, message, options);
|
|
113
|
+
}
|
|
114
|
+
if (message.type !== "streamText") {
|
|
115
|
+
clearOperationId(message);
|
|
116
|
+
}
|
|
117
|
+
messages.delete(data);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function suppressNativeTelemetry(callOptions, telemetry) {
|
|
123
|
+
if (telemetry.isEnabled !== true) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const suppressed = { ...telemetry, isEnabled: false };
|
|
127
|
+
suppressedTelemetry.add(suppressed);
|
|
128
|
+
callOptions.experimental_telemetry = suppressed;
|
|
129
|
+
}
|
|
130
|
+
function subscribeResolveLanguageModel(tracingChannel, channelName, options) {
|
|
131
|
+
tracingChannel(channelName).subscribe({
|
|
132
|
+
end(rawCtx) {
|
|
133
|
+
const ctx = rawCtx;
|
|
134
|
+
if (!isRecord(ctx.result)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const model = ctx.result;
|
|
138
|
+
if (!model[PATCHED]) {
|
|
139
|
+
model[PATCHED] = true;
|
|
140
|
+
patchModelMethod(model, "doGenerate", options);
|
|
141
|
+
patchModelMethod(model, "doStream", options);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
start() {
|
|
145
|
+
},
|
|
146
|
+
asyncStart() {
|
|
147
|
+
},
|
|
148
|
+
asyncEnd() {
|
|
149
|
+
},
|
|
150
|
+
error() {
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function resolveModelCallParent() {
|
|
155
|
+
const active = getActiveSpan();
|
|
156
|
+
return active && operationSpans.has(active) ? active : void 0;
|
|
157
|
+
}
|
|
158
|
+
function patchModelMethod(model, method, options) {
|
|
159
|
+
const original = model[method];
|
|
160
|
+
if (typeof original !== "function") {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
model[method] = function(...args) {
|
|
164
|
+
const parent = resolveModelCallParent();
|
|
165
|
+
if (!parent) {
|
|
166
|
+
return Promise.resolve(original.apply(this, args));
|
|
167
|
+
}
|
|
168
|
+
const callArgs = isRecord(args[0]) ? args[0] : {};
|
|
169
|
+
const callId = callIdBySpan.get(parent);
|
|
170
|
+
const message = {
|
|
171
|
+
type: "languageModelCall",
|
|
172
|
+
event: {
|
|
173
|
+
callId,
|
|
174
|
+
provider: model.provider,
|
|
175
|
+
modelId: model.modelId,
|
|
176
|
+
tools: callArgs.tools,
|
|
177
|
+
messages: callArgs.prompt,
|
|
178
|
+
// Inherit the enclosing operation's per-call recording flags so inputs/tools/outputs are recorded on
|
|
179
|
+
// the model-call span whenever they are on the parent `invoke_agent` span.
|
|
180
|
+
...recordingBySpan.get(parent)
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const span = withActiveSpan(parent, () => createSpanFromMessage(message, options));
|
|
184
|
+
if (!span) {
|
|
185
|
+
return Promise.resolve(original.apply(this, args));
|
|
186
|
+
}
|
|
187
|
+
const clearStreamCallId = () => {
|
|
188
|
+
if (method === "doStream" && callId) {
|
|
189
|
+
clearOperationCallId(callId);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const failSpan = (error) => {
|
|
193
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: error instanceof Error ? error.message : "unknown_error" });
|
|
194
|
+
span.end();
|
|
195
|
+
clearStreamCallId();
|
|
196
|
+
throw error;
|
|
197
|
+
};
|
|
198
|
+
try {
|
|
199
|
+
const result = Promise.resolve(original.apply(this, args));
|
|
200
|
+
return result.then((value) => {
|
|
201
|
+
message.result = value;
|
|
202
|
+
enrichSpanOnEnd(span, message, options);
|
|
203
|
+
span.end();
|
|
204
|
+
clearStreamCallId();
|
|
205
|
+
return value;
|
|
206
|
+
}, failSpan);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return failSpan(error);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function buildTextMessage(type) {
|
|
213
|
+
return (options, telemetry) => ({
|
|
214
|
+
type,
|
|
215
|
+
event: {
|
|
216
|
+
callId: nextCallId(),
|
|
217
|
+
operationId: `ai.${type}`,
|
|
218
|
+
functionId: asString(telemetry.functionId),
|
|
219
|
+
...modelFields(options.model),
|
|
220
|
+
maxRetries: options.maxRetries,
|
|
221
|
+
// Normalize to the message-array shape the shared core (and v7's channel) expects: a bare string
|
|
222
|
+
// `prompt` becomes a single user message, matching the SDK's own normalization.
|
|
223
|
+
messages: normalizePromptMessages(options),
|
|
224
|
+
...recording(telemetry)
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
function normalizePromptMessages(options) {
|
|
229
|
+
if (Array.isArray(options.messages)) {
|
|
230
|
+
return options.messages;
|
|
231
|
+
}
|
|
232
|
+
if (typeof options.prompt === "string") {
|
|
233
|
+
return [{ role: "user", content: options.prompt }];
|
|
234
|
+
}
|
|
235
|
+
return options.messages ?? options.prompt;
|
|
236
|
+
}
|
|
237
|
+
function recording(telemetry) {
|
|
238
|
+
return { recordInputs: telemetry.recordInputs, recordOutputs: telemetry.recordOutputs };
|
|
239
|
+
}
|
|
240
|
+
function modelFields(model) {
|
|
241
|
+
return { provider: modelField(model, "provider"), modelId: modelField(model, "modelId") };
|
|
242
|
+
}
|
|
243
|
+
function modelField(model, field) {
|
|
244
|
+
return isRecord(model) ? asString(model[field]) : void 0;
|
|
245
|
+
}
|
|
246
|
+
function asString(value) {
|
|
247
|
+
return typeof value === "string" ? value : void 0;
|
|
248
|
+
}
|
|
249
|
+
function isRecord(value) {
|
|
250
|
+
return typeof value === "object" && value !== null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { subscribeVercelAiOrchestrionChannels };
|
|
254
|
+
//# sourceMappingURL=vercel-ai-orchestrion-v6-subscriber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai-orchestrion-v6-subscriber.js","sources":["../../../src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { debug, getActiveSpan, SPAN_STATUS_ERROR, withActiveSpan } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { bindTracingChannelToSpan, type TracingChannelPayloadWithSpan } from '../tracing-channel';\nimport {\n clearOperationCallId,\n clearOperationId,\n createSpanFromMessage,\n enrichSpanOnEnd,\n type VercelAiChannelMessage,\n type VercelAiChannelOptions,\n type VercelAiTracingChannelFactory,\n} from './vercel-ai-dc-subscriber';\n\n/**\n * v6 channel adapter for the Vercel AI (`ai`) SDK.\n *\n * `ai` >= 7 publishes a normalized `ai:telemetry` tracing channel natively\n * (consumed by `subscribeVercelAiTracingChannel`). v6 has no such channel, so\n * orchestrion injects `orchestrion:ai:*` channels around the top-level\n * functions (see `orchestrion/config/index.ts`). The injected channels carry only the\n * wrapped call's `{ arguments, result, error }` — NOT v7's normalized `event`\n * object — so this adapter reconstructs an equivalent {@link VercelAiChannelMessage}\n * from v6's argument/result shapes and delegates to the SAME span-building core\n * (`createSpanFromMessage` / `enrichSpanOnEnd`) the v7 subscriber uses, so the\n * emitted spans are identical between v6 and v7.\n *\n * The model call (`languageModelCall` / `generate_content` span) has no\n * injectable definition in `ai`, so we instead wrap `resolveLanguageModel` (the\n * single chokepoint every model call flows through) and monkey-patch\n * `doGenerate`/`doStream` on the returned model.\n */\n\n/** Shape orchestrion's transform attaches to the tracing-channel context. */\ninterface OrchestrionContext {\n arguments: unknown[];\n result?: unknown;\n error?: unknown;\n}\n\n/** Builds the normalized message for a channel from the wrapped call's first-arg options. */\ntype MessageBuilder = (options: Record<string, unknown>, telemetry: Record<string, unknown>) => VercelAiChannelMessage;\n\n/** A resolved `ai` language model — has `doGenerate`/`doStream` and identity fields. */\ninterface ResolvedModel {\n modelId?: string;\n provider?: string;\n doGenerate?: (...args: unknown[]) => Promise<unknown>;\n doStream?: (...args: unknown[]) => Promise<unknown>;\n}\n\nconst PATCHED = Symbol('SentryVercelAiModelPatched');\n\n/** A resolved model with our patch bookkeeping (idempotency flag). */\ntype PatchableModel = ResolvedModel & { [PATCHED]?: boolean };\n\n// Per-operation correlation id. No Date/random (unavailable / non-deterministic) — a counter is enough.\nlet callIdCounter = 0;\nfunction nextCallId(): string {\n return `v6-${++callIdCounter}`;\n}\n\n// The message built on `start` for each operation, keyed by the (stable-identity) channel context, so\n// the `beforeSpanEnd` handler can enrich the span from the settled result and clear the `callId` maps.\nconst messages = new WeakMap<object, VercelAiChannelMessage>();\n// The spans we opened for top-level operations, and each one's `callId`. A model call resolves its\n// parent against this set (so it never mis-attributes to the enclosing `main`/user span) and reads the\n// parent's `callId` so its span can be named after the operation (e.g. `ai.streamText.doStream`).\nconst operationSpans = new WeakSet<Span>();\nconst callIdBySpan = new WeakMap<Span, string>();\n// The operation's per-call recording flags (`experimental_telemetry.recordInputs/recordOutputs`), keyed by\n// its span. A model call carries no telemetry of its own, so it inherits the enclosing operation's flags —\n// otherwise a per-call `recordInputs: true` would record inputs on the `invoke_agent` span but not on the\n// child `generate_content` span (whose event would fall back to the global default). v7's channel forwards\n// these flags on every event, so this keeps v6 identical.\nconst recordingBySpan = new WeakMap<Span, ReturnType<typeof recording>>();\n\n// The `experimental_telemetry` objects we swapped in to suppress `ai`'s native OTel spans (see\n// `suppressNativeTelemetry`). Our skip logic treats `isEnabled === false` as \"user disabled telemetry,\n// emit no span\"; without this set, a call whose options object we already neutralized — or a user-shared\n// telemetry object we replaced on a prior call — would be misread as user-disabled and lose its span.\nconst suppressedTelemetry = new WeakSet<object>();\n\nlet subscribed = false;\n\n/**\n * Subscribe the v6 orchestrion channel adapter. Safe to always call: inert on\n * `ai` >= 7 (those channels are never published) and when orchestrion injection\n * isn't active. Idempotent.\n *\n * `tracingChannel` is the platform-provided factory (the same one passed to\n * `subscribeVercelAiTracingChannel`); `options` pins the recording settings at\n * subscribe time so we never look the integration up per event.\n */\nexport function subscribeVercelAiOrchestrionChannels(\n tracingChannel: VercelAiTracingChannelFactory,\n options: VercelAiChannelOptions = {},\n): void {\n if (subscribed) {\n return;\n }\n subscribed = true;\n\n try {\n bindOperation(tracingChannel, CHANNELS.VERCEL_AI_GENERATE_TEXT, buildTextMessage('generateText'), options);\n bindOperation(tracingChannel, CHANNELS.VERCEL_AI_STREAM_TEXT, buildTextMessage('streamText'), options);\n bindOperation(\n tracingChannel,\n CHANNELS.VERCEL_AI_EMBED,\n (callOptions, telemetry) => ({\n type: 'embed',\n event: {\n callId: nextCallId(),\n ...modelFields(callOptions.model),\n maxRetries: callOptions.maxRetries,\n value: callOptions.value,\n ...recording(telemetry),\n },\n }),\n options,\n );\n bindOperation(\n tracingChannel,\n CHANNELS.VERCEL_AI_EMBED_MANY,\n // `embedMany` takes a `values` array (vs `embed`'s single `value`); the shared core reads it as the\n // embeddings input, matching the OTel path's batch `ai.embedMany` span.\n (callOptions, telemetry) => ({\n type: 'embedMany',\n event: {\n callId: nextCallId(),\n ...modelFields(callOptions.model),\n maxRetries: callOptions.maxRetries,\n values: callOptions.values,\n ...recording(telemetry),\n },\n }),\n options,\n );\n bindOperation(\n tracingChannel,\n CHANNELS.VERCEL_AI_EXECUTE_TOOL_CALL,\n (callOptions, telemetry) => ({\n type: 'executeTool',\n // v6 carries the tool definitions on the executeToolCall args (a record keyed by name);\n // the shared core reads the matching tool's `description` for the span.\n event: {\n callId: nextCallId(),\n toolCall: callOptions.toolCall,\n tools: callOptions.tools,\n ...recording(telemetry),\n },\n }),\n options,\n );\n subscribeResolveLanguageModel(tracingChannel, CHANNELS.VERCEL_AI_RESOLVE_LANGUAGE_MODEL, options);\n } catch {\n DEBUG_BUILD && debug.log('Vercel AI orchestrion channel subscription failed.');\n }\n}\n\n/**\n * Bind one operation channel: `getSpan` opens a span from the message reconstructed out of the wrapped\n * call's first argument; `beforeSpanEnd` enriches it from the settled result (tokens, output messages,\n * finish reasons, …) before the helper ends the span.\n *\n * An operation whose `experimental_telemetry.isEnabled` is explicitly `false` is skipped entirely (no\n * span): the orchestrion channel fires regardless of that flag, whereas v7's native `ai:telemetry`\n * channel is simply not published in that case — so we reproduce v7's \"no telemetry → no span\".\n */\nfunction bindOperation(\n tracingChannel: VercelAiTracingChannelFactory,\n channelName: string,\n build: MessageBuilder,\n options: VercelAiChannelOptions,\n): void {\n const channel = tracingChannel<OrchestrionContext>(channelName);\n\n // Build the operation span from the wrapped call's first argument and track it (so a model call can\n // resolve it as its parent). `bindTracingChannelToSpan` calls this once at channel `start` and makes\n // the returned span the active async context for the operation's duration — that active span is what\n // `resolveModelCallParent` reads. It also sets `data._sentrySpan`, so we don't here.\n const buildOperationSpan = (data: TracingChannelPayloadWithSpan<OrchestrionContext>): Span | undefined => {\n const callOptions = isRecord(data.arguments[0]) ? data.arguments[0] : {};\n const telemetry = isRecord(callOptions.experimental_telemetry) ? callOptions.experimental_telemetry : {};\n // `isEnabled === false` means the user opted out — emit no span. But `isEnabled` is also `false` on\n // the telemetry object we swap in to suppress native spans, so don't mistake our own object for a\n // user opt-out (which would drop the span on a call whose options we already neutralized).\n if (telemetry.isEnabled === false && !suppressedTelemetry.has(telemetry)) {\n return undefined;\n }\n const message = build(callOptions, telemetry);\n // Stop `ai` from emitting its own native OTel spans for this call — we build the equivalent spans\n // from the channels, so the SDK's would be duplicates. Reads above have already captured everything\n // we need off `telemetry`.\n suppressNativeTelemetry(callOptions, telemetry);\n const span = createSpanFromMessage(message, options);\n if (span) {\n messages.set(data, message);\n operationSpans.add(span);\n const callId = asString(message.event.callId);\n if (callId) {\n callIdBySpan.set(span, callId);\n }\n recordingBySpan.set(span, recording(telemetry));\n }\n return span;\n };\n\n bindTracingChannelToSpan(\n channel,\n (data: TracingChannelPayloadWithSpan<OrchestrionContext>) => buildOperationSpan(data),\n {\n beforeSpanEnd: (span, data) => {\n const message = messages.get(data);\n if (!message) {\n return;\n }\n // The helper's `error` handler already set the span status; only enrich from a successful result.\n if (!('error' in data)) {\n // v6's `executeToolCall` returns the tool result/error object directly, whereas the shared core\n // (matching v7) expects it nested under `output`; wrap it so tool-error detection works.\n message.result = message.type === 'executeTool' ? { output: data.result } : data.result;\n enrichSpanOnEnd(span, message, options);\n }\n // A `streamText` model call runs after this (synchronously-returning) operation's span has\n // already ended, so its `callId` entry must outlive the operation — it's cleared once the model\n // call settles (see `patchModelMethod`). Every other operation can clear here.\n if (message.type !== 'streamText') {\n clearOperationId(message);\n }\n messages.delete(data);\n },\n },\n );\n}\n\n/**\n * Neutralize `ai`'s native OpenTelemetry instrumentation for this call by pointing\n * `experimental_telemetry` at a copy with `isEnabled: false`. `ai`'s `getTracer` then returns its\n * internal no-op tracer, so it never creates (nor sets active) the duplicate `ai.*` spans we'd\n * otherwise have to drop.\n *\n * Only a call that explicitly enabled telemetry emits native spans — otherwise `ai` already uses its\n * no-op tracer, so there's nothing to suppress and we leave the user's options untouched. When\n * `isEnabled === true`, `telemetry` is `callOptions.experimental_telemetry` and `callOptions` is the\n * real first argument the SDK will read, so the reassignment takes effect for the wrapped call. We\n * replace rather than mutate in place, so a telemetry object the user shares across calls keeps its own\n * `isEnabled: true`; the replacement is tracked in `suppressedTelemetry` so our skip logic doesn't\n * later read it back as a user opt-out.\n */\nfunction suppressNativeTelemetry(callOptions: Record<string, unknown>, telemetry: Record<string, unknown>): void {\n if (telemetry.isEnabled !== true) {\n return;\n }\n const suppressed = { ...telemetry, isEnabled: false };\n suppressedTelemetry.add(suppressed);\n callOptions.experimental_telemetry = suppressed;\n}\n\n/**\n * `resolveLanguageModel` returns the model every call flows through. We don't span it — on `end` we\n * monkey-patch `doGenerate`/`doStream` on the returned model so each invocation produces a\n * `languageModelCall` span parented to the enclosing invoke_agent span.\n */\nfunction subscribeResolveLanguageModel(\n tracingChannel: VercelAiTracingChannelFactory,\n channelName: string,\n options: VercelAiChannelOptions,\n): void {\n tracingChannel<OrchestrionContext>(channelName).subscribe({\n end(rawCtx) {\n const ctx = rawCtx as OrchestrionContext;\n if (!isRecord(ctx.result)) {\n return;\n }\n const model = ctx.result as PatchableModel;\n // Patch the model's `doGenerate`/`doStream` once. The model call recovers its parent from the\n // active async context at call time (the operation span `bindTracingChannelToSpan` bound), which\n // propagates into the model call for `streamText` too, so there is nothing to capture on the model here.\n if (!model[PATCHED]) {\n model[PATCHED] = true;\n patchModelMethod(model, 'doGenerate', options);\n patchModelMethod(model, 'doStream', options);\n }\n },\n start() {\n /* no-op */\n },\n asyncStart() {\n /* no-op */\n },\n asyncEnd() {\n /* no-op */\n },\n error() {\n /* no-op */\n },\n });\n}\n\n/**\n * Pick the invoke_agent span a model call should hang under: the operation span that\n * `bindTracingChannelToSpan` planted as the active async context for the enclosing operation.\n *\n * Because we suppress `ai`'s native telemetry (so it never installs its own span as active), the active\n * span inside `doGenerate`/`doStream` is our operation span. The `operationSpans` gate makes this return\n * `undefined` when the active span isn't one of ours — e.g. telemetry was disabled for the call so we\n * opened no operation span and the active span is the user's enclosing span — so the model call is\n * skipped rather than mis-parented.\n *\n * This covers `generateText`/`embed` (whose model call is awaited inside the operation body) and\n * `streamText` alike — `ai` initiates the stream synchronously within the operation's bound context, so\n * the later `doStream` continuation restores the same active span even though the operation's span has\n * already ended. The per-operation binding also disambiguates concurrent calls that share one model\n * instance (a single mutable slot on the shared model could not — it would hold whichever operation\n * resolved the model last).\n */\nfunction resolveModelCallParent(): Span | undefined {\n const active = getActiveSpan();\n return active && operationSpans.has(active) ? active : undefined;\n}\n\nfunction patchModelMethod(\n model: PatchableModel,\n method: 'doGenerate' | 'doStream',\n options: VercelAiChannelOptions,\n): void {\n const original = model[method];\n if (typeof original !== 'function') {\n return;\n }\n model[method] = function (this: unknown, ...args: unknown[]): Promise<unknown> {\n const parent = resolveModelCallParent();\n // No enclosing operation span (e.g. telemetry disabled for the call) → don't open a model-call span.\n if (!parent) {\n return Promise.resolve(original.apply(this, args));\n }\n\n const callArgs = isRecord(args[0]) ? args[0] : {};\n // Carry the operation's `callId` so the shared core can name the span after it\n // (`ai.generateText.doGenerate` / `ai.streamText.doStream`).\n const callId = callIdBySpan.get(parent);\n const message: VercelAiChannelMessage = {\n type: 'languageModelCall',\n event: {\n callId,\n provider: model.provider,\n modelId: model.modelId,\n tools: callArgs.tools,\n messages: callArgs.prompt,\n // Inherit the enclosing operation's per-call recording flags so inputs/tools/outputs are recorded on\n // the model-call span whenever they are on the parent `invoke_agent` span.\n ...recordingBySpan.get(parent),\n },\n };\n const span = withActiveSpan(parent, () => createSpanFromMessage(message, options));\n // `languageModelCall` always opens a span; the guard just keeps the wrapper safe if that changes.\n if (!span) {\n return Promise.resolve(original.apply(this, args));\n }\n\n // `streamText` ends its operation span synchronously, so its `callId` entry was deliberately left in\n // place for this later model call; drop it now that we've used it.\n const clearStreamCallId = (): void => {\n if (method === 'doStream' && callId) {\n clearOperationCallId(callId);\n }\n };\n\n // Both the synchronous throw and the async rejection of the model call must end the span with an\n // error status (an `async` `doGenerate`/`doStream` that throws rejects rather than throwing here).\n const failSpan = (error: unknown): never => {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error instanceof Error ? error.message : 'unknown_error' });\n span.end();\n clearStreamCallId();\n throw error;\n };\n\n try {\n const result = Promise.resolve(original.apply(this, args));\n // `doStream` resolves to `{ stream, ... }` before the stream is consumed; we end here (start/end\n // bracket the call) to match the channel timing.\n return result.then(value => {\n message.result = value;\n enrichSpanOnEnd(span, message, options);\n span.end();\n clearStreamCallId();\n return value;\n }, failSpan);\n } catch (error) {\n return failSpan(error);\n }\n };\n}\n\nfunction buildTextMessage(type: 'generateText' | 'streamText'): MessageBuilder {\n return (options, telemetry) => ({\n type,\n event: {\n callId: nextCallId(),\n operationId: `ai.${type}`,\n functionId: asString(telemetry.functionId),\n ...modelFields(options.model),\n maxRetries: options.maxRetries,\n // Normalize to the message-array shape the shared core (and v7's channel) expects: a bare string\n // `prompt` becomes a single user message, matching the SDK's own normalization.\n messages: normalizePromptMessages(options),\n ...recording(telemetry),\n },\n });\n}\n\nfunction normalizePromptMessages(options: Record<string, unknown>): unknown {\n if (Array.isArray(options.messages)) {\n return options.messages;\n }\n if (typeof options.prompt === 'string') {\n return [{ role: 'user', content: options.prompt }];\n }\n return options.messages ?? options.prompt;\n}\n\nfunction recording(telemetry: Record<string, unknown>): { recordInputs: unknown; recordOutputs: unknown } {\n return { recordInputs: telemetry.recordInputs, recordOutputs: telemetry.recordOutputs };\n}\n\nfunction modelFields(model: unknown): { provider?: string; modelId?: string } {\n return { provider: modelField(model, 'provider'), modelId: modelField(model, 'modelId') };\n}\n\nfunction modelField(model: unknown, field: 'modelId' | 'provider'): string | undefined {\n return isRecord(model) ? asString(model[field]) : undefined;\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"names":[],"mappings":";;;;;;AAoDA,MAAM,OAAA,0BAAiB,4BAA4B,CAAA;AAMnD,IAAI,aAAA,GAAgB,CAAA;AACpB,SAAS,UAAA,GAAqB;AAC5B,EAAA,OAAO,CAAA,GAAA,EAAM,EAAE,aAAa,CAAA,CAAA;AAC9B;AAIA,MAAM,QAAA,uBAAe,OAAA,EAAwC;AAI7D,MAAM,cAAA,uBAAqB,OAAA,EAAc;AACzC,MAAM,YAAA,uBAAmB,OAAA,EAAsB;AAM/C,MAAM,eAAA,uBAAsB,OAAA,EAA4C;AAMxE,MAAM,mBAAA,uBAA0B,OAAA,EAAgB;AAEhD,IAAI,UAAA,GAAa,KAAA;AAWV,SAAS,oCAAA,CACd,cAAA,EACA,OAAA,GAAkC,EAAC,EAC7B;AACN,EAAA,IAAI,UAAA,EAAY;AACd,IAAA;AAAA,EACF;AACA,EAAA,UAAA,GAAa,IAAA;AAEb,EAAA,IAAI;AACF,IAAA,aAAA,CAAc,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A,EAAA,OAAO,OAAA,CAAQ,YAAY,OAAA,CAAQ,MAAA;AACrC;AAEA,SAAS,UAAU,SAAA,EAAuF;AACxG,EAAA,OAAO,EAAE,YAAA,EAAc,SAAA,CAAU,YAAA,EAAc,aAAA,EAAe,UAAU,aAAA,EAAc;AACxF;AAEA,SAAS,YAAY,KAAA,EAAyD;AAC5E,EAAA,OAAO,EAAE,QAAA,EAAU,UAAA,CAAW,KAAA,EAAO,UAAU,GAAG,OAAA,EAAS,UAAA,CAAW,KAAA,EAAO,SAAS,CAAA,EAAE;AAC1F;AAEA,SAAS,UAAA,CAAW,OAAgB,KAAA,EAAmD;AACrF,EAAA,OAAO,SAAS,KAAK,CAAA,GAAI,SAAS,KAAA,CAAM,KAAK,CAAC,CAAA,GAAI,MAAA;AACpD;AAEA,SAAS,SAAS,KAAA,EAAoC;AACpD,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ,MAAA;AAC7C;AAEA,SAAS,SAAS,KAAA,EAAkD;AAClE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD;;;;"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
export { mongooseIntegration } from './mongoose';
|
|
6
7
|
export { IOREDIS_DC_CHANNEL_COMMAND, IOREDIS_DC_CHANNEL_CONNECT, REDIS_DC_CHANNEL_BATCH, REDIS_DC_CHANNEL_COMMAND, REDIS_DC_CHANNEL_CONNECT, subscribeRedisDiagnosticChannels, } from './redis/redis-dc-subscriber';
|
|
7
8
|
export type { IORedisCommandData, RedisBatchData, RedisCommandData, RedisConnectData, RedisDiagnosticChannelResponseHook, RedisTracingChannelFactory, } from './redis/redis-dc-subscriber';
|
|
9
|
+
export { defaultDbStatementSerializer } from './redis/redis-statement-serializer';
|
|
8
10
|
export { bindTracingChannelToSpan } from './tracing-channel';
|
|
9
11
|
export type { SentryTracingChannel, TracingChannelLifeCycleOptions, TracingChannelBindingHandle, TracingChannelPayloadWithSpan, } from './tracing-channel';
|
|
10
12
|
export { vercelAiIntegration } from './vercel-ai';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAElB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAElB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnthropicAiOptions } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* EXPERIMENTAL — orchestrion-driven Anthropic integration. Subscribes to the `orchestrion:@anthropic-ai/sdk:*`
|
|
4
|
+
* diagnostics_channels injected into the SDK's chat (`messages`/`completions`/beta `messages`), `models`, and
|
|
5
|
+
* `messages.stream()` methods, so it requires the orchestrion runtime hook or bundler plugin.
|
|
6
|
+
*/
|
|
7
|
+
export declare const anthropicChannelIntegration: (options?: AnthropicAiOptions | undefined) => import("@sentry/core").Integration & {
|
|
8
|
+
name: "Anthropic_AI";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/anthropic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAgE,MAAM,cAAc,CAAC;AAgLrH;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;CAAkD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare const LIFECYCLE_EXT_POINTS: readonly ["onPreAuth", "onCredentials", "onPostAuth", "onPreHandler", "onPostHandler", "onPreResponse", "onRequest"];
|
|
2
|
+
export type ServerRequestExtType = (typeof LIFECYCLE_EXT_POINTS)[number];
|
|
3
|
+
export type LifecycleMethod = (request: unknown, h: unknown, err?: Error) => unknown;
|
|
4
|
+
export interface ServerRouteOptions {
|
|
5
|
+
handler?: LifecycleMethod | unknown;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface ServerRoute {
|
|
9
|
+
path: string;
|
|
10
|
+
method: string;
|
|
11
|
+
handler?: LifecycleMethod | unknown;
|
|
12
|
+
options?: ((server: unknown) => ServerRouteOptions) | ServerRouteOptions;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface ServerExtEventsObject {
|
|
16
|
+
type: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface ServerExtEventsRequestObject {
|
|
20
|
+
type: ServerRequestExtType;
|
|
21
|
+
method: LifecycleMethod;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface ServerExtOptions {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* This symbol is used to mark a Hapi route handler or server extension handler as
|
|
29
|
+
* already patched, since it's possible to use these handlers multiple times
|
|
30
|
+
* i.e. when allowing multiple versions of one plugin, or when registering a plugin
|
|
31
|
+
* multiple times on different servers.
|
|
32
|
+
*/
|
|
33
|
+
export declare const handlerPatched: unique symbol;
|
|
34
|
+
export type PatchableServerRoute = ServerRoute & {
|
|
35
|
+
[handlerPatched]?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type PatchableExtMethod = LifecycleMethod & {
|
|
38
|
+
[handlerPatched]?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export type ServerExtDirectInput = [ServerRequestExtType, LifecycleMethod, (ServerExtOptions | undefined)?];
|
|
41
|
+
export declare const HapiLayerType: {
|
|
42
|
+
readonly ROUTER: "router";
|
|
43
|
+
readonly PLUGIN: "plugin";
|
|
44
|
+
readonly EXT: "server.ext";
|
|
45
|
+
};
|
|
46
|
+
export declare const HapiLifecycleMethodNames: Set<string>;
|
|
47
|
+
export declare enum AttributeNames {
|
|
48
|
+
HAPI_TYPE = "hapi.type",
|
|
49
|
+
PLUGIN_NAME = "hapi.plugin.name",
|
|
50
|
+
EXT_TYPE = "server.ext.type"
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=hapi-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hapi-types.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/hapi-types.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,oBAAoB,sHAQhB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,KAAK,KAAK,OAAO,CAAC;AAErF,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;IACzE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,eAAe,CAAC;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,MAAuC,CAAC;AAE5E,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAC/C,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG;IACjD,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,oBAAoB,EAAE,eAAe,EAAE,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAE5G,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,eAAO,MAAM,wBAAwB,aAAwC,CAAC;AAE9E,oBAAY,cAAc;IACxB,SAAS,cAAc;IACvB,WAAW,qBAAqB;IAChC,QAAQ,oBAAoB;CAC7B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ServerRequestExtType, ServerRoute } from './hapi-types';
|
|
2
|
+
type SpanAttributes = Record<string, string | undefined>;
|
|
3
|
+
interface SpanMetadata {
|
|
4
|
+
attributes: SpanAttributes;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/** Build the span name and attributes for a Hapi route. */
|
|
8
|
+
export declare const getRouteMetadata: (route: ServerRoute, pluginName?: string) => SpanMetadata;
|
|
9
|
+
/** Build the span name and attributes for a Hapi server extension. */
|
|
10
|
+
export declare const getExtMetadata: (extPoint: ServerRequestExtType, pluginName?: string, methodName?: string) => SpanMetadata;
|
|
11
|
+
/**
|
|
12
|
+
* Wrap the route handler(s) in the live `server.route` arguments array, mutating
|
|
13
|
+
* `args[0]` in place. `args[0]` is either a single route options object or an
|
|
14
|
+
* array of them. Idempotent via the `handlerPatched` marker.
|
|
15
|
+
*/
|
|
16
|
+
export declare function wrapRouteArguments(args: unknown[], pluginName?: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Wrap the extension method(s) in the live `server.ext` arguments array,
|
|
19
|
+
* mutating `args` in place. Handles the three accepted input shapes:
|
|
20
|
+
* `(eventsArray)`, `(lifecycleEventObject)`, and `(extTypeString, method, options)`.
|
|
21
|
+
* Idempotent via the `handlerPatched` marker.
|
|
22
|
+
*/
|
|
23
|
+
export declare function wrapExtArguments(args: unknown[], pluginName?: string): void;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=hapi-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hapi-utils.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/hapi-utils.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAOV,oBAAoB,EACpB,WAAW,EAEZ,MAAM,cAAc,CAAC;AAKtB,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEzD,UAAU,YAAY;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAgDD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,GAAI,OAAO,WAAW,EAAE,aAAa,MAAM,KAAG,YAkB1E,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,cAAc,GACzB,UAAU,oBAAoB,EAC9B,aAAa,MAAM,EACnB,aAAa,MAAM,KAClB,YAuBF,CAAC;AAoFF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAS7E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAwB3E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EXPERIMENTAL — orchestrion-driven hapi integration. Subscribes to the
|
|
3
|
+
* `orchestrion:@hapi/hapi:route` / `:ext` channels injected into `@hapi/hapi`'s
|
|
4
|
+
* `lib/server.js`. Requires the orchestrion runtime hook or bundler plugin.
|
|
5
|
+
*/
|
|
6
|
+
export declare const hapiChannelIntegration: () => import("@sentry/core").Integration & {
|
|
7
|
+
name: "Hapi";
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=hapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hapi.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/hapi.ts"],"names":[],"mappings":"AAgEA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;CAA6C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Span } from '@sentry/core';
|
|
2
|
+
/** Mirrors `@opentelemetry/instrumentation-ioredis`' response hook. Not called for failed commands. */
|
|
3
|
+
export type IORedisResponseHook = (span: Span, command: string, args: Array<string | Buffer>, result: unknown) => void;
|
|
4
|
+
export interface IORedisChannelIntegrationOptions {
|
|
5
|
+
responseHook?: IORedisResponseHook;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* EXPERIMENTAL — orchestrion-driven ioredis integration. Subscribes to
|
|
9
|
+
* `orchestrion:ioredis:command` / `:connect` (injected into ioredis' `<5.11.0`
|
|
10
|
+
* `sendCommand`/`connect`) and creates db spans matching
|
|
11
|
+
* `@opentelemetry/instrumentation-ioredis`. Requires the orchestrion runtime hook
|
|
12
|
+
* or bundler plugin.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ioredisChannelIntegration: (options?: IORedisChannelIntegrationOptions | undefined) => import("@sentry/core").Integration & {
|
|
15
|
+
name: "IORedis";
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=ioredis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ioredis.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/ioredis.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,IAAI,EAAE,MAAM,cAAc,CAAC;AAwBxD,uGAAuG;AACvG,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAEvH,MAAM,WAAW,gCAAgC;IAC/C,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAoHD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB;;CAAgD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/mysql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/mysql.ts"],"names":[],"mappings":"AAyKA;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;CAA8C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OpenAiOptions } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* EXPERIMENTAL — orchestrion-driven OpenAI integration. Subscribes to the `orchestrion:openai:*`
|
|
4
|
+
* diagnostics_channels injected into `openai`'s `create` methods (chat completions, responses, embeddings,
|
|
5
|
+
* conversations), so it requires the orchestrion runtime hook or bundler plugin.
|
|
6
|
+
*/
|
|
7
|
+
export declare const openaiChannelIntegration: (options?: OpenAiOptions | undefined) => import("@sentry/core").Integration & {
|
|
8
|
+
name: "OpenAI";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/openai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,aAAa,EAA4B,MAAM,cAAc,CAAC;AA6I3F;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;CAA+C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EXPERIMENTAL: orchestrion-driven `pg` (node-postgres) integration.
|
|
3
|
+
*
|
|
4
|
+
* Subscribes to the `orchestrion:pg:query`/`:connect` and
|
|
5
|
+
* `orchestrion:pg-pool:connect` diagnostics_channels that the orchestrion code
|
|
6
|
+
* transform injects into `pg`'s `Client.prototype.query`/`connect`
|
|
7
|
+
* and `pg-pool`'s `Pool.prototype.connect`. Requires the orchestrion runtime
|
|
8
|
+
* hook or bundler plugin to be active.
|
|
9
|
+
*/
|
|
10
|
+
export declare const postgresChannelIntegration: (options?: {
|
|
11
|
+
ignoreConnectSpans?: boolean;
|
|
12
|
+
} | undefined) => import("@sentry/core").Integration & {
|
|
13
|
+
name: "Postgres";
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/postgres.ts"],"names":[],"mappings":"AAsRA;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B;yBA9M+B,OAAO;;;CA8MW,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-instrument the `ai` SDK. Supported are:
|
|
3
|
+
* - v7 via native `ai:telemetry` tracing channel
|
|
4
|
+
* - v6 via orchestrion `orchestrion:ai:*` channels
|
|
5
|
+
*/
|
|
6
|
+
export declare const vercelAiChannelIntegration: (options?: {
|
|
7
|
+
recordInputs?: boolean;
|
|
8
|
+
recordOutputs?: boolean;
|
|
9
|
+
enableTruncation?: boolean;
|
|
10
|
+
} | undefined) => import("@sentry/core").Integration & {
|
|
11
|
+
name: "VercelAI";
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/vercel-ai.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;CAAiD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-instrument the [mongoose](https://www.npmjs.com/package/mongoose) library via its native
|
|
3
|
+
* `node:diagnostics_channel` tracing channels (mongoose >= 9.7).
|
|
4
|
+
*
|
|
5
|
+
* On older mongoose versions the channels are never published to, so this integration is inert and
|
|
6
|
+
* the IITM-based patcher (gated to `< 9.7.0`) handles instrumentation instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare const mongooseIntegration: () => import("@sentry/core").Integration & {
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mongoose/index.ts"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;CAA0C,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { TracingChannel } from 'node:diagnostics_channel';
|
|
2
|
+
export declare const MONGOOSE_DC_CHANNEL_QUERY = "mongoose:query";
|
|
3
|
+
export declare const MONGOOSE_DC_CHANNEL_AGGREGATE = "mongoose:aggregate";
|
|
4
|
+
export declare const MONGOOSE_DC_CHANNEL_MODEL_SAVE = "mongoose:model:save";
|
|
5
|
+
export declare const MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY = "mongoose:model:insertMany";
|
|
6
|
+
export declare const MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE = "mongoose:model:bulkWrite";
|
|
7
|
+
export declare const MONGOOSE_DC_CHANNEL_CURSOR_NEXT = "mongoose:cursor:next";
|
|
8
|
+
/**
|
|
9
|
+
* Shape of the context object mongoose >= 9.7.0 publishes on its tracing
|
|
10
|
+
* channels (mongoose's `TracingContext`, see `types/tracing.d.ts`).
|
|
11
|
+
*
|
|
12
|
+
* Node's `tracePromise` mutates this same object with `result`/`error` once the
|
|
13
|
+
* operation settles, which `bindTracingChannelToSpan` reads in its lifecycle
|
|
14
|
+
* handlers — hence both are declared optional here.
|
|
15
|
+
*
|
|
16
|
+
* Unlike redis/ioredis, mongoose does NOT pre-sanitize the payload, so `args`
|
|
17
|
+
* carries the raw user query. We redact it before emitting `db.query.text`.
|
|
18
|
+
*/
|
|
19
|
+
export interface MongooseTracingData {
|
|
20
|
+
operation: string;
|
|
21
|
+
/** Absent for connection-level `aggregate()` calls, which have no model/collection. */
|
|
22
|
+
collection?: string;
|
|
23
|
+
database?: string;
|
|
24
|
+
serverAddress?: string;
|
|
25
|
+
serverPort?: number;
|
|
26
|
+
/** Cursor channels only: the cursor's fetch batch size and tailable flag. */
|
|
27
|
+
batchSize?: number;
|
|
28
|
+
tailable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Operation-specific arguments. `filter` (queries/cursors) and `pipeline`
|
|
31
|
+
* (aggregations) carry the query shape; `docs`/`ops` carry batch payloads.
|
|
32
|
+
*/
|
|
33
|
+
args?: {
|
|
34
|
+
filter?: unknown;
|
|
35
|
+
pipeline?: unknown;
|
|
36
|
+
docs?: unknown;
|
|
37
|
+
ops?: unknown;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
result?: unknown;
|
|
41
|
+
error?: Error;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Platform-provided factory that creates a native tracing channel for the given name. The
|
|
45
|
+
* subscriber binds the span and its lifecycle onto the channel via `bindTracingChannelToSpan`,
|
|
46
|
+
* which propagates the active span through the runtime's async context.
|
|
47
|
+
*
|
|
48
|
+
* Node passes `node:diagnostics_channel`'s `tracingChannel` directly.
|
|
49
|
+
*/
|
|
50
|
+
export type MongooseTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;
|
|
51
|
+
/**
|
|
52
|
+
* Subscribe Sentry span handlers to mongoose's diagnostics-channel events
|
|
53
|
+
* (`mongoose:query`, `:aggregate`, `:model:save`, `:model:insertMany`,
|
|
54
|
+
* `:model:bulkWrite`, `:cursor:next`), published by mongoose >= 9.7.0.
|
|
55
|
+
*
|
|
56
|
+
* On older mongoose versions the channels are never published to, so the
|
|
57
|
+
* subscribers are inert — there is no double-instrumentation against the
|
|
58
|
+
* IITM-based vendored patcher, which is gated to `< 9.7.0`.
|
|
59
|
+
*
|
|
60
|
+
* Idempotent: subsequent calls are a no-op.
|
|
61
|
+
*/
|
|
62
|
+
export declare function subscribeMongooseDiagnosticChannels(tracingChannel: MongooseTracingChannelFactory): void;
|
|
63
|
+
//# sourceMappingURL=mongoose-dc-subscriber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongoose-dc-subscriber.d.ts","sourceRoot":"","sources":["../../../src/mongoose/mongoose-dc-subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAmB/D,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAC1D,eAAO,MAAM,6BAA6B,uBAAuB,CAAC;AAClE,eAAO,MAAM,8BAA8B,wBAAwB,CAAC;AACpE,eAAO,MAAM,qCAAqC,8BAA8B,CAAC;AACjF,eAAO,MAAM,oCAAoC,6BAA6B,CAAC;AAC/E,eAAO,MAAM,+BAA+B,yBAAyB,CAAC;AAStE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IAC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