@sentry/server-utils 11.0.0-rc.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/THIRD-PARTY-LICENSES.txt +32 -32
- package/build/cjs/ai/flue/constants.js +4 -0
- package/build/cjs/ai/flue/constants.js.map +1 -1
- package/build/cjs/eve.js +10 -0
- package/build/cjs/eve.js.map +1 -1
- package/build/cjs/index.js +7 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/flue.js +40 -0
- package/build/cjs/integrations/flue.js.map +1 -0
- package/build/cjs/integrations/groq.js +21 -0
- package/build/cjs/integrations/groq.js.map +1 -0
- package/build/cjs/integrations/index.js +4 -0
- package/build/cjs/integrations/index.js.map +1 -1
- package/build/cjs/integrations/langchain.js +4 -1
- package/build/cjs/integrations/langchain.js.map +1 -1
- package/build/cjs/integrations/openai-compatible.js +94 -0
- package/build/cjs/integrations/openai-compatible.js.map +1 -0
- package/build/cjs/integrations/together-ai.js +19 -0
- package/build/cjs/integrations/together-ai.js.map +1 -0
- package/build/cjs/integrations/vercel-ai/gen-ai-recording-mode.js +13 -0
- package/build/cjs/integrations/vercel-ai/gen-ai-recording-mode.js.map +1 -0
- package/build/cjs/integrations/vercel-ai/vercel-ai-dc-subscriber.js +10 -4
- package/build/cjs/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/orchestrion/bundler/vite.js +23 -5
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +4 -0
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/channel-integration-definitions.js +3 -0
- package/build/cjs/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/cjs/orchestrion/config/flue.js +10 -0
- package/build/cjs/orchestrion/config/flue.js.map +1 -0
- package/build/cjs/orchestrion/config/groq.js +19 -0
- package/build/cjs/orchestrion/config/groq.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +6 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/openai-compatible.js +19 -0
- package/build/cjs/orchestrion/config/openai-compatible.js.map +1 -0
- package/build/cjs/orchestrion/config/together-ai.js +19 -0
- package/build/cjs/orchestrion/config/together-ai.js.map +1 -0
- package/build/cjs/tracing-channel.js +1 -0
- package/build/cjs/tracing-channel.js.map +1 -1
- package/build/esm/ai/flue/constants.js +3 -1
- package/build/esm/ai/flue/constants.js.map +1 -1
- package/build/esm/eve.js +11 -2
- package/build/esm/eve.js.map +1 -1
- package/build/esm/index.js +4 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/flue.js +38 -0
- package/build/esm/integrations/flue.js.map +1 -0
- package/build/esm/integrations/groq.js +18 -0
- package/build/esm/integrations/groq.js.map +1 -0
- package/build/esm/integrations/index.js +4 -0
- package/build/esm/integrations/index.js.map +1 -1
- package/build/esm/integrations/langchain.js +4 -1
- package/build/esm/integrations/langchain.js.map +1 -1
- package/build/esm/integrations/openai-compatible.js +79 -0
- package/build/esm/integrations/openai-compatible.js.map +1 -0
- package/build/esm/integrations/openai.js +1 -1
- package/build/esm/integrations/together-ai.js +17 -0
- package/build/esm/integrations/together-ai.js.map +1 -0
- package/build/esm/integrations/vercel-ai/gen-ai-recording-mode.js +10 -0
- package/build/esm/integrations/vercel-ai/gen-ai-recording-mode.js.map +1 -0
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +10 -4
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/orchestrion/bundler/vite.js +23 -5
- package/build/esm/orchestrion/bundler/vite.js.map +1 -1
- package/build/esm/orchestrion/channels.js +4 -0
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/channel-integration-definitions.js +3 -0
- package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/esm/orchestrion/config/flue.js +8 -0
- package/build/esm/orchestrion/config/flue.js.map +1 -0
- package/build/esm/orchestrion/config/groq.js +15 -0
- package/build/esm/orchestrion/config/groq.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +6 -0
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/openai-compatible.js +17 -0
- package/build/esm/orchestrion/config/openai-compatible.js.map +1 -0
- package/build/esm/orchestrion/config/together-ai.js +15 -0
- package/build/esm/orchestrion/config/together-ai.js.map +1 -0
- package/build/esm/package.json +1 -1
- package/build/esm/tracing-channel.js +1 -0
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/types/ai/flue/constants.d.ts +2 -0
- package/build/types/ai/flue/constants.d.ts.map +1 -1
- package/build/types/eve.d.ts +6 -0
- package/build/types/eve.d.ts.map +1 -1
- package/build/types/index.d.ts +4 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/flue.d.ts +4 -0
- package/build/types/integrations/flue.d.ts.map +1 -0
- package/build/types/integrations/groq.d.ts +10 -0
- package/build/types/integrations/groq.d.ts.map +1 -0
- package/build/types/integrations/index.d.ts.map +1 -1
- package/build/types/integrations/langchain.d.ts.map +1 -1
- package/build/types/integrations/openai-compatible.d.ts +32 -0
- package/build/types/integrations/openai-compatible.d.ts.map +1 -0
- package/build/types/integrations/together-ai.d.ts +9 -0
- package/build/types/integrations/together-ai.d.ts.map +1 -0
- package/build/types/integrations/vercel-ai/gen-ai-recording-mode.d.ts +15 -0
- package/build/types/integrations/vercel-ai/gen-ai-recording-mode.d.ts.map +1 -0
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +4 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts +9 -0
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -1
- package/build/types/orchestrion/config/flue.d.ts +9 -0
- package/build/types/orchestrion/config/flue.d.ts.map +1 -0
- package/build/types/orchestrion/config/groq.d.ts +8 -0
- package/build/types/orchestrion/config/groq.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/mongodb.d.ts +2 -2
- package/build/types/orchestrion/config/openai-compatible.d.ts +17 -0
- package/build/types/orchestrion/config/openai-compatible.d.ts.map +1 -0
- package/build/types/orchestrion/config/pg.d.ts +1 -1
- package/build/types/orchestrion/config/together-ai.d.ts +8 -0
- package/build/types/orchestrion/config/together-ai.d.ts.map +1 -0
- package/build/types/tracing-channel.d.ts +3 -1
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing-channel.js","sources":["../../src/tracing-channel.ts"],"sourcesContent":["import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';\nimport {\n debug,\n captureException,\n isObjectLike,\n SPAN_STATUS_ERROR,\n getAsyncContextStrategy,\n getMainCarrier,\n getActiveSpan,\n spanIsIgnored,\n getRootSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { ERROR_TYPE } from '@sentry/conventions/attributes';\n\nexport type TracingChannelPayloadWithSpan<TData extends object> = TData & {\n /**\n * The current active span for the traced call.\n */\n _sentrySpan?: Span;\n\n /**\n * The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.\n */\n _sentryCallerStore?: unknown;\n};\n\n/*\n * A type patch so that we don't have to handle all subscription types.\n */\nexport interface SentryTracingChannel<TData extends object = object> extends Omit<\n TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>,\n 'subscribe' | 'unsubscribe'\n> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n}\n\nexport interface TracingChannelLifeCycleOptions<TData extends object = object> {\n /**\n * Invoked with the span and the channel context object once the traced operation completes\n * Use it to enrich the span from the result/error (branch on `'error' in data` / `'result' in data`) or to run cleanup.\n */\n beforeSpanEnd?: (span: Span, data: TracingChannelPayloadWithSpan<TData>) => void;\n\n /**\n * Whether a thrown error is captured as a Sentry event. The span is always marked with error status regardless. Defaults to `false`.\n * You can alternatively pass a function that sets the ExclusiveEventHintOrCaptureContext on the captured error.\n * Set `true` for instrumentations that own the error boundary, (e.g: route handlers)\n * For database drivers, it is not recommended to set this at all.\n */\n captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);\n\n /**\n * Take ownership of *when* the span ends: return `true` and the helper won't end it on\n * `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that\n * completes via its own `'end'`/`'error'` events.\n *\n * Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span\n * ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`\n * lets the helper end the span as usual.\n */\n deferSpanEnd?: (args: {\n span: Span;\n data: TracingChannelPayloadWithSpan<TData>;\n /** Ends the span: `end()` on success, `end(error)` on failure. Idempotent. */\n end: (error?: unknown) => void;\n }) => boolean;\n\n /**\n * Apply span/scope binding only if there is a parent span, similar to returning `undefined` in the `getSpan` callback.\n * If you need to perform some conditional checking on the parent span before deciding, do it in the `getSpan` callback.\n */\n requiresParentSpan?: boolean;\n}\n\n/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */\nexport interface TracingChannelBindingHandle<TData extends object = object> {\n /**\n * The tracing channel with the span bound into async context.\n */\n channel: SentryTracingChannel<TData>;\n\n /**\n * Tears down the binding: unsubscribes lifecycle handlers, when present, and unbinds the start store.\n * Idempotent, and a no-op when no async context binding was available.\n */\n unbind: () => void;\n}\n\nconst NOOP = (): void => {};\n\n/** Runs a span-building callback so a throw inside it can never break the user's traced call. */\nexport function safeChannelCallback<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[instrumentation] error handling channel event', error);\n return undefined;\n }\n}\n\n/**\n * Bind a span and its lifecycle to a tracing channel so the span becomes the active async context\n * for the traced operation and is ended when the operation completes.\n *\n * `getSpan` may return `undefined` to opt a payload out entirely: nothing is bound, no span is\n * tracked, and the active context is left untouched. Use it for events that ride the same channel\n * but should reuse the enclosing span instead of opening (and ending) their own — e.g. an agent\n * loop's per-step events, where ending a freshly opened span would close the parent prematurely.\n */\nexport function bindTracingChannelToSpan<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: TracingChannelLifeCycleOptions<TData>,\n): TracingChannelBindingHandle<TData> {\n const handle = bindSpanToChannelStore(channel, getSpan, opts);\n\n const beforeSpanEnd = opts?.beforeSpanEnd;\n const deferSpanEnd = opts?.deferSpanEnd;\n const getErrorHint = (e: unknown): ExclusiveEventHintOrCaptureContext => {\n if (typeof opts?.captureError === 'function') {\n return opts.captureError(e);\n }\n\n return {\n mechanism: {\n type: 'auto.diagnostic_channels.bind_span',\n handled: false,\n },\n };\n };\n\n // Apply Sentry error status + attributes (and capture, if configured) to a span. Shared by the\n // channel `error` lifecycle and the deferred `end` util so the two can't drift.\n const annotateSpanError = (span: Span, error: unknown): void => {\n if (opts?.captureError) {\n captureException(error, getErrorHint(error));\n }\n\n const { message, attributes } = getErrorInfo(error);\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n span.setAttributes(attributes);\n };\n\n // Creates an end fn for deferred handlers to use, ensures consistent span end behavior\n const makeDeferredEnd = (span: Span, data: TracingChannelPayloadWithSpan<TData>) => {\n let ended = false;\n\n return (error?: unknown): void => {\n if (ended) {\n return;\n }\n\n ended = true;\n if (error !== undefined) {\n annotateSpanError(span, error);\n }\n\n endBoundSpan(data, beforeSpanEnd);\n };\n };\n\n const subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>> = {\n start: NOOP,\n asyncStart: NOOP,\n end(data) {\n // The operation settled synchronously (returned or threw)\n // Presence checks because caller can return `undefined` result or throw a falsy value.\n if ('error' in data || 'result' in data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n }\n },\n error(data) {\n // No span was bound for this payload (`getSpan` returned undefined), so there is nothing to\n // annotate and no instrumentation that owns capturing this error.\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n\n annotateSpanError(span, data.error);\n },\n asyncEnd(data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n },\n };\n\n handle.channel.subscribe(subscribers);\n\n return {\n channel: handle.channel,\n unbind: () => {\n handle.channel.unsubscribe(subscribers);\n handle.unbind();\n },\n };\n}\n\n/**\n * Bind a span into the channel's async context so it becomes active for the traced operation,\n * without managing its lifecycle. The primitive behind {@link bindTracingChannelToSpan}, which\n * layers span-ending and error handling on top.\n *\n * `getSpan` may return `undefined` to leave the active context untouched for that payload.\n */\nexport function bindSpanToChannelStore<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: Pick<TracingChannelLifeCycleOptions, 'requiresParentSpan'>,\n): TracingChannelBindingHandle<TData> {\n // Grabs the tracing channel binding defined by the AsyncContext strategy implementation\n const binding = getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n\n // If no binding, then either the implementer doesn't support tracing channels or there is no active strategy\n // Failure mode here means we would still access the channel and potentially subscribe to it, but parenting will be off.\n if (!binding) {\n DEBUG_BUILD && debug.log('[TracingChannel] Could not access async context binding.');\n\n return {\n channel,\n unbind: NOOP,\n };\n }\n\n // Grab the ALS instance, we don't really care what is in it as long as the AsyncContext strategy can use its value to figure out parenting.\n const asyncLocalStorage = binding.asyncLocalStorage as AsyncLocalStorage<TData>;\n\n // bindStore activates the ALS for the traced call; any getStore() inside it returns the value bound for that context.\n // 1. Produce: Binds the span to the active context via withActiveSpan(span), and returns the store for the active context.\n // 2. Bind: the courier hands that opaque value to channel.start.bindStore(asyncLocalStorage, producer), which runs the traced op inside asyncLocalStorage.run(value, …); it never inspects the value.\n // 3. Read: inside the op, Sentry's scope machinery calls getScopes() → asyncStorage.getStore() on that same ALS, so getCurrentScope/getIsolationScope/getActiveSpan resolve to the scope carrying our span.\n // 4. Nest: any child span started in the traced op parents to that active span.\n channel.start.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n // Stash the caller's store before we swap in the span store, so `asyncStart` can restore it for\n // callback-style channels (see `_sentryCallerStore`).\n data._sentryCallerStore = asyncLocalStorage.getStore();\n\n const shouldGetSpan = !opts?.requiresParentSpan || getActiveSpan();\n const span = shouldGetSpan ? getSpan(data) : undefined;\n if (!span) {\n // Leave the active context untouched so nested operations keep parenting to the enclosing span.\n return data._sentryCallerStore as TData;\n }\n data._sentrySpan = span;\n\n return getStoreWithActiveSpan(asyncLocalStorage, span) as TData;\n });\n\n // Restore the caller's context for the async continuation. Only callback-style channels `runStores`\n // `asyncStart` (so the callback runs inside this store). promise channels `publish` it, leaving this\n // inert, their continuation already inherits the caller's context natively.\n channel.asyncStart.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n return data._sentryCallerStore as TData;\n });\n\n return {\n channel,\n unbind: () => {\n // Removes the stores\n channel.start.unbindStore(asyncLocalStorage);\n channel.asyncStart.unbindStore(asyncLocalStorage);\n },\n };\n}\n\nfunction endBoundSpan<TData extends object>(\n data: TracingChannelPayloadWithSpan<TData>,\n beforeSpanEnd: TracingChannelLifeCycleOptions<TData>['beforeSpanEnd'],\n): void {\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n beforeSpanEnd?.(span, data);\n span.end();\n}\n\ntype ErrorInfo = {\n message: string | undefined;\n attributes: Record<string, string>;\n};\n\n/**\n * Best-effort message and attribute extraction for thrown/rejected values.\n */\nfunction getErrorInfo(error: unknown): ErrorInfo {\n const errorIsObject = isObjectLike(error);\n const raw = errorIsObject ? ('message' in error ? error.message : undefined) : error;\n\n // Leave the status message unset if not set (e.g. an `AggregateError` from\n // ECONNREFUSED, whose `.message` is empty). Otherwise cast to string.\n const message = raw ? String(raw) : undefined;\n const type = errorIsObject && 'name' in error ? String(error.name) : 'unknown';\n\n return {\n message,\n attributes: {\n [ERROR_TYPE]: type,\n },\n };\n}\n\nfunction getStoreWithActiveSpan(asyncLocalStorage: AsyncLocalStorage<unknown>, span: Span): unknown {\n // Do not make an ignored *child* the active span: no span is emitted for it, so its children and\n // outgoing requests must propagate from the nearest emitted parent instead. An ignored *root* is\n // still activated so its whole subtree is dropped with it. Mirrors core `startSpan` and the OTel\n // context manager (`spanIsIgnored(span) && getRootSpan(span) !== span`).\n if (spanIsIgnored(span) && getRootSpan(span) !== span) {\n return asyncLocalStorage.getStore();\n }\n\n return withActiveSpan(span, () => {\n return asyncLocalStorage.getStore();\n });\n}\n"],"names":["DEBUG_BUILD","debug","captureException","SPAN_STATUS_ERROR","getAsyncContextStrategy","getMainCarrier","getActiveSpan","isObjectLike","ERROR_TYPE","spanIsIgnored","getRootSpan","withActiveSpan"],"mappings":";;;;;;AA6FA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,IAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY;AAAC,CAAA;AAGnB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAuB,CAAA,CAAA,CAAA,CAA4B;AACjE,CAAA,CAAA,CAAA,C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A,CAAAA,EAAc,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAKC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAI,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AACrD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AAAA,CAAA,CACpC;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAOC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAe,CAAA,CAAA,CAAA,GAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AAChC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AAAA,CAAA,CACpC,CAAC,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"tracing-channel.js","sources":["../../src/tracing-channel.ts"],"sourcesContent":["import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';\nimport {\n debug,\n captureException,\n isObjectLike,\n SPAN_STATUS_ERROR,\n getAsyncContextStrategy,\n getMainCarrier,\n getActiveSpan,\n spanIsIgnored,\n getRootSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { ERROR_TYPE } from '@sentry/conventions/attributes';\n\nexport type TracingChannelPayloadWithSpan<TData extends object> = TData & {\n /**\n * The current active span for the traced call.\n */\n _sentrySpan?: Span;\n\n /**\n * The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.\n */\n _sentryCallerStore?: unknown;\n\n /** Set by Node's tracing channel when the traced operation failed. */\n error?: unknown;\n};\n\n/*\n * A type patch so that we don't have to handle all subscription types.\n */\nexport interface SentryTracingChannel<TData extends object = object> extends Omit<\n TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>,\n 'subscribe' | 'unsubscribe'\n> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n}\n\nexport interface TracingChannelLifeCycleOptions<TData extends object = object> {\n /**\n * Invoked with the span and the channel context object once the traced operation completes\n * Use it to enrich the span from the result/error (branch on `'error' in data` / `'result' in data`) or to run cleanup.\n */\n beforeSpanEnd?: (span: Span, data: TracingChannelPayloadWithSpan<TData>) => void;\n\n /**\n * Whether a thrown error is captured as a Sentry event. The span is always marked with error status regardless. Defaults to `false`.\n * You can alternatively pass a function that sets the ExclusiveEventHintOrCaptureContext on the captured error.\n * Set `true` for instrumentations that own the error boundary, (e.g: route handlers)\n * For database drivers, it is not recommended to set this at all.\n */\n captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);\n\n /**\n * Take ownership of *when* the span ends: return `true` and the helper won't end it on\n * `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that\n * completes via its own `'end'`/`'error'` events.\n *\n * Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span\n * ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`\n * lets the helper end the span as usual.\n */\n deferSpanEnd?: (args: {\n span: Span;\n data: TracingChannelPayloadWithSpan<TData>;\n /** Ends the span: `end()` on success, `end(error)` on failure (which marks `data` as errored). Idempotent. */\n end: (error?: unknown) => void;\n }) => boolean;\n\n /**\n * Apply span/scope binding only if there is a parent span, similar to returning `undefined` in the `getSpan` callback.\n * If you need to perform some conditional checking on the parent span before deciding, do it in the `getSpan` callback.\n */\n requiresParentSpan?: boolean;\n}\n\n/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */\nexport interface TracingChannelBindingHandle<TData extends object = object> {\n /**\n * The tracing channel with the span bound into async context.\n */\n channel: SentryTracingChannel<TData>;\n\n /**\n * Tears down the binding: unsubscribes lifecycle handlers, when present, and unbinds the start store.\n * Idempotent, and a no-op when no async context binding was available.\n */\n unbind: () => void;\n}\n\nconst NOOP = (): void => {};\n\n/** Runs a span-building callback so a throw inside it can never break the user's traced call. */\nexport function safeChannelCallback<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[instrumentation] error handling channel event', error);\n return undefined;\n }\n}\n\n/**\n * Bind a span and its lifecycle to a tracing channel so the span becomes the active async context\n * for the traced operation and is ended when the operation completes.\n *\n * `getSpan` may return `undefined` to opt a payload out entirely: nothing is bound, no span is\n * tracked, and the active context is left untouched. Use it for events that ride the same channel\n * but should reuse the enclosing span instead of opening (and ending) their own — e.g. an agent\n * loop's per-step events, where ending a freshly opened span would close the parent prematurely.\n */\nexport function bindTracingChannelToSpan<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: TracingChannelLifeCycleOptions<TData>,\n): TracingChannelBindingHandle<TData> {\n const handle = bindSpanToChannelStore(channel, getSpan, opts);\n\n const beforeSpanEnd = opts?.beforeSpanEnd;\n const deferSpanEnd = opts?.deferSpanEnd;\n const getErrorHint = (e: unknown): ExclusiveEventHintOrCaptureContext => {\n if (typeof opts?.captureError === 'function') {\n return opts.captureError(e);\n }\n\n return {\n mechanism: {\n type: 'auto.diagnostic_channels.bind_span',\n handled: false,\n },\n };\n };\n\n // Apply Sentry error status + attributes (and capture, if configured) to a span. Shared by the\n // channel `error` lifecycle and the deferred `end` util so the two can't drift.\n const annotateSpanError = (span: Span, error: unknown): void => {\n if (opts?.captureError) {\n captureException(error, getErrorHint(error));\n }\n\n const { message, attributes } = getErrorInfo(error);\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n span.setAttributes(attributes);\n };\n\n // Creates an end fn for deferred handlers to use, ensures consistent span end behavior\n const makeDeferredEnd = (span: Span, data: TracingChannelPayloadWithSpan<TData>) => {\n let ended = false;\n\n return (error?: unknown): void => {\n if (ended) {\n return;\n }\n\n ended = true;\n if (error !== undefined) {\n annotateSpanError(span, error);\n // Without this the payload still looks successful, so `beforeSpanEnd` enriches the span from\n // a `result` the operation never produced.\n data.error = error;\n }\n\n endBoundSpan(data, beforeSpanEnd);\n };\n };\n\n const subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>> = {\n start: NOOP,\n asyncStart: NOOP,\n end(data) {\n // The operation settled synchronously (returned or threw)\n // Presence checks because caller can return `undefined` result or throw a falsy value.\n if ('error' in data || 'result' in data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n }\n },\n error(data) {\n // No span was bound for this payload (`getSpan` returned undefined), so there is nothing to\n // annotate and no instrumentation that owns capturing this error.\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n\n annotateSpanError(span, data.error);\n },\n asyncEnd(data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n },\n };\n\n handle.channel.subscribe(subscribers);\n\n return {\n channel: handle.channel,\n unbind: () => {\n handle.channel.unsubscribe(subscribers);\n handle.unbind();\n },\n };\n}\n\n/**\n * Bind a span into the channel's async context so it becomes active for the traced operation,\n * without managing its lifecycle. The primitive behind {@link bindTracingChannelToSpan}, which\n * layers span-ending and error handling on top.\n *\n * `getSpan` may return `undefined` to leave the active context untouched for that payload.\n */\nexport function bindSpanToChannelStore<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: Pick<TracingChannelLifeCycleOptions, 'requiresParentSpan'>,\n): TracingChannelBindingHandle<TData> {\n // Grabs the tracing channel binding defined by the AsyncContext strategy implementation\n const binding = getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n\n // If no binding, then either the implementer doesn't support tracing channels or there is no active strategy\n // Failure mode here means we would still access the channel and potentially subscribe to it, but parenting will be off.\n if (!binding) {\n DEBUG_BUILD && debug.log('[TracingChannel] Could not access async context binding.');\n\n return {\n channel,\n unbind: NOOP,\n };\n }\n\n // Grab the ALS instance, we don't really care what is in it as long as the AsyncContext strategy can use its value to figure out parenting.\n const asyncLocalStorage = binding.asyncLocalStorage as AsyncLocalStorage<TData>;\n\n // bindStore activates the ALS for the traced call; any getStore() inside it returns the value bound for that context.\n // 1. Produce: Binds the span to the active context via withActiveSpan(span), and returns the store for the active context.\n // 2. Bind: the courier hands that opaque value to channel.start.bindStore(asyncLocalStorage, producer), which runs the traced op inside asyncLocalStorage.run(value, …); it never inspects the value.\n // 3. Read: inside the op, Sentry's scope machinery calls getScopes() → asyncStorage.getStore() on that same ALS, so getCurrentScope/getIsolationScope/getActiveSpan resolve to the scope carrying our span.\n // 4. Nest: any child span started in the traced op parents to that active span.\n channel.start.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n // Stash the caller's store before we swap in the span store, so `asyncStart` can restore it for\n // callback-style channels (see `_sentryCallerStore`).\n data._sentryCallerStore = asyncLocalStorage.getStore();\n\n const shouldGetSpan = !opts?.requiresParentSpan || getActiveSpan();\n const span = shouldGetSpan ? getSpan(data) : undefined;\n if (!span) {\n // Leave the active context untouched so nested operations keep parenting to the enclosing span.\n return data._sentryCallerStore as TData;\n }\n data._sentrySpan = span;\n\n return getStoreWithActiveSpan(asyncLocalStorage, span) as TData;\n });\n\n // Restore the caller's context for the async continuation. Only callback-style channels `runStores`\n // `asyncStart` (so the callback runs inside this store). promise channels `publish` it, leaving this\n // inert, their continuation already inherits the caller's context natively.\n channel.asyncStart.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n return data._sentryCallerStore as TData;\n });\n\n return {\n channel,\n unbind: () => {\n // Removes the stores\n channel.start.unbindStore(asyncLocalStorage);\n channel.asyncStart.unbindStore(asyncLocalStorage);\n },\n };\n}\n\nfunction endBoundSpan<TData extends object>(\n data: TracingChannelPayloadWithSpan<TData>,\n beforeSpanEnd: TracingChannelLifeCycleOptions<TData>['beforeSpanEnd'],\n): void {\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n beforeSpanEnd?.(span, data);\n span.end();\n}\n\ntype ErrorInfo = {\n message: string | undefined;\n attributes: Record<string, string>;\n};\n\n/**\n * Best-effort message and attribute extraction for thrown/rejected values.\n */\nfunction getErrorInfo(error: unknown): ErrorInfo {\n const errorIsObject = isObjectLike(error);\n const raw = errorIsObject ? ('message' in error ? error.message : undefined) : error;\n\n // Leave the status message unset if not set (e.g. an `AggregateError` from\n // ECONNREFUSED, whose `.message` is empty). Otherwise cast to string.\n const message = raw ? String(raw) : undefined;\n const type = errorIsObject && 'name' in error ? String(error.name) : 'unknown';\n\n return {\n message,\n attributes: {\n [ERROR_TYPE]: type,\n },\n };\n}\n\nfunction getStoreWithActiveSpan(asyncLocalStorage: AsyncLocalStorage<unknown>, span: Span): unknown {\n // Do not make an ignored *child* the active span: no span is emitted for it, so its children and\n // outgoing requests must propagate from the nearest emitted parent instead. An ignored *root* is\n // still activated so its whole subtree is dropped with it. Mirrors core `startSpan` and the OTel\n // context manager (`spanIsIgnored(span) && getRootSpan(span) !== span`).\n if (spanIsIgnored(span) && getRootSpan(span) !== span) {\n return asyncLocalStorage.getStore();\n }\n\n return withActiveSpan(span, () => {\n return asyncLocalStorage.getStore();\n });\n}\n"],"names":["DEBUG_BUILD","debug","captureException","SPAN_STATUS_ERROR","getAsyncContextStrategy","getMainCarrier","getActiveSpan","isObjectLike","ERROR_TYPE","spanIsIgnored","getRootSpan","withActiveSpan"],"mappings":";;;;;;AAgGA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,IAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY;AAAC,CAAA;AAGnB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAuB,CAAA,CAAA,CAAA,CAA4B;AACjE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI;AACF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,EAAA,CAAA,CAAG;AAAA,CAAA,CACZ,SAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO;AACd,CAAA,CAAA,CAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,IAAeC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAM,IAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AAAA,CAAA,CACpC;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAOC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAe,CAAA,CAAA,CAAA,GAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AAChC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AAAA,CAAA,CACpC,CAAC,CAAA;AACH;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const FLUE_INTEGRATION_NAME = "Flue";
|
|
2
|
+
const FLUE_MODULE_NAME = "@flue/runtime";
|
|
1
3
|
const FLUE_ORIGIN = "auto.ai.flue";
|
|
2
4
|
const FLUE_INSTRUMENTATION_KEY = /* @__PURE__ */ Symbol.for("sentry.flue.instrumentation");
|
|
3
5
|
const FLUE_OPERATION = {
|
|
@@ -7,5 +9,5 @@ const FLUE_OPERATION = {
|
|
|
7
9
|
};
|
|
8
10
|
const MAX_TRACKED_FLUE_SPANS = 1e3;
|
|
9
11
|
|
|
10
|
-
export { FLUE_INSTRUMENTATION_KEY, FLUE_OPERATION, FLUE_ORIGIN, MAX_TRACKED_FLUE_SPANS };
|
|
12
|
+
export { FLUE_INSTRUMENTATION_KEY, FLUE_INTEGRATION_NAME, FLUE_MODULE_NAME, FLUE_OPERATION, FLUE_ORIGIN, MAX_TRACKED_FLUE_SPANS };
|
|
11
13
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/ai/flue/constants.ts"],"sourcesContent":["export const FLUE_ORIGIN = 'auto.ai.flue';\n\n/**\n * Identifies our registration in Flue's keyed instrumentation registry.\n *\n * `key` is optional, but without one there is no protection against registering twice: Flue\n * deduplicates on object identity, and `createFlueInstrumentation()` returns a new object each\n * call, so a second `instrument()` would silently add a second observer and interceptor and\n * duplicate every span.\n *\n * With a key, Flue handles the repeat itself — it throws `InstrumentationAlreadyInstalledError` in\n * production, and in dev disposes the previous registration and swaps in the new one, which is what\n * stops `vite dev` from stacking observers across reloads.\n */\nexport const FLUE_INSTRUMENTATION_KEY = Symbol.for('sentry.flue.instrumentation');\n\n/**\n * The Flue execution operations we act on.\n *\n * Only `AGENT` is spanned from the interceptor, and only at the outermost depth: Flue drives one\n * LLM call through many `MODEL` operations (one per stream read), and its `AGENT` operation nests\n * inside itself once per submission. The turn span is driven from the observation stream instead,\n * where `turn_start`/`turn` are exactly one-to-one with a model call. `MODEL` and `TOOL` are\n * intercepted only to make the already-open span active for the duration of the operation.\n */\nexport const FLUE_OPERATION = {\n AGENT: 'agent',\n MODEL: 'model',\n TOOL: 'tool',\n} as const;\n\n/**\n * Cap on tracked turn and tool spans, matching `MAX_TRACKED_MASTRA_SPANS`. Both maps are keyed off\n * an id that is only removed when the matching end observation arrives; a stream that is abandoned\n * mid-turn never emits one, so without a cap the map grows for the lifetime of the process.\n */\nexport const MAX_TRACKED_FLUE_SPANS = 1000;\n"],"names":[],"mappings":"AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,WAAA,CAAA,CAAA,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAcpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,wBAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAA;AAWzE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,cAAA,CAAA,CAAA,CAAiB;AAAA,CAAA,CAC5B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACP,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACP,IAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA;AACR,CAAA;AAOO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,sBAAA,CAAA,CAAA,CAAyB,CAAA,CAAA,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/ai/flue/constants.ts"],"sourcesContent":["export const FLUE_INTEGRATION_NAME = 'Flue' as const;\n\nexport const FLUE_MODULE_NAME = '@flue/runtime';\n\nexport const FLUE_ORIGIN = 'auto.ai.flue';\n\n/**\n * Identifies our registration in Flue's keyed instrumentation registry.\n *\n * `key` is optional, but without one there is no protection against registering twice: Flue\n * deduplicates on object identity, and `createFlueInstrumentation()` returns a new object each\n * call, so a second `instrument()` would silently add a second observer and interceptor and\n * duplicate every span.\n *\n * With a key, Flue handles the repeat itself — it throws `InstrumentationAlreadyInstalledError` in\n * production, and in dev disposes the previous registration and swaps in the new one, which is what\n * stops `vite dev` from stacking observers across reloads.\n */\nexport const FLUE_INSTRUMENTATION_KEY = Symbol.for('sentry.flue.instrumentation');\n\n/**\n * The Flue execution operations we act on.\n *\n * Only `AGENT` is spanned from the interceptor, and only at the outermost depth: Flue drives one\n * LLM call through many `MODEL` operations (one per stream read), and its `AGENT` operation nests\n * inside itself once per submission. The turn span is driven from the observation stream instead,\n * where `turn_start`/`turn` are exactly one-to-one with a model call. `MODEL` and `TOOL` are\n * intercepted only to make the already-open span active for the duration of the operation.\n */\nexport const FLUE_OPERATION = {\n AGENT: 'agent',\n MODEL: 'model',\n TOOL: 'tool',\n} as const;\n\n/**\n * Cap on tracked turn and tool spans, matching `MAX_TRACKED_MASTRA_SPANS`. Both maps are keyed off\n * an id that is only removed when the matching end observation arrives; a stream that is abandoned\n * mid-turn never emits one, so without a cap the map grows for the lifetime of the process.\n */\nexport const MAX_TRACKED_FLUE_SPANS = 1000;\n"],"names":[],"mappings":"AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,qBAAA,CAAA,CAAA,CAAwB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAE9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,gBAAA,CAAA,CAAA,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,WAAA,CAAA,CAAA,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAcpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,wBAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAA;AAWzE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,cAAA,CAAA,CAAA,CAAiB;AAAA,CAAA,CAC5B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACP,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACP,IAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA;AACR,CAAA;AAOO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,sBAAA,CAAA,CAAA,CAAyB,CAAA,CAAA,CAAA;;"}
|
package/build/esm/eve.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { setConversationId } from '@sentry/core';
|
|
1
|
+
import { defineIntegration, setConversationId } from '@sentry/core';
|
|
2
|
+
import { markEveGenAiRecordingDefault } from './integrations/vercel-ai/gen-ai-recording-mode.js';
|
|
2
3
|
|
|
3
4
|
function eveConversationHook(options = {}) {
|
|
4
5
|
const { getConversationId } = options;
|
|
@@ -13,6 +14,14 @@ function eveConversationHook(options = {}) {
|
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
16
|
}
|
|
17
|
+
const eveIntegration = defineIntegration(() => {
|
|
18
|
+
return {
|
|
19
|
+
name: "Eve",
|
|
20
|
+
setup(client) {
|
|
21
|
+
markEveGenAiRecordingDefault(client);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
});
|
|
16
25
|
|
|
17
|
-
export { eveConversationHook };
|
|
26
|
+
export { eveConversationHook, eveIntegration };
|
|
18
27
|
//# sourceMappingURL=eve.js.map
|
package/build/esm/eve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eve.js","sources":["../../src/eve.ts"],"sourcesContent":["import { setConversationId } from '@sentry/core';\n\n/**\n * The subset of eve's hook context (`HookContext` from `eve/hooks`) this helper reads. Typed\n * structurally rather than importing from `eve`, so the SDK carries no dependency on the framework —\n * the shape is checked at the `defineHook(...)` call site in the user's app instead.\n */\ninterface EveHookContext {\n session: { id: string };\n}\n\ntype EveHookHandler = (event: unknown, context: EveHookContext) => void;\n\ninterface EveConversationHookOptions {\n /**\n * Derive the Sentry conversation id from the eve hook context. Defaults to the durable session id\n * (`ctx.session.id`), which is stable across every turn of a session and so groups them into one\n * conversation.\n */\n getConversationId?: (context: EveHookContext) => string | null | undefined;\n}\n\n/**\n * Builds the hook definition for an eve `agent/hooks/*.ts` file that tags a session's AI spans with\n * a Sentry conversation id, linking every turn of the session in the Agents \"Conversations\" view.\n *\n * ```ts\n * // agent/hooks/sentry.ts\n * import * as Sentry from '@sentry/node';\n * import { defineHook } from 'eve/hooks';\n *\n * export default defineHook(Sentry.eveConversationHook());\n * ```\n *\n * The id is set on the isolation scope; the default (always-on) `conversationIdIntegration` then\n * stamps `gen_ai.conversation.id` onto the gen_ai spans the Vercel AI instrumentation records for\n * that turn. That indirection is why the id has to be set here and not on the AI call: eve's session\n * id never reaches the AI SDK's telemetry channel, so it can only be attached via the scope.\n *\n * Subscribes to both `turn.started` and `step.started`. Each eve turn is a fresh durable-workflow\n * request with its own isolation scope, and a turn that parks and resumes (approvals, compaction)\n * resumes in yet another request; `turn.started` alone would miss the model calls after a resume.\n * `step.started` fires before every model call, so together they cover each request that produces\n * spans. Re-setting the same id is idempotent, so the overlap is harmless.\n */\nexport function eveConversationHook(options: EveConversationHookOptions = {}): {\n events: Record<'turn.started' | 'step.started', EveHookHandler>;\n} {\n const { getConversationId } = options;\n\n const setConversationIdFromContext: EveHookHandler = (_event, context) => {\n const conversationId = getConversationId ? getConversationId(context) : context.session.id;\n setConversationId(conversationId);\n };\n\n return {\n events: {\n 'turn.started': setConversationIdFromContext,\n 'step.started': setConversationIdFromContext,\n },\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eve.js","sources":["../../src/eve.ts"],"sourcesContent":["import { defineIntegration, setConversationId } from '@sentry/core';\nimport { markEveGenAiRecordingDefault } from './integrations/vercel-ai/gen-ai-recording-mode';\n\n/**\n * The subset of eve's hook context (`HookContext` from `eve/hooks`) this helper reads. Typed\n * structurally rather than importing from `eve`, so the SDK carries no dependency on the framework —\n * the shape is checked at the `defineHook(...)` call site in the user's app instead.\n */\ninterface EveHookContext {\n session: { id: string };\n}\n\ntype EveHookHandler = (event: unknown, context: EveHookContext) => void;\n\ninterface EveConversationHookOptions {\n /**\n * Derive the Sentry conversation id from the eve hook context. Defaults to the durable session id\n * (`ctx.session.id`), which is stable across every turn of a session and so groups them into one\n * conversation.\n */\n getConversationId?: (context: EveHookContext) => string | null | undefined;\n}\n\n/**\n * Builds the hook definition for an eve `agent/hooks/*.ts` file that tags a session's AI spans with\n * a Sentry conversation id, linking every turn of the session in the Agents \"Conversations\" view.\n *\n * ```ts\n * // agent/hooks/sentry.ts\n * import * as Sentry from '@sentry/node';\n * import { defineHook } from 'eve/hooks';\n *\n * export default defineHook(Sentry.eveConversationHook());\n * ```\n *\n * The id is set on the isolation scope; the default (always-on) `conversationIdIntegration` then\n * stamps `gen_ai.conversation.id` onto the gen_ai spans the Vercel AI instrumentation records for\n * that turn. That indirection is why the id has to be set here and not on the AI call: eve's session\n * id never reaches the AI SDK's telemetry channel, so it can only be attached via the scope.\n *\n * Subscribes to both `turn.started` and `step.started`. Each eve turn is a fresh durable-workflow\n * request with its own isolation scope, and a turn that parks and resumes (approvals, compaction)\n * resumes in yet another request; `turn.started` alone would miss the model calls after a resume.\n * `step.started` fires before every model call, so together they cover each request that produces\n * spans. Re-setting the same id is idempotent, so the overlap is harmless.\n */\nexport function eveConversationHook(options: EveConversationHookOptions = {}): {\n events: Record<'turn.started' | 'step.started', EveHookHandler>;\n} {\n const { getConversationId } = options;\n\n const setConversationIdFromContext: EveHookHandler = (_event, context) => {\n const conversationId = getConversationId ? getConversationId(context) : context.session.id;\n setConversationId(conversationId);\n };\n\n return {\n events: {\n 'turn.started': setConversationIdFromContext,\n 'step.started': setConversationIdFromContext,\n },\n };\n}\n\n/**\n * Integration that handles tracing instrumentation of [eve](https://eve.dev) apps.\n */\nexport const eveIntegration = defineIntegration(() => {\n return {\n name: 'Eve' as const,\n setup(client) {\n markEveGenAiRecordingDefault(client);\n },\n };\n});\n"],"names":[],"mappings":";;;AA8CO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsC,EAAC,CAAA,CAEzE;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAkB,GAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAE9B,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,OAAA,CAAA,CAAA,CAAA,CAAA,CAAY;AACxE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CAAA;AAClB,CAAA,CAAA,CACF;AACF;AAKO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AACpD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO;AAAA,CAAA,CAAA,CAAA,CACL,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACN,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ;AACZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA;AAAA,CAAA,CAAA,CAAA,CACrC;AAAA,CAAA,CAAA,CACF;AACF,CAAC,CAAA;;"}
|
package/build/esm/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { attachKoaErrorHandler } from './integrations/koa/koa-error-handler.js';
|
|
|
17
17
|
import { attachHapiErrorHandler as attachHapiErrorHandler$1 } from './integrations/hapi/hapi-error-handler.js';
|
|
18
18
|
export { bindTracingChannelToSpan } from './tracing-channel.js';
|
|
19
19
|
export { orchestrionModuleInjected } from './utils/moduleInjected.js';
|
|
20
|
-
export { eveConversationHook } from './eve.js';
|
|
20
|
+
export { eveConversationHook, eveIntegration } from './eve.js';
|
|
21
21
|
export { getInstrumentedModuleNames } from './orchestrion/config/index.js';
|
|
22
22
|
export { fastifyIntegration, setupFastifyErrorHandler } from './integrations/fastify/index.js';
|
|
23
23
|
export { prismaIntegration } from './integrations/prisma/index.js';
|
|
@@ -35,11 +35,14 @@ export { kafkaIntegration } from './integrations/kafkajs/index.js';
|
|
|
35
35
|
export { knexIntegration } from './integrations/knex.js';
|
|
36
36
|
export { langChainIntegration } from './integrations/langchain.js';
|
|
37
37
|
export { langGraphIntegration } from './integrations/langgraph.js';
|
|
38
|
+
export { flueIntegration } from './integrations/flue.js';
|
|
38
39
|
export { mastraIntegration } from './integrations/mastra.js';
|
|
39
40
|
export { lruMemoizerIntegration } from './integrations/lru-memoizer.js';
|
|
40
41
|
export { mongoIntegration } from './integrations/mongodb/index.js';
|
|
41
42
|
export { mongooseIntegration } from './integrations/mongoose/index.js';
|
|
42
43
|
export { mistralAIIntegration } from './integrations/mistral.js';
|
|
44
|
+
export { groqIntegration } from './integrations/groq.js';
|
|
45
|
+
export { togetherAIIntegration } from './integrations/together-ai.js';
|
|
43
46
|
export { mysqlIntegration } from './integrations/mysql.js';
|
|
44
47
|
export { mysql2Integration } from './integrations/mysql2/index.js';
|
|
45
48
|
export { openAIIntegration } from './integrations/openai.js';
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["export * from './exports';\n\n// Exports using diagnostics channels\nexport { detectOrchestrionSetup } from './orchestrion/detect';\n// oxlint-disable-next-line typescript/no-deprecated -- re-exported so the deprecated `setupKoaErrorHandler` can delegate\nexport { attachKoaErrorHandler } from './integrations/koa/koa-error-handler';\nimport { attachHapiErrorHandler as _attachHapiErrorHandler } from './integrations/hapi/hapi-error-handler';\nexport { bindTracingChannelToSpan } from './tracing-channel';\nexport type { TracingChannelPayloadWithSpan } from './tracing-channel';\nexport type { InstrumentationConfig } from './orchestrion/apmTypes';\n// Runtime target of the bundler-injected module snippet. The snippet imports it\n// from this entry alongside the module's subscriber factory (see\n// `orchestrion/bundler/moduleInjectedTransform.ts`); it is a plain runtime\n// helper with no orchestrion build-time dependency.\nexport { orchestrionModuleInjected } from './utils/moduleInjected';\nexport { eveConversationHook } from './eve';\nexport { getInstrumentedModuleNames } from './orchestrion/config';\nexport {\n fastifyIntegration,\n // oxlint-disable-next-line typescript/no-deprecated\n setupFastifyErrorHandler,\n} from './integrations/fastify';\n\n/**\n * @deprecated This is a temporary export to avoid breaking changes. It will be removed in the next major version.\n */\nexport const attachHapiErrorHandler = _attachHapiErrorHandler;\n\n// Integrations\nexport { prismaIntegration } from './integrations/prisma';\nexport { amqplibIntegration } from './integrations/amqplib';\nexport { anthropicAIIntegration } from './integrations/anthropic';\nexport { awsIntegration } from './integrations/aws-sdk';\nexport { dataloaderIntegration } from './integrations/dataloader';\nexport { genericPoolIntegration } from './integrations/generic-pool';\nexport { googleGenAIIntegration } from './integrations/google-genai';\nexport { graphqlIntegration } from './integrations/graphql';\nexport { hapiIntegration } from './integrations/hapi';\nexport { koaIntegration } from './integrations/koa';\nexport { redisIntegration } from './integrations/redis';\nexport { kafkaIntegration } from './integrations/kafkajs';\nexport { knexIntegration } from './integrations/knex';\nexport { langChainIntegration } from './integrations/langchain';\nexport { langGraphIntegration } from './integrations/langgraph';\nexport { createFlueInstrumentation } from './ai/flue';\nexport type { FlueOptions } from './ai/flue';\nexport { mastraIntegration } from './integrations/mastra';\nexport { SentryMastraExporter } from './ai/mastra';\nexport { lruMemoizerIntegration } from './integrations/lru-memoizer';\nexport { mongoIntegration } from './integrations/mongodb';\nexport { mongooseIntegration } from './integrations/mongoose';\nexport { mistralAIIntegration } from './integrations/mistral';\nexport { mysqlIntegration } from './integrations/mysql';\nexport { mysql2Integration } from './integrations/mysql2';\nexport { openAIIntegration } from './integrations/openai';\nexport { postgresIntegration } from './integrations/postgres';\nexport { postgresJsIntegration } from './integrations/postgres-js';\nexport { tediousIntegration } from './integrations/tedious';\nexport { vercelAIIntegration } from './integrations/vercel-ai';\nexport { expressIntegration } from './integrations/express';\nexport type { ExpressIntegrationOptions } from './integrations/express/types';\n/* oxlint-disable typescript/no-deprecated -- deprecated Express error-handler exports, kept until the next major */\nexport { expressErrorHandler, setupExpressErrorHandler } from './integrations/express/error-handler';\n/* oxlint-enable typescript/no-deprecated */\nexport { firebaseIntegration } from './integrations/firebase';\n\nexport { getTracingIntegrations, getErrorIntegrations } from './integrations';\n"],"names":["_attachHapiErrorHandler"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["export * from './exports';\n\n// Exports using diagnostics channels\nexport { detectOrchestrionSetup } from './orchestrion/detect';\n// oxlint-disable-next-line typescript/no-deprecated -- re-exported so the deprecated `setupKoaErrorHandler` can delegate\nexport { attachKoaErrorHandler } from './integrations/koa/koa-error-handler';\nimport { attachHapiErrorHandler as _attachHapiErrorHandler } from './integrations/hapi/hapi-error-handler';\nexport { bindTracingChannelToSpan } from './tracing-channel';\nexport type { TracingChannelPayloadWithSpan } from './tracing-channel';\nexport type { InstrumentationConfig } from './orchestrion/apmTypes';\n// Runtime target of the bundler-injected module snippet. The snippet imports it\n// from this entry alongside the module's subscriber factory (see\n// `orchestrion/bundler/moduleInjectedTransform.ts`); it is a plain runtime\n// helper with no orchestrion build-time dependency.\nexport { orchestrionModuleInjected } from './utils/moduleInjected';\nexport { eveConversationHook, eveIntegration } from './eve';\nexport { getInstrumentedModuleNames } from './orchestrion/config';\nexport {\n fastifyIntegration,\n // oxlint-disable-next-line typescript/no-deprecated\n setupFastifyErrorHandler,\n} from './integrations/fastify';\n\n/**\n * @deprecated This is a temporary export to avoid breaking changes. It will be removed in the next major version.\n */\nexport const attachHapiErrorHandler = _attachHapiErrorHandler;\n\n// Integrations\nexport { prismaIntegration } from './integrations/prisma';\nexport { amqplibIntegration } from './integrations/amqplib';\nexport { anthropicAIIntegration } from './integrations/anthropic';\nexport { awsIntegration } from './integrations/aws-sdk';\nexport { dataloaderIntegration } from './integrations/dataloader';\nexport { genericPoolIntegration } from './integrations/generic-pool';\nexport { googleGenAIIntegration } from './integrations/google-genai';\nexport { graphqlIntegration } from './integrations/graphql';\nexport { hapiIntegration } from './integrations/hapi';\nexport { koaIntegration } from './integrations/koa';\nexport { redisIntegration } from './integrations/redis';\nexport { kafkaIntegration } from './integrations/kafkajs';\nexport { knexIntegration } from './integrations/knex';\nexport { langChainIntegration } from './integrations/langchain';\nexport { langGraphIntegration } from './integrations/langgraph';\nexport { createFlueInstrumentation } from './ai/flue';\nexport { flueIntegration } from './integrations/flue';\nexport type { FlueOptions } from './ai/flue';\nexport { mastraIntegration } from './integrations/mastra';\nexport { SentryMastraExporter } from './ai/mastra';\nexport { lruMemoizerIntegration } from './integrations/lru-memoizer';\nexport { mongoIntegration } from './integrations/mongodb';\nexport { mongooseIntegration } from './integrations/mongoose';\nexport { mistralAIIntegration } from './integrations/mistral';\nexport { groqIntegration } from './integrations/groq';\nexport { togetherAIIntegration } from './integrations/together-ai';\nexport { mysqlIntegration } from './integrations/mysql';\nexport { mysql2Integration } from './integrations/mysql2';\nexport { openAIIntegration } from './integrations/openai';\nexport { postgresIntegration } from './integrations/postgres';\nexport { postgresJsIntegration } from './integrations/postgres-js';\nexport { tediousIntegration } from './integrations/tedious';\nexport { vercelAIIntegration } from './integrations/vercel-ai';\nexport { expressIntegration } from './integrations/express';\nexport type { ExpressIntegrationOptions } from './integrations/express/types';\n/* oxlint-disable typescript/no-deprecated -- deprecated Express error-handler exports, kept until the next major */\nexport { expressErrorHandler, setupExpressErrorHandler } from './integrations/express/error-handler';\n/* oxlint-enable typescript/no-deprecated */\nexport { firebaseIntegration } from './integrations/firebase';\n\nexport { getTracingIntegrations, getErrorIntegrations } from './integrations';\n"],"names":["_attachHapiErrorHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,sBAAA,CAAA,CAAA,CAAyBA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineIntegration, GLOBAL_OBJ, debug } from '@sentry/core';
|
|
2
|
+
import { createFlueInstrumentation } from '../ai/flue/index.js';
|
|
3
|
+
import { FLUE_INTEGRATION_NAME, FLUE_MODULE_NAME } from '../ai/flue/constants.js';
|
|
4
|
+
import { DEBUG_BUILD } from '../debug-build.js';
|
|
5
|
+
|
|
6
|
+
let registeredBinding;
|
|
7
|
+
const _flueIntegration = ((options = {}) => {
|
|
8
|
+
return {
|
|
9
|
+
name: FLUE_INTEGRATION_NAME,
|
|
10
|
+
setup() {
|
|
11
|
+
const provided = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.providedModules?.[FLUE_MODULE_NAME];
|
|
12
|
+
const instrument = provided?.instrument;
|
|
13
|
+
if (typeof instrument !== "function") {
|
|
14
|
+
DEBUG_BUILD && debug.log("[Flue] no provided `@flue/runtime` binding; skipping auto-registration");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (instrument === registeredBinding) {
|
|
18
|
+
DEBUG_BUILD && debug.log("[Flue] already registered in this isolate; skipping auto-registration");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
instrument(createFlueInstrumentation(options));
|
|
23
|
+
registeredBinding = instrument;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (error?.name === "InstrumentationAlreadyInstalledError") {
|
|
26
|
+
registeredBinding = instrument;
|
|
27
|
+
DEBUG_BUILD && debug.log("[Flue] already instrumented by the app; skipping auto-registration");
|
|
28
|
+
} else {
|
|
29
|
+
debug.warn("[Flue] auto-registration failed; Flue spans will not be recorded:", error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const flueIntegration = defineIntegration(_flueIntegration);
|
|
36
|
+
|
|
37
|
+
export { flueIntegration };
|
|
38
|
+
//# sourceMappingURL=flue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flue.js","sources":["../../../src/integrations/flue.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { FlueOptions } from '../ai/flue';\nimport { createFlueInstrumentation } from '../ai/flue';\nimport { FLUE_INTEGRATION_NAME, FLUE_MODULE_NAME } from '../ai/flue/constants';\nimport { DEBUG_BUILD } from '../debug-build';\n\ntype FlueInstrumentFn = (instrumentation: ReturnType<typeof createFlueInstrumentation>) => unknown;\n\n/**\n * The `instrument` we last registered against, so a second `setup()` in the same isolate is a\n * no-op. Cloudflare runs `init()` per request, and with `cacheClient: false` that reaches here\n * every time: in production Flue throws on the repeat, and under `vite dev` it disposes our\n * previous registration instead — ending the turn and tool spans of every in-flight request.\n *\n * Keyed on the binding rather than a bare boolean so a fresh `@flue/runtime` instance (a new\n * isolate reusing this module, a test swapping the marker) still registers.\n */\nlet registeredBinding: FlueInstrumentFn | undefined;\n\n/**\n * Register the instrumentation with Flue on the user's behalf, when the runtime binding is available.\n *\n * Flue is registered rather than patched — `instrument()` writes into module-scope state — so this\n * needs a reference to that module's own binding. In a bundled worker there is no `node_modules` to\n * resolve one from, so `@sentry/cloudflare/vite` splices a static `@flue/runtime` import into this\n * module at build time and stashes the namespace on the global marker. Outside that setup the marker\n * is empty and this no-ops, leaving the user's own `instrument(Sentry.createFlueInstrumentation())`\n * as the way in.\n */\nconst _flueIntegration = ((options: FlueOptions = {}) => {\n return {\n name: FLUE_INTEGRATION_NAME,\n setup() {\n const provided = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.providedModules?.[FLUE_MODULE_NAME];\n const instrument = provided?.instrument as FlueInstrumentFn | undefined;\n\n if (typeof instrument !== 'function') {\n DEBUG_BUILD && debug.log('[Flue] no provided `@flue/runtime` binding; skipping auto-registration');\n return;\n }\n\n if (instrument === registeredBinding) {\n DEBUG_BUILD && debug.log('[Flue] already registered in this isolate; skipping auto-registration');\n return;\n }\n\n try {\n instrument(createFlueInstrumentation(options));\n registeredBinding = instrument;\n } catch (error) {\n // Never rethrow: `setup()` runs inside `Sentry.init()`, which core calls unguarded and\n // Cloudflare calls per request, so throwing here would take down the request handler.\n if ((error as Error | undefined)?.name === 'InstrumentationAlreadyInstalledError') {\n // The app owns the key and we will never win it, so stop rebuilding the instrumentation\n // (two 1000-entry `LRUMap`s) on every later `init()`.\n registeredBinding = instrument;\n DEBUG_BUILD && debug.log('[Flue] already instrumented by the app; skipping auto-registration');\n } else {\n debug.warn('[Flue] auto-registration failed; Flue spans will not be recorded:', error);\n }\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const flueIntegration = defineIntegration(_flueIntegration);\n"],"names":[],"mappings":";;;;;AAkBA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAYJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,gBAAA,CAAA,CAAA,CAAA,CAAoB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,EAAC,CAAA,CAAA,CAAA,CAAA,CAAM;AACvD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAqE,KAAK,CAAA;AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACvF;AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACF;AAAA,CAAA,CAAA,CAAA,CACF;AAAA,CAAA,CAAA,CACF;AACF,CAAA,CAAA;AAEO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAAA;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineIntegration } from '@sentry/core';
|
|
2
|
+
import { CHANNELS } from '../orchestrion/channels.js';
|
|
3
|
+
import { groqModuleNames } from '../orchestrion/config/groq.js';
|
|
4
|
+
import { createOpenAiCompatibleIntegration } from './openai-compatible.js';
|
|
5
|
+
|
|
6
|
+
const GROQ_INTEGRATION_NAME = "Groq";
|
|
7
|
+
const groqIntegration = defineIntegration(
|
|
8
|
+
createOpenAiCompatibleIntegration({
|
|
9
|
+
integrationName: GROQ_INTEGRATION_NAME,
|
|
10
|
+
providerName: "groq",
|
|
11
|
+
origin: "auto.ai.groq",
|
|
12
|
+
moduleNames: groqModuleNames,
|
|
13
|
+
channels: { chat: CHANNELS.GROQ_CHAT, embeddings: CHANNELS.GROQ_EMBEDDINGS }
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export { GROQ_INTEGRATION_NAME, groqIntegration };
|
|
18
|
+
//# sourceMappingURL=groq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq.js","sources":["../../../src/integrations/groq.ts"],"sourcesContent":["import { defineIntegration } from '@sentry/core';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { groqModuleNames } from '../orchestrion/config/groq';\nimport { createOpenAiCompatibleIntegration } from './openai-compatible';\n\n// Exported so LangChain can add it to its provider-skip list: `@langchain/groq` drives `groq-sdk`, so\n// a `ChatGroq` call would otherwise open both a LangChain span and this integration's Groq span.\nexport const GROQ_INTEGRATION_NAME = 'Groq' as const;\n\n/**\n * Instruments the `groq-sdk` client (chat completions and embeddings). Groq speaks the OpenAI wire format,\n * so this reuses the openai span/streaming logic; see `createOpenAiCompatibleIntegration`. Requires the\n * Sentry runtime hook or bundler plugin so the diagnostics channels get injected into `groq-sdk`.\n */\nexport const groqIntegration = defineIntegration(\n createOpenAiCompatibleIntegration({\n integrationName: GROQ_INTEGRATION_NAME,\n providerName: 'groq',\n origin: 'auto.ai.groq',\n moduleNames: groqModuleNames,\n channels: { chat: CHANNELS.GROQ_CHAT, embeddings: CHANNELS.GROQ_EMBEDDINGS },\n }),\n);\n"],"names":[],"mappings":";;;;;AAOO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,qBAAA,CAAA,CAAA,CAAwB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAO9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAC7B,iCAAA,CAAkC;AAAA,CAAA,CAAA,CAAA,CAChC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAiB,C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'./google-genai.js';
|
|
23
23
|
import { mistralAIIntegration } from './mistral.js';
|
|
24
|
+
import { groqIntegration } from './groq.js';
|
|
25
|
+
import { togetherAIIntegration } from './together-ai.js';
|
|
24
26
|
import { postgresJsIntegration } from './postgres-js.js';
|
|
25
27
|
import { firebaseIntegration } from './firebase/index.js';
|
|
26
28
|
import { expressIntegration } from './express/index.js';
|
|
@@ -57,6 +59,8 @@ function getTracingIntegrations() {
|
|
|
57
59
|
anthropicAIIntegration(),
|
|
58
60
|
googleGenAIIntegration(),
|
|
59
61
|
mistralAIIntegration(),
|
|
62
|
+
groqIntegration(),
|
|
63
|
+
togetherAIIntegration(),
|
|
60
64
|
postgresJsIntegration(),
|
|
61
65
|
firebaseIntegration()
|
|
62
66
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/integrations/index.ts"],"sourcesContent":["import { amqplibIntegration } from './amqplib';\nimport { dataloaderIntegration } from './dataloader';\nimport { knexIntegration } from './knex';\nimport { mongoIntegration } from './mongodb';\nimport { graphqlIntegration } from './graphql';\nimport { redisIntegration } from './redis';\nimport { mysqlIntegration } from './mysql';\nimport { mysql2Integration } from './mysql2';\nimport { postgresIntegration } from './postgres';\nimport { prismaIntegration } from './prisma';\nimport { tediousIntegration } from './tedious';\nimport { genericPoolIntegration } from './generic-pool';\nimport { kafkaIntegration } from './kafkajs';\nimport { mongooseIntegration } from './mongoose';\nimport { lruMemoizerIntegration } from './lru-memoizer';\nimport { langChainIntegration } from './langchain';\nimport { langGraphIntegration } from './langgraph';\nimport { mastraIntegration } from './mastra';\nimport { vercelAIIntegration } from './vercel-ai';\nimport { openAIIntegration } from './openai';\nimport { anthropicAIIntegration } from './anthropic';\nimport { googleGenAIIntegration } from './google-genai';\nimport { mistralAIIntegration } from './mistral';\nimport { postgresJsIntegration } from './postgres-js';\nimport { firebaseIntegration } from './firebase';\nimport { expressIntegration } from './express';\nimport { fastifyIntegration } from './fastify';\nimport { hapiIntegration } from './hapi';\nimport { koaIntegration } from './koa';\nimport type { Integration } from '@sentry/core';\nimport { awsIntegration } from './aws-sdk';\n\n/** These are integrations that are tracing-only integrations. */\nexport function getTracingIntegrations(): Integration[] {\n return [\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n tediousIntegration(),\n knexIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n dataloaderIntegration(),\n awsIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n mastraIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n mistralAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n ];\n}\n\n/** These are integrations that cover error capture, in addition to tracing. */\nexport function getErrorIntegrations(): Integration[] {\n return [expressIntegration(), fastifyIntegration(), hapiIntegration(), koaIntegration()];\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/integrations/index.ts"],"sourcesContent":["import { amqplibIntegration } from './amqplib';\nimport { dataloaderIntegration } from './dataloader';\nimport { knexIntegration } from './knex';\nimport { mongoIntegration } from './mongodb';\nimport { graphqlIntegration } from './graphql';\nimport { redisIntegration } from './redis';\nimport { mysqlIntegration } from './mysql';\nimport { mysql2Integration } from './mysql2';\nimport { postgresIntegration } from './postgres';\nimport { prismaIntegration } from './prisma';\nimport { tediousIntegration } from './tedious';\nimport { genericPoolIntegration } from './generic-pool';\nimport { kafkaIntegration } from './kafkajs';\nimport { mongooseIntegration } from './mongoose';\nimport { lruMemoizerIntegration } from './lru-memoizer';\nimport { langChainIntegration } from './langchain';\nimport { langGraphIntegration } from './langgraph';\nimport { mastraIntegration } from './mastra';\nimport { vercelAIIntegration } from './vercel-ai';\nimport { openAIIntegration } from './openai';\nimport { anthropicAIIntegration } from './anthropic';\nimport { googleGenAIIntegration } from './google-genai';\nimport { mistralAIIntegration } from './mistral';\nimport { groqIntegration } from './groq';\nimport { togetherAIIntegration } from './together-ai';\nimport { postgresJsIntegration } from './postgres-js';\nimport { firebaseIntegration } from './firebase';\nimport { expressIntegration } from './express';\nimport { fastifyIntegration } from './fastify';\nimport { hapiIntegration } from './hapi';\nimport { koaIntegration } from './koa';\nimport type { Integration } from '@sentry/core';\nimport { awsIntegration } from './aws-sdk';\n\n/** These are integrations that are tracing-only integrations. */\nexport function getTracingIntegrations(): Integration[] {\n return [\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n tediousIntegration(),\n knexIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n dataloaderIntegration(),\n awsIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n mastraIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n mistralAIIntegration(),\n groqIntegration(),\n togetherAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n ];\n}\n\n/** These are integrations that cover error capture, in addition to tracing. */\nexport function getErrorIntegrations(): Integration[] {\n return [expressIntegration(), fastifyIntegration(), hapiIntegration(), koaIntegration()];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,sBAAA,CAAA,CAAA,CAAwC;AACtD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO;AAAA,CAAA,CAAA,CAAA,CACL,kBAAA,CAAA,CAAmB;AAAA,CAAA,CAAA,CAAA,CACnB,gBAAA,CAAA,CAA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AAA,CAAA,CAAA,CAAA,CAAA,GAAsB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAgB,CAAA;AACzF;;"}
|
|
@@ -8,6 +8,7 @@ import { _INTERNAL_getLangChainEmbeddingsSpanOptions } from '../ai/langchain/emb
|
|
|
8
8
|
import { _INTERNAL_mergeLangChainCallbackHandler } from '../ai/langchain/utils.js';
|
|
9
9
|
import { MISTRAL_INTEGRATION_NAME } from '../ai/mistral/constants.js';
|
|
10
10
|
import { OPENAI_INTEGRATION_NAME } from '../ai/openai/constants.js';
|
|
11
|
+
import { GROQ_INTEGRATION_NAME } from './groq.js';
|
|
11
12
|
import { CHANNELS } from '../orchestrion/channels.js';
|
|
12
13
|
import { langchainModuleNames, langchainEmbeddingsChannels } from '../orchestrion/config/langchain.js';
|
|
13
14
|
import { bindTracingChannelToSpan } from '../tracing-channel.js';
|
|
@@ -18,7 +19,9 @@ const SKIPPED_PROVIDERS = [
|
|
|
18
19
|
OPENAI_INTEGRATION_NAME,
|
|
19
20
|
ANTHROPIC_AI_INTEGRATION_NAME,
|
|
20
21
|
GOOGLE_GENAI_INTEGRATION_NAME,
|
|
21
|
-
MISTRAL_INTEGRATION_NAME
|
|
22
|
+
MISTRAL_INTEGRATION_NAME,
|
|
23
|
+
// `@langchain/groq` drives `groq-sdk`, so ChatGroq calls must not also open the Groq integration's span.
|
|
24
|
+
GROQ_INTEGRATION_NAME
|
|
22
25
|
];
|
|
23
26
|
function markProvidersSkipped() {
|
|
24
27
|
_INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.js","sources":["../../../src/integrations/langchain.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { _INTERNAL_skipAiProviderWrapping, defineIntegration, startInactiveSpan } from '@sentry/core';\nimport { ANTHROPIC_AI_INTEGRATION_NAME } from '../ai/anthropic-ai/constants';\nimport { GOOGLE_GENAI_INTEGRATION_NAME } from '../ai/google-genai/constants';\nimport { createLangChainCallbackHandler } from '../ai/langchain';\nimport { LANGCHAIN_INTEGRATION_NAME } from '../ai/langchain/constants';\nimport { _INTERNAL_getLangChainEmbeddingsSpanOptions } from '../ai/langchain/embeddings';\nimport type { LangChainOptions } from '../ai/langchain/types';\nimport { _INTERNAL_mergeLangChainCallbackHandler } from '../ai/langchain/utils';\nimport { MISTRAL_INTEGRATION_NAME } from '../ai/mistral/constants';\nimport { OPENAI_INTEGRATION_NAME } from '../ai/openai/constants';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { langchainEmbeddingsChannels } from '../orchestrion/config/langchain';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport { langchainModuleNames } from '../orchestrion/config/langchain';\nimport { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation';\n\n// Same name as the OTel integration by design, so the OTel 'LangChain' integration is\n// deduplicated out of the default set.\nconst INTEGRATION_NAME = LANGCHAIN_INTEGRATION_NAME;\n\n// LangChain drives the underlying AI provider SDKs itself, so while it's active those providers must\n// not also instrument, or every call would produce two spans (mirrors the OTel path's skip list).\nconst SKIPPED_PROVIDERS = [\n OPENAI_INTEGRATION_NAME,\n ANTHROPIC_AI_INTEGRATION_NAME,\n GOOGLE_GENAI_INTEGRATION_NAME,\n MISTRAL_INTEGRATION_NAME,\n];\n\n// The chat-model channels carry the live args array of `invoke(input, options)` / `_streamIterator(input, options)`.\ninterface RunnableChannelContext {\n arguments: unknown[];\n}\n\n// The embeddings channels carry the instance (`self`) and the `embedQuery(text)` / `embedDocuments(texts)` args.\ninterface EmbeddingsChannelContext {\n self?: unknown;\n arguments: unknown[];\n}\n\n// Registered lazily on the first LangChain call (not at `setupOnce`) so a direct provider call made\n// before any LangChain call still gets its own span — matches the OTel patch-on-import timing. It\n// also stops the underlying SDK from double-instrumenting embeddings, whose `embedQuery`/\n// `embedDocuments` call the provider SDK (e.g. `openai`) internally.\nfunction markProvidersSkipped(): void {\n _INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);\n}\n\nconst _langChainIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n // Chat models only mutate the call args, so they subscribe without the\n // async-context binding. Kept separate so a missing binding never defers\n // them: on the bundler path the wait would push subscription past\n // `Sentry.init()` and early calls would run with no subscriber.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentChatModels, [options], {\n requiresTracingChannelBinding: false,\n });\n // Embeddings open their own spans via `bindTracingChannelToSpan`, which\n // needs the binding.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentEmbeddings, [options]);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentChatModels(options: LangChainOptions): void {\n // One stateful handler tracks spans across the whole run tree, just like the OTel path.\n const sentryHandler = createLangChainCallbackHandler(options);\n\n // Chat models: inject the Sentry callback handler into the call options (arg 1). LangChain's own\n // callback dispatch then creates the spans, exactly as in the OTel path, so no span is opened\n // here — a `start` subscriber (which also makes orchestrion wrap the function) is enough.\n const injectHandler = (message: unknown): void => {\n markProvidersSkipped();\n\n const args = (message as RunnableChannelContext).arguments;\n if (!Array.isArray(args)) {\n return;\n }\n\n let callOptions = args[1] as Record<string, unknown> | undefined;\n if (!callOptions || typeof callOptions !== 'object' || Array.isArray(callOptions)) {\n callOptions = {};\n args[1] = callOptions;\n }\n\n callOptions.callbacks = _INTERNAL_mergeLangChainCallbackHandler(callOptions.callbacks, sentryHandler);\n };\n\n for (const channelName of [CHANNELS.LANGCHAIN_CHAT_MODEL_INVOKE, CHANNELS.LANGCHAIN_CHAT_MODEL_STREAM]) {\n diagnosticsChannel.tracingChannel<RunnableChannelContext>(channelName).start.subscribe(injectHandler);\n }\n}\n\n// Embeddings don't use the callback system. Wrap the method in its own span.\n// Embedding errors reject to the caller, so we only open the span (which bindTracingChannelToSpan\n// still marks failed on error) and do not capture them.\nfunction instrumentEmbeddings(options: LangChainOptions): void {\n for (const channelName of langchainEmbeddingsChannels) {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<EmbeddingsChannelContext>(channelName), data =>\n createEmbeddingsSpan(data, options),\n );\n }\n}\n\nfunction createEmbeddingsSpan(data: EmbeddingsChannelContext, options: LangChainOptions): Span {\n // `embedQuery`/`embedDocuments` call the provider SDK internally, so skip that SDK's own\n // instrumentation before its channel fires (the producer runs at the embeddings channel's `start`).\n markProvidersSkipped();\n\n const input = (data.arguments ?? [])[0];\n\n return startInactiveSpan(_INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, input, options));\n}\n\n/**\n * Diagnostics-channel-based LangChain integration. Subscribes to the diagnostics_channels\n * injected into `@langchain/core`'s `BaseChatModel` (to inject the Sentry callback handler) and into\n * `@langchain/openai`'s embedding methods, so it requires the Sentry runtime hook or bundler plugin.\n */\nexport const langChainIntegration = defineIntegration(_langChainIntegration);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAoBA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAIzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,iBAAA,CAAA,CAAA,CAAoB;AAAA,CAAA,CACxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4C,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAC,CAAA;AACjG;AAOO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"langchain.js","sources":["../../../src/integrations/langchain.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { _INTERNAL_skipAiProviderWrapping, defineIntegration, startInactiveSpan } from '@sentry/core';\nimport { ANTHROPIC_AI_INTEGRATION_NAME } from '../ai/anthropic-ai/constants';\nimport { GOOGLE_GENAI_INTEGRATION_NAME } from '../ai/google-genai/constants';\nimport { createLangChainCallbackHandler } from '../ai/langchain';\nimport { LANGCHAIN_INTEGRATION_NAME } from '../ai/langchain/constants';\nimport { _INTERNAL_getLangChainEmbeddingsSpanOptions } from '../ai/langchain/embeddings';\nimport type { LangChainOptions } from '../ai/langchain/types';\nimport { _INTERNAL_mergeLangChainCallbackHandler } from '../ai/langchain/utils';\nimport { MISTRAL_INTEGRATION_NAME } from '../ai/mistral/constants';\nimport { OPENAI_INTEGRATION_NAME } from '../ai/openai/constants';\nimport { GROQ_INTEGRATION_NAME } from './groq';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { langchainEmbeddingsChannels } from '../orchestrion/config/langchain';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport { langchainModuleNames } from '../orchestrion/config/langchain';\nimport { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation';\n\n// Same name as the OTel integration by design, so the OTel 'LangChain' integration is\n// deduplicated out of the default set.\nconst INTEGRATION_NAME = LANGCHAIN_INTEGRATION_NAME;\n\n// LangChain drives the underlying AI provider SDKs itself, so while it's active those providers must\n// not also instrument, or every call would produce two spans (mirrors the OTel path's skip list).\nconst SKIPPED_PROVIDERS = [\n OPENAI_INTEGRATION_NAME,\n ANTHROPIC_AI_INTEGRATION_NAME,\n GOOGLE_GENAI_INTEGRATION_NAME,\n MISTRAL_INTEGRATION_NAME,\n // `@langchain/groq` drives `groq-sdk`, so ChatGroq calls must not also open the Groq integration's span.\n GROQ_INTEGRATION_NAME,\n];\n\n// The chat-model channels carry the live args array of `invoke(input, options)` / `_streamIterator(input, options)`.\ninterface RunnableChannelContext {\n arguments: unknown[];\n}\n\n// The embeddings channels carry the instance (`self`) and the `embedQuery(text)` / `embedDocuments(texts)` args.\ninterface EmbeddingsChannelContext {\n self?: unknown;\n arguments: unknown[];\n}\n\n// Registered lazily on the first LangChain call (not at `setupOnce`) so a direct provider call made\n// before any LangChain call still gets its own span — matches the OTel patch-on-import timing. It\n// also stops the underlying SDK from double-instrumenting embeddings, whose `embedQuery`/\n// `embedDocuments` call the provider SDK (e.g. `openai`) internally.\nfunction markProvidersSkipped(): void {\n _INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);\n}\n\nconst _langChainIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n // Chat models only mutate the call args, so they subscribe without the\n // async-context binding. Kept separate so a missing binding never defers\n // them: on the bundler path the wait would push subscription past\n // `Sentry.init()` and early calls would run with no subscriber.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentChatModels, [options], {\n requiresTracingChannelBinding: false,\n });\n // Embeddings open their own spans via `bindTracingChannelToSpan`, which\n // needs the binding.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentEmbeddings, [options]);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentChatModels(options: LangChainOptions): void {\n // One stateful handler tracks spans across the whole run tree, just like the OTel path.\n const sentryHandler = createLangChainCallbackHandler(options);\n\n // Chat models: inject the Sentry callback handler into the call options (arg 1). LangChain's own\n // callback dispatch then creates the spans, exactly as in the OTel path, so no span is opened\n // here — a `start` subscriber (which also makes orchestrion wrap the function) is enough.\n const injectHandler = (message: unknown): void => {\n markProvidersSkipped();\n\n const args = (message as RunnableChannelContext).arguments;\n if (!Array.isArray(args)) {\n return;\n }\n\n let callOptions = args[1] as Record<string, unknown> | undefined;\n if (!callOptions || typeof callOptions !== 'object' || Array.isArray(callOptions)) {\n callOptions = {};\n args[1] = callOptions;\n }\n\n callOptions.callbacks = _INTERNAL_mergeLangChainCallbackHandler(callOptions.callbacks, sentryHandler);\n };\n\n for (const channelName of [CHANNELS.LANGCHAIN_CHAT_MODEL_INVOKE, CHANNELS.LANGCHAIN_CHAT_MODEL_STREAM]) {\n diagnosticsChannel.tracingChannel<RunnableChannelContext>(channelName).start.subscribe(injectHandler);\n }\n}\n\n// Embeddings don't use the callback system. Wrap the method in its own span.\n// Embedding errors reject to the caller, so we only open the span (which bindTracingChannelToSpan\n// still marks failed on error) and do not capture them.\nfunction instrumentEmbeddings(options: LangChainOptions): void {\n for (const channelName of langchainEmbeddingsChannels) {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<EmbeddingsChannelContext>(channelName), data =>\n createEmbeddingsSpan(data, options),\n );\n }\n}\n\nfunction createEmbeddingsSpan(data: EmbeddingsChannelContext, options: LangChainOptions): Span {\n // `embedQuery`/`embedDocuments` call the provider SDK internally, so skip that SDK's own\n // instrumentation before its channel fires (the producer runs at the embeddings channel's `start`).\n markProvidersSkipped();\n\n const input = (data.arguments ?? [])[0];\n\n return startInactiveSpan(_INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, input, options));\n}\n\n/**\n * Diagnostics-channel-based LangChain integration. Subscribes to the diagnostics_channels\n * injected into `@langchain/core`'s `BaseChatModel` (to inject the Sentry callback handler) and into\n * `@langchain/openai`'s embedding methods, so it requires the Sentry runtime hook or bundler plugin.\n */\nexport const langChainIntegration = defineIntegration(_langChainIntegration);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqBA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAIzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,iBAAA,CAAA,CAAA,CAAoB;AAAA,CAAA,CACxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA;;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { _INTERNAL_shouldSkipAiProviderWrapping, getClient, startInactiveSpan, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
|
+
import { GEN_AI_PROVIDER_NAME } from '@sentry/conventions/attributes';
|
|
4
|
+
import { resolveAIRecordingOptions, getGenAiSpanOp } from '../ai/core/utils.js';
|
|
5
|
+
import { extractRequestAttributes, addRequestAttributes } from '../ai/openai/index.js';
|
|
6
|
+
import { instrumentStream } from '../ai/openai/streaming.js';
|
|
7
|
+
import { addResponseAttributes } from '../ai/openai/utils.js';
|
|
8
|
+
import { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation.js';
|
|
9
|
+
import { bindTracingChannelToSpan } from '../tracing-channel.js';
|
|
10
|
+
|
|
11
|
+
function createOpenAiCompatibleIntegration(provider) {
|
|
12
|
+
const instrumentedChannels = [
|
|
13
|
+
{ channel: provider.channels.chat, operation: "chat" },
|
|
14
|
+
{ channel: provider.channels.embeddings, operation: "embeddings" }
|
|
15
|
+
];
|
|
16
|
+
function instrument(options) {
|
|
17
|
+
for (const { channel, operation } of instrumentedChannels) {
|
|
18
|
+
bindTracingChannelToSpan(
|
|
19
|
+
diagnosticsChannel.tracingChannel(channel),
|
|
20
|
+
(data) => createGenAiSpan(data, operation, provider, options),
|
|
21
|
+
{
|
|
22
|
+
beforeSpanEnd: (span, data) => {
|
|
23
|
+
addResponseAttributes(span, data.result, resolveAIRecordingOptions(options).recordOutputs);
|
|
24
|
+
},
|
|
25
|
+
// Streaming: the result is a `Stream` consumed later, so instrument it and let it end the span.
|
|
26
|
+
deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, options)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return ((options = {}) => {
|
|
32
|
+
return {
|
|
33
|
+
name: provider.integrationName,
|
|
34
|
+
setup(client) {
|
|
35
|
+
invokeOrchestrionInstrumentation(client, provider.moduleNames, instrument, [options]);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function createGenAiSpan(data, operation, provider, options) {
|
|
41
|
+
if (_INTERNAL_shouldSkipAiProviderWrapping(provider.integrationName)) {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
const args = data.arguments ?? [];
|
|
45
|
+
const params = args[0];
|
|
46
|
+
const { recordInputs } = resolveAIRecordingOptions(options);
|
|
47
|
+
const attributes = extractRequestAttributes(args, operation, recordInputs);
|
|
48
|
+
attributes[GEN_AI_PROVIDER_NAME] = provider.providerName;
|
|
49
|
+
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = provider.origin;
|
|
50
|
+
const model = params?.model || "unknown";
|
|
51
|
+
const client = getClient();
|
|
52
|
+
const span = startInactiveSpan({
|
|
53
|
+
// With span streaming, omit the `'unknown'` model sentinel so the name stays low-cardinality.
|
|
54
|
+
name: model !== "unknown" || !(client && hasSpanStreamingEnabled(client)) ? `${operation} ${model}` : operation,
|
|
55
|
+
op: getGenAiSpanOp(operation),
|
|
56
|
+
attributes
|
|
57
|
+
});
|
|
58
|
+
if (recordInputs && params) {
|
|
59
|
+
addRequestAttributes(span, params, operation);
|
|
60
|
+
}
|
|
61
|
+
return span;
|
|
62
|
+
}
|
|
63
|
+
function isAsyncIterable(value) {
|
|
64
|
+
return !!value && typeof value[Symbol.asyncIterator] === "function";
|
|
65
|
+
}
|
|
66
|
+
function wrapStreamResult(span, data, options) {
|
|
67
|
+
const result = data.result;
|
|
68
|
+
if (!isAsyncIterable(result)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const { recordOutputs } = resolveAIRecordingOptions(options);
|
|
72
|
+
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
73
|
+
const instrumented = instrumentStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs ?? false);
|
|
74
|
+
result[Symbol.asyncIterator] = () => instrumented;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { createOpenAiCompatibleIntegration };
|
|
79
|
+
//# sourceMappingURL=openai-compatible.js.map
|