@sentry/server-utils 10.61.0 → 10.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +6 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/fastify/errors.js +42 -0
- package/build/cjs/integrations/tracing-channel/fastify/errors.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/index.js +34 -0
- package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +279 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/utils.js +11 -0
- package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/lru-memoizer.js +31 -0
- package/build/cjs/integrations/tracing-channel/lru-memoizer.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mysql.js +44 -82
- package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +2 -1
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config.js +6 -0
- package/build/cjs/orchestrion/config.js.map +1 -1
- package/build/cjs/orchestrion/index.js +2 -0
- package/build/cjs/orchestrion/index.js.map +1 -1
- package/build/cjs/tracing-channel.js +50 -11
- package/build/cjs/tracing-channel.js.map +1 -1
- package/build/cjs/vercel-ai/index.js +23 -0
- package/build/cjs/vercel-ai/index.js.map +1 -0
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +362 -0
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -0
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing-channel/fastify/errors.js +39 -0
- package/build/esm/integrations/tracing-channel/fastify/errors.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/index.js +30 -0
- package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +277 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/utils.js +8 -0
- package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -0
- package/build/esm/integrations/tracing-channel/lru-memoizer.js +29 -0
- package/build/esm/integrations/tracing-channel/lru-memoizer.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mysql.js +45 -83
- package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/esm/orchestrion/channels.js +2 -1
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config.js +6 -0
- package/build/esm/orchestrion/config.js.map +1 -1
- package/build/esm/orchestrion/index.js +1 -0
- package/build/esm/orchestrion/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/tracing-channel.js +51 -12
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/vercel-ai/index.js +21 -0
- package/build/esm/vercel-ai/index.js.map +1 -0
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +357 -0
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/fastify/errors.d.ts +12 -0
- package/build/types/integrations/tracing-channel/fastify/errors.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/index.d.ts +66 -0
- package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/types.d.ts +32 -0
- package/build/types/integrations/tracing-channel/fastify/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts +9 -0
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
- package/build/types/integrations/tracing-channel/lru-memoizer.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mysql.d.ts +3 -1
- package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +1 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config.d.ts.map +1 -1
- package/build/types/orchestrion/index.d.ts +1 -0
- package/build/types/orchestrion/index.d.ts.map +1 -1
- package/build/types/tracing-channel.d.ts +22 -0
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/build/types/vercel-ai/index.d.ts +27 -0
- package/build/types/vercel-ai/index.d.ts.map +1 -0
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +62 -0
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -0
- package/build/types-ts3.8/index.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/errors.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +66 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/types.d.ts +32 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/mysql.d.ts +3 -1
- package/build/types-ts3.8/node-diagnostics-channel.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/channels.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/index.d.ts +1 -0
- package/build/types-ts3.8/tracing-channel.d.ts +22 -0
- package/build/types-ts3.8/vercel-ai/index.d.ts +27 -0
- package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +62 -0
- package/package.json +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FastifyReply, FastifyRequest } from './types';
|
|
2
|
+
export declare const INTEGRATION_NAME = "Fastify";
|
|
3
|
+
/**
|
|
4
|
+
* Default function to determine if an error should be sent to Sentry
|
|
5
|
+
*
|
|
6
|
+
* 3xx and 4xx errors are not sent by default.
|
|
7
|
+
*/
|
|
8
|
+
export declare function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean;
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EXPERIMENTAL — orchestrion-driven lru-memoizer integration. Subscribes to
|
|
3
|
+
* `orchestrion:lru-memoizer:load` (injected into `lru-memoizer/lib/async.js`'s
|
|
4
|
+
* `memoizedFunction`). Creates no spans; only re-runs the memoized callback with the
|
|
5
|
+
* caller's scope. Requires the orchestrion runtime hook or bundler plugin.
|
|
6
|
+
*/
|
|
7
|
+
export declare const lruMemoizerChannelIntegration: () => import("@sentry/core").Integration & {
|
|
8
|
+
name: "LruMemoizer";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=lru-memoizer.d.ts.map
|
|
@@ -6,5 +6,7 @@
|
|
|
6
6
|
* `Connection.prototype.query`. Requires the orchestrion runtime hook or
|
|
7
7
|
* bundler plugin to be active — wire that up via `_experimentalSetupOrchestrion`.
|
|
8
8
|
*/
|
|
9
|
-
export declare const mysqlChannelIntegration: () => import("@sentry/core").Integration
|
|
9
|
+
export declare const mysqlChannelIntegration: () => import("@sentry/core").Integration & {
|
|
10
|
+
name: "Mysql";
|
|
11
|
+
};
|
|
10
12
|
//# sourceMappingURL=mysql.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient shim for `node:diagnostics_channel`, injected into the TS 3.8 type output only
|
|
3
|
+
* (see `scripts/inject-ts38-shims.mjs`).
|
|
4
|
+
*
|
|
5
|
+
* `@types/node@14` — used by the SDK's TS 3.8 compatibility check — predates this module, so the
|
|
6
|
+
* published declarations that re-export `TracingChannel`/`TracingChannelSubscribers` fail to resolve
|
|
7
|
+
* it (`TS2307`). The real shapes are irrelevant here: TS 3.8 consumers only need these to type-check,
|
|
8
|
+
* never to call. This file is deliberately kept out of `src/` so it never participates in the modern
|
|
9
|
+
* build, where `@types/node` already declares the module.
|
|
10
|
+
*/
|
|
11
|
+
declare module 'node:diagnostics_channel' {
|
|
12
|
+
export interface TracingChannelSubscribers<ContextType = unknown> {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface TracingChannel<StoreType = unknown, ContextType = unknown> {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const CHANNELS: {
|
|
15
15
|
readonly MYSQL_QUERY: "orchestrion:mysql:query";
|
|
16
|
+
readonly LRU_MEMOIZER_LOAD: "orchestrion:lru-memoizer:load";
|
|
16
17
|
};
|
|
17
18
|
export type ChannelName = (typeof CHANNELS)[keyof typeof CHANNELS];
|
|
18
19
|
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';
|
|
2
2
|
import { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';
|
|
3
3
|
export type TracingChannelPayloadWithSpan<TData extends object> = TData & {
|
|
4
|
+
/**
|
|
5
|
+
* The current active span for the traced call.
|
|
6
|
+
*/
|
|
4
7
|
_sentrySpan?: Span;
|
|
8
|
+
/**
|
|
9
|
+
* The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.
|
|
10
|
+
*/
|
|
11
|
+
_sentryCallerStore?: unknown;
|
|
5
12
|
};
|
|
6
13
|
export interface SentryTracingChannel<TData extends object = object> extends Pick<TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>, Exclude<keyof TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>, 'subscribe' | 'unsubscribe'>> {
|
|
7
14
|
subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;
|
|
@@ -20,6 +27,21 @@ export interface TracingChannelLifeCycleOptions<TData extends object = object> {
|
|
|
20
27
|
* For database drivers, it is not recommended to set this at all.
|
|
21
28
|
*/
|
|
22
29
|
captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);
|
|
30
|
+
/**
|
|
31
|
+
* Take ownership of *when* the span ends: return `true` and the helper won't end it on
|
|
32
|
+
* `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that
|
|
33
|
+
* completes via its own `'end'`/`'error'` events.
|
|
34
|
+
*
|
|
35
|
+
* Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span
|
|
36
|
+
* ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`
|
|
37
|
+
* lets the helper end the span as usual.
|
|
38
|
+
*/
|
|
39
|
+
deferSpanEnd?: (args: {
|
|
40
|
+
span: Span;
|
|
41
|
+
data: TracingChannelPayloadWithSpan<TData>;
|
|
42
|
+
/** Ends the span: `end()` on success, `end(error)` on failure. Idempotent. */
|
|
43
|
+
end: (error?: unknown) => void;
|
|
44
|
+
}) => boolean;
|
|
23
45
|
}
|
|
24
46
|
/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */
|
|
25
47
|
export interface TracingChannelBindingHandle<TData extends object = object> {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type VercelAiOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true`
|
|
4
|
+
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
|
|
5
|
+
* Integration-level options take precedence over global `dataCollection` config.
|
|
6
|
+
*/
|
|
7
|
+
recordInputs?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Enable or disable output recording. Enabled if `dataCollection.genAI.outputs` (or the deprecated `sendDefaultPii` option) is `true`
|
|
10
|
+
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
|
|
11
|
+
* Integration-level options take precedence over global `dataCollection` config.
|
|
12
|
+
*/
|
|
13
|
+
recordOutputs?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Enable or disable truncation of recorded input messages.
|
|
16
|
+
* Defaults to `true`.
|
|
17
|
+
*/
|
|
18
|
+
enableTruncation?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Auto-instrument the `ai` SDK's native telemetry tracing channel (ai >= 7).
|
|
22
|
+
*/
|
|
23
|
+
export declare const vercelAiIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
|
|
24
|
+
name: "VercelAI";
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Span } from '@sentry/core';
|
|
2
|
+
import { TracingChannel } from 'node:diagnostics_channel';
|
|
3
|
+
/** Drop the per-operation `callId` maps once the owning top-level operation settles (success or error). */
|
|
4
|
+
export declare function clearOperationId(data: VercelAiChannelMessage): void;
|
|
5
|
+
/** The lifecycle event types the `ai:telemetry` channel can carry. */
|
|
6
|
+
export type ChannelEventType = 'generateText' | 'streamText' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'rerank';
|
|
7
|
+
/**
|
|
8
|
+
* The context object the AI SDK passes through one tracing-channel call. It is the same object
|
|
9
|
+
* identity across `start`/`end`/`asyncEnd`/`error`, and Node's `tracingChannel` attaches
|
|
10
|
+
* `result`/`error` to it as the traced promise settles.
|
|
11
|
+
*/
|
|
12
|
+
export interface VercelAiChannelMessage {
|
|
13
|
+
type: ChannelEventType;
|
|
14
|
+
event: Record<string, unknown>;
|
|
15
|
+
result?: unknown;
|
|
16
|
+
error?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Platform-provided factory that returns a tracing channel for the given channel name. The factory
|
|
20
|
+
* is responsible for, when `start` fires, calling `transformStart(data)` and storing the returned
|
|
21
|
+
* span on `data._sentrySpan` so the subscriber's `asyncEnd`/`error` handlers can read it.
|
|
22
|
+
*
|
|
23
|
+
* Node passes `@sentry/opentelemetry/tracing-channel`, which uses `bindStore` to additionally make
|
|
24
|
+
* the span the active OTel context for the duration of the traced operation. That is what makes
|
|
25
|
+
* nested AI SDK operations (model calls, tool calls) become children of the enclosing span without
|
|
26
|
+
* any manual parent bookkeeping here.
|
|
27
|
+
*/
|
|
28
|
+
type VercelAiTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;
|
|
29
|
+
/** Integration-level recording options, pinned at subscribe time so we never look the integration up per event. */
|
|
30
|
+
interface VercelAiChannelOptions {
|
|
31
|
+
recordInputs?: boolean;
|
|
32
|
+
recordOutputs?: boolean;
|
|
33
|
+
enableTruncation?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Subscribe Sentry span handlers to the `ai` SDK's native telemetry tracing channel (`ai:telemetry`,
|
|
37
|
+
* available in `ai` >= 7) and emit fully-formed `gen_ai.*` spans directly — no OpenTelemetry span
|
|
38
|
+
* post-processing involved.
|
|
39
|
+
*
|
|
40
|
+
* The integration passes its options in directly (rather than us looking the integration up on every
|
|
41
|
+
* event); the global `dataCollection.genAI` default is still read from the client per event.
|
|
42
|
+
*
|
|
43
|
+
* Safe to always call: on `ai` versions that don't publish to the channel (e.g. < 7) nothing is
|
|
44
|
+
* ever emitted and this is inert, so there is no double-instrumentation against the OTel-based
|
|
45
|
+
* patcher. Idempotent.
|
|
46
|
+
*/
|
|
47
|
+
export declare function subscribeVercelAiTracingChannel(tracingChannel: VercelAiTracingChannelFactory, options?: VercelAiChannelOptions): void;
|
|
48
|
+
/**
|
|
49
|
+
* Transform a channel `start` payload into the span that should be active for the operation. For
|
|
50
|
+
* `step` we deliberately don't open a span (model calls and tool calls are siblings under the
|
|
51
|
+
* invoke_agent span, matching the OTel-based output), so we reuse the active span and mark the
|
|
52
|
+
* payload to skip ending it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createSpanFromMessage(data: VercelAiChannelMessage, channelOptions: VercelAiChannelOptions): Span | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Best-effort enrichment from the resolved value the AI SDK attaches to the channel context.
|
|
57
|
+
* Everything here is guarded: when a field is missing or the shape differs across `ai` versions,
|
|
58
|
+
* we simply don't set the attribute rather than emit a malformed span.
|
|
59
|
+
*/
|
|
60
|
+
export declare function enrichSpanOnEnd(span: Span, data: VercelAiChannelMessage, channelOptions: VercelAiChannelOptions): void;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=vercel-ai-dc-subscriber.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/server-utils",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.63.0",
|
|
4
4
|
"description": "Server Utilities for all Sentry JavaScript SDKs",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/server-utils",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@apm-js-collab/code-transformer": "^0.15.0",
|
|
87
87
|
"@apm-js-collab/tracing-hooks": "^0.10.0",
|
|
88
88
|
"@sentry/conventions": "^0.12.0",
|
|
89
|
-
"@sentry/core": "10.
|
|
89
|
+
"@sentry/core": "10.63.0",
|
|
90
90
|
"magic-string": "~0.30.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"build:transpile": "rollup -c rollup.npm.config.mjs",
|
|
100
100
|
"build:types": "run-s build:types:core build:types:downlevel",
|
|
101
101
|
"build:types:core": "tsc -p tsconfig.types.json",
|
|
102
|
-
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
|
|
102
|
+
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8 && node scripts/inject-ts38-shims.mjs",
|
|
103
103
|
"build:watch": "run-p build:transpile:watch",
|
|
104
104
|
"build:dev:watch": "run-p build:transpile:watch",
|
|
105
105
|
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
|