@sentry/node 9.39.0 → 9.41.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 +9 -7
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing/express-v5/utils.js +1 -1
- package/build/cjs/integrations/tracing/express-v5/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/express.js +1 -1
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +58 -12
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +3 -0
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa.js +1 -1
- package/build/cjs/integrations/tracing/koa.js.map +1 -1
- package/build/cjs/integrations/tracing/openai/index.js +79 -0
- package/build/cjs/integrations/tracing/openai/index.js.map +1 -0
- package/build/cjs/integrations/tracing/openai/instrumentation.js +81 -0
- package/build/cjs/integrations/tracing/openai/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/postgresjs.js +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js +15 -2
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/cjs/sdk/initOtel.js +5 -5
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/cjs/utils/redisCache.js +2 -2
- package/build/cjs/utils/redisCache.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing/express-v5/utils.js +1 -1
- package/build/esm/integrations/tracing/express-v5/utils.js.map +1 -1
- package/build/esm/integrations/tracing/express.js +2 -2
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js +59 -13
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js +2 -2
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +3 -0
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa.js +2 -2
- package/build/esm/integrations/tracing/koa.js.map +1 -1
- package/build/esm/integrations/tracing/openai/index.js +76 -0
- package/build/esm/integrations/tracing/openai/index.js.map +1 -0
- package/build/esm/integrations/tracing/openai/instrumentation.js +79 -0
- package/build/esm/integrations/tracing/openai/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/postgresjs.js +2 -2
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/instrumentation.js +16 -3
- package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/initOtel.js +9 -9
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/esm/utils/redisCache.js +2 -2
- package/build/esm/utils/redisCache.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/fastify/index.d.ts +38 -2
- package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/openai/index.d.ts +60 -0
- package/build/types/integrations/tracing/openai/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/openai/instrumentation.d.ts +20 -0
- package/build/types/integrations/tracing/openai/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/vercelai/instrumentation.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +38 -2
- package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +60 -0
- package/build/types-ts3.8/integrations/tracing/openai/instrumentation.d.ts +20 -0
- package/package.json +4 -4
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
2
|
import { FastifyInstance, FastifyReply, FastifyRequest } from './types';
|
|
3
3
|
import { FastifyInstrumentationV3 } from './v3/instrumentation';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Fastify integration.
|
|
6
|
+
*
|
|
7
|
+
* `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry
|
|
8
|
+
* This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
|
|
9
|
+
* Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```javascript
|
|
14
|
+
* Sentry.init({
|
|
15
|
+
* integrations: [
|
|
16
|
+
* Sentry.fastifyIntegration({
|
|
17
|
+
* shouldHandleError(_error, _request, reply) {
|
|
18
|
+
* return reply.statusCode >= 500;
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
* },
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
interface FastifyIntegrationOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Callback method deciding whether error should be captured and sent to Sentry
|
|
29
|
+
* This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
|
|
30
|
+
* Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
|
|
31
|
+
*
|
|
32
|
+
* @param error Captured Fastify error
|
|
33
|
+
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
34
|
+
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
35
|
+
*/
|
|
36
|
+
shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
|
|
37
|
+
}
|
|
4
38
|
interface FastifyHandlerOptions {
|
|
5
39
|
/**
|
|
6
40
|
* Callback method deciding whether error should be captured and sent to Sentry
|
|
@@ -11,6 +45,7 @@ interface FastifyHandlerOptions {
|
|
|
11
45
|
*
|
|
12
46
|
* @example
|
|
13
47
|
*
|
|
48
|
+
*
|
|
14
49
|
* ```javascript
|
|
15
50
|
* setupFastifyErrorHandler(app, {
|
|
16
51
|
* shouldHandleError(_error, _request, reply) {
|
|
@@ -19,6 +54,7 @@ interface FastifyHandlerOptions {
|
|
|
19
54
|
* });
|
|
20
55
|
* ```
|
|
21
56
|
*
|
|
57
|
+
*
|
|
22
58
|
* If using TypeScript, you can cast the request and reply to get full type safety.
|
|
23
59
|
*
|
|
24
60
|
* ```typescript
|
|
@@ -38,7 +74,7 @@ interface FastifyHandlerOptions {
|
|
|
38
74
|
export declare const instrumentFastifyV3: ((options?: unknown) => FastifyInstrumentationV3) & {
|
|
39
75
|
id: string;
|
|
40
76
|
};
|
|
41
|
-
export declare const instrumentFastify: ((options?: unknown) => Instrumentation<InstrumentationConfig &
|
|
77
|
+
export declare const instrumentFastify: ((options?: unknown) => Instrumentation<InstrumentationConfig & FastifyIntegrationOptions>) & {
|
|
42
78
|
id: string;
|
|
43
79
|
};
|
|
44
80
|
/**
|
|
@@ -57,7 +93,7 @@ export declare const instrumentFastify: ((options?: unknown) => Instrumentation<
|
|
|
57
93
|
* })
|
|
58
94
|
* ```
|
|
59
95
|
*/
|
|
60
|
-
export declare const fastifyIntegration: () => import("@sentry/core").Integration;
|
|
96
|
+
export declare const fastifyIntegration: (options?: Partial<FastifyIntegrationOptions> | undefined) => import("@sentry/core").Integration;
|
|
61
97
|
/**
|
|
62
98
|
* Add an Fastify error handler to capture errors to Sentry.
|
|
63
99
|
*
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { OpenAiOptions } from '@sentry/core';
|
|
2
|
+
import { SentryOpenAiInstrumentation } from './instrumentation';
|
|
3
|
+
export declare const instrumentOpenAi: ((options?: unknown) => SentryOpenAiInstrumentation) & {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Adds Sentry tracing instrumentation for the OpenAI SDK.
|
|
8
|
+
*
|
|
9
|
+
* This integration is enabled by default.
|
|
10
|
+
*
|
|
11
|
+
* When configured, this integration automatically instruments OpenAI SDK client instances
|
|
12
|
+
* to capture telemetry data following OpenTelemetry Semantic Conventions for Generative AI.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* import * as Sentry from '@sentry/node';
|
|
17
|
+
*
|
|
18
|
+
* Sentry.init({
|
|
19
|
+
* integrations: [Sentry.openAIIntegration()],
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* ## Options
|
|
24
|
+
*
|
|
25
|
+
* - `recordInputs`: Whether to record prompt messages (default: respects `sendDefaultPii` client option)
|
|
26
|
+
* - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)
|
|
27
|
+
*
|
|
28
|
+
* ### Default Behavior
|
|
29
|
+
*
|
|
30
|
+
* By default, the integration will:
|
|
31
|
+
* - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options
|
|
32
|
+
* - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* // Record inputs and outputs when sendDefaultPii is false
|
|
37
|
+
* Sentry.init({
|
|
38
|
+
* integrations: [
|
|
39
|
+
* Sentry.openAIIntegration({
|
|
40
|
+
* recordInputs: true,
|
|
41
|
+
* recordOutputs: true
|
|
42
|
+
* })
|
|
43
|
+
* ],
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Never record inputs/outputs regardless of sendDefaultPii
|
|
47
|
+
* Sentry.init({
|
|
48
|
+
* sendDefaultPii: true,
|
|
49
|
+
* integrations: [
|
|
50
|
+
* Sentry.openAIIntegration({
|
|
51
|
+
* recordInputs: false,
|
|
52
|
+
* recordOutputs: false
|
|
53
|
+
* })
|
|
54
|
+
* ],
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
export declare const openAIIntegration: (options?: OpenAiOptions | undefined) => import("@sentry/core").Integration;
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InstrumentationConfig, InstrumentationModuleDefinition, InstrumentationBase } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { Integration, OpenAiOptions } from '@sentry/core';
|
|
3
|
+
export interface OpenAiIntegration extends Integration {
|
|
4
|
+
options: OpenAiOptions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Sentry OpenAI instrumentation using OpenTelemetry.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SentryOpenAiInstrumentation extends InstrumentationBase<InstrumentationConfig> {
|
|
10
|
+
constructor(config?: InstrumentationConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Initializes the instrumentation by defining the modules to be patched.
|
|
13
|
+
*/
|
|
14
|
+
init(): InstrumentationModuleDefinition;
|
|
15
|
+
/**
|
|
16
|
+
* Core patch logic applying instrumentation to the OpenAI client constructor.
|
|
17
|
+
*/
|
|
18
|
+
private _patch;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/node",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.41.0",
|
|
4
4
|
"description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
96
96
|
"@opentelemetry/semantic-conventions": "^1.34.0",
|
|
97
97
|
"@prisma/instrumentation": "6.11.1",
|
|
98
|
-
"@sentry/core": "9.
|
|
99
|
-
"@sentry/node-core": "9.
|
|
100
|
-
"@sentry/opentelemetry": "9.
|
|
98
|
+
"@sentry/core": "9.41.0",
|
|
99
|
+
"@sentry/node-core": "9.41.0",
|
|
100
|
+
"@sentry/opentelemetry": "9.41.0",
|
|
101
101
|
"import-in-the-middle": "^1.14.2",
|
|
102
102
|
"minimatch": "^9.0.0"
|
|
103
103
|
},
|