@sentry/server-utils 10.62.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 -2
- 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 +45 -83
- 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 +5 -3
- package/build/cjs/vercel-ai/index.js.map +1 -1
- package/build/esm/index.js +1 -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 +46 -84
- 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 +6 -4
- package/build/esm/vercel-ai/index.js.map +1 -1
- package/build/types/index.d.ts +1 -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 +3 -1
- package/build/types/vercel-ai/index.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -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 +3 -1
- package/package.json +3 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FastifyReply, FastifyRequest } from './types';
|
|
2
|
+
import { handleFastifyError as _handleFastifyError } from './errors';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the Fastify integration.
|
|
5
|
+
*
|
|
6
|
+
* `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry
|
|
7
|
+
* This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
|
|
8
|
+
* Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```javascript
|
|
13
|
+
* Sentry.init({
|
|
14
|
+
* integrations: [
|
|
15
|
+
* Sentry.fastifyIntegration({
|
|
16
|
+
* shouldHandleError(_error, _request, reply) {
|
|
17
|
+
* return reply.statusCode >= 500;
|
|
18
|
+
* },
|
|
19
|
+
* });
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
interface FastifyIntegrationOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Callback method deciding whether error should be captured and sent to Sentry
|
|
28
|
+
* This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
|
|
29
|
+
* Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
|
|
30
|
+
*
|
|
31
|
+
* @param error Captured Fastify error
|
|
32
|
+
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
33
|
+
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
34
|
+
*/
|
|
35
|
+
shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).
|
|
39
|
+
* This integration supports Fastify v5 only.
|
|
40
|
+
*
|
|
41
|
+
* For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```javascript
|
|
45
|
+
* const Sentry = require('@sentry/node');
|
|
46
|
+
*
|
|
47
|
+
* Sentry.init({
|
|
48
|
+
* integrations: [Sentry.fastifyIntegration()],
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const fastifyIntegration: (options?: Partial<FastifyIntegrationOptions> | undefined) => import("@sentry/core").Integration & {
|
|
53
|
+
name: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated This export is deprecated and will not longer be exposed in the next major version.
|
|
57
|
+
*/
|
|
58
|
+
export declare const instrumentFastify: (() => void) & {
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated This export is deprecated and will not longer be exposed in the next major version.
|
|
63
|
+
*/
|
|
64
|
+
export declare const handleFastifyError: typeof _handleFastifyError;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set up the Fastify (>= 3.21.0 < 6) instrumentation by subscribing to the `fastify.initialization`
|
|
3
|
+
* diagnostics channel and registering the span-creating plugin on every Fastify instance.
|
|
4
|
+
*
|
|
5
|
+
* Idempotent and exposes an `id` so it can participate in the OpenTelemetry preload list.
|
|
6
|
+
*/
|
|
7
|
+
export declare const instrumentFastify: (() => void) & {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Integration } from '@sentry/core';
|
|
2
|
+
type HandlerOriginal = ((request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => Promise<void>) | ((request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => void);
|
|
3
|
+
type FastifyError = any;
|
|
4
|
+
type HookHandlerDoneFunction = <TError extends Error = FastifyError>(err?: TError) => void;
|
|
5
|
+
export interface FastifyInstance {
|
|
6
|
+
version: string;
|
|
7
|
+
register: (plugin: any) => FastifyInstance;
|
|
8
|
+
decorate: (key: string | symbol, value: unknown) => void;
|
|
9
|
+
decorateRequest: (key: string | symbol, value: unknown) => void;
|
|
10
|
+
setNotFoundHandler: (hooks: any, handler?: any) => void;
|
|
11
|
+
after: (listener?: (err: Error) => void) => FastifyInstance;
|
|
12
|
+
addHook(hook: string, handler: HandlerOriginal): FastifyInstance;
|
|
13
|
+
addHook(hook: 'onError', handler: (request: FastifyRequest, reply: FastifyReply, error: Error) => void): FastifyInstance;
|
|
14
|
+
addHook(hook: 'onRequest', handler: (request: FastifyRequest, reply: FastifyReply) => void): FastifyInstance;
|
|
15
|
+
}
|
|
16
|
+
export interface FastifyReply {
|
|
17
|
+
send: () => FastifyReply;
|
|
18
|
+
statusCode: number;
|
|
19
|
+
}
|
|
20
|
+
export interface FastifyRequest {
|
|
21
|
+
method?: string;
|
|
22
|
+
routeOptions?: {
|
|
23
|
+
url?: string;
|
|
24
|
+
};
|
|
25
|
+
routerPath?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface FastifyIntegration extends Integration {
|
|
28
|
+
getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
|
|
29
|
+
setShouldHandleError: (shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) => void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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> {
|
|
@@ -20,6 +20,8 @@ type VercelAiOptions = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Auto-instrument the `ai` SDK's native telemetry tracing channel (ai >= 7).
|
|
22
22
|
*/
|
|
23
|
-
export declare const vercelAiIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration
|
|
23
|
+
export declare const vercelAiIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
|
|
24
|
+
name: "VercelAI";
|
|
25
|
+
};
|
|
24
26
|
export {};
|
|
25
27
|
//# sourceMappingURL=index.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",
|