@sentry/node 10.55.0 → 10.56.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/integrations/node-fetch/vendored/undici.js +2 -3
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/cjs/integrations/tracing/InstrumentationNodeModuleFile.js +15 -0
- package/build/cjs/integrations/tracing/InstrumentationNodeModuleFile.js.map +1 -0
- package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js +9 -9
- package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/anthropic-ai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js +3 -5
- package/build/cjs/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/express.js +3 -5
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +10 -11
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js +3 -4
- package/build/cjs/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +2 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +2 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js +2 -1
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js +4 -3
- package/build/cjs/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js +2 -5
- package/build/cjs/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +3 -2
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js +3 -4
- package/build/cjs/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/langchain/instrumentation.js +3 -2
- package/build/cjs/integrations/tracing/langchain/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/langgraph/index.js.map +1 -1
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js +7 -5
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js +7 -6
- package/build/cjs/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +3 -2
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/openai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +5 -5
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js +2 -1
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/index.js +3 -2
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +4 -3
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js +6 -5
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/cjs/utils/setHttpServerSpanRouteAttribute.js +21 -0
- package/build/cjs/utils/setHttpServerSpanRouteAttribute.js.map +1 -0
- package/build/esm/integrations/node-fetch/vendored/undici.js +3 -4
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/esm/integrations/tracing/InstrumentationNodeModuleFile.js +13 -0
- package/build/esm/integrations/tracing/InstrumentationNodeModuleFile.js.map +1 -0
- package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js +7 -7
- package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/anthropic-ai/index.js.map +1 -1
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js +3 -5
- package/build/esm/integrations/tracing/connect/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/express.js +3 -5
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +3 -4
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js +3 -4
- package/build/esm/integrations/tracing/fastify/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +2 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +2 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
- package/build/esm/integrations/tracing/google-genai/instrumentation.js +2 -1
- package/build/esm/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js +2 -1
- package/build/esm/integrations/tracing/graphql/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js +2 -5
- package/build/esm/integrations/tracing/hapi/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +2 -1
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js +3 -4
- package/build/esm/integrations/tracing/koa/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/langchain/instrumentation.js +2 -1
- package/build/esm/integrations/tracing/langchain/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/langgraph/index.js.map +1 -1
- package/build/esm/integrations/tracing/langgraph/instrumentation.js +5 -3
- package/build/esm/integrations/tracing/langgraph/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js +2 -1
- package/build/esm/integrations/tracing/mongo/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +2 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/openai/index.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +5 -5
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgresjs.js +2 -1
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/redis/index.js +3 -2
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +2 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/instrumentation.js +6 -5
- package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/utils/setHttpServerSpanRouteAttribute.js +19 -0
- package/build/esm/utils/setHttpServerSpanRouteAttribute.js.map +1 -0
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
- package/build/types/integrations/tracing/InstrumentationNodeModuleFile.d.ts +9 -0
- package/build/types/integrations/tracing/InstrumentationNodeModuleFile.d.ts.map +1 -0
- package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +1 -1
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts +2 -2
- package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/anthropic-ai/index.d.ts +7 -7
- package/build/types/integrations/tracing/connect/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/express.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts.map +1 -1
- package/build/types/integrations/tracing/google-genai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/graphql/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/langchain/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts +7 -7
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/openai/index.d.ts +7 -7
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/index.d.ts +4 -1
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/instrumentation.d.ts +2 -2
- package/build/types/integrations/tracing/vercelai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/types.d.ts +6 -4
- package/build/types/integrations/tracing/vercelai/types.d.ts.map +1 -1
- package/build/types/utils/setHttpServerSpanRouteAttribute.d.ts +9 -0
- package/build/types/utils/setHttpServerSpanRouteAttribute.d.ts.map +1 -0
- package/build/types-ts3.8/integrations/tracing/InstrumentationNodeModuleFile.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing/amqplib/vendored/utils.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +7 -7
- package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +7 -7
- package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +7 -7
- package/build/types-ts3.8/integrations/tracing/redis/index.d.ts +4 -1
- package/build/types-ts3.8/integrations/tracing/vercelai/instrumentation.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing/vercelai/types.d.ts +6 -4
- package/build/types-ts3.8/utils/setHttpServerSpanRouteAttribute.d.ts +9 -0
- package/package.json +5 -4
- package/build/cjs/integrations/tracing/redis/redis-dc-subscriber.js +0 -151
- package/build/cjs/integrations/tracing/redis/redis-dc-subscriber.js.map +0 -1
- package/build/esm/integrations/tracing/redis/redis-dc-subscriber.js +0 -149
- package/build/esm/integrations/tracing/redis/redis-dc-subscriber.js.map +0 -1
- package/build/types/integrations/tracing/redis/redis-dc-subscriber.d.ts +0 -17
- package/build/types/integrations/tracing/redis/redis-dc-subscriber.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/tracing/redis/redis-dc-subscriber.d.ts +0 -17
|
@@ -21,18 +21,18 @@ export declare const instrumentLangGraph: ((options?: LangGraphOptions | undefin
|
|
|
21
21
|
*
|
|
22
22
|
* ## Options
|
|
23
23
|
*
|
|
24
|
-
* - `recordInputs`: Whether to record
|
|
25
|
-
* - `recordOutputs`: Whether to record response text (default:
|
|
24
|
+
* - `recordInputs`: Whether to record prompt messages (default: follows `sendDefaultPii` or `dataCollection.genAI.inputs`)
|
|
25
|
+
* - `recordOutputs`: Whether to record response text (default: follows `sendDefaultPii` or `dataCollection.genAI.outputs`)
|
|
26
26
|
*
|
|
27
27
|
* ### Default Behavior
|
|
28
28
|
*
|
|
29
29
|
* By default, the integration will:
|
|
30
|
-
* - Record inputs and outputs
|
|
31
|
-
* -
|
|
30
|
+
* - Record inputs and outputs based on `sendDefaultPii` or `dataCollection.genAI` in your Sentry client options
|
|
31
|
+
* - Integration-level `recordInputs`/`recordOutputs` options take precedence over global config
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```javascript
|
|
35
|
-
* //
|
|
35
|
+
* // Always record inputs and outputs regardless of global dataCollection config
|
|
36
36
|
* Sentry.init({
|
|
37
37
|
* integrations: [
|
|
38
38
|
* Sentry.langGraphIntegration({
|
|
@@ -42,9 +42,9 @@ export declare const instrumentLangGraph: ((options?: LangGraphOptions | undefin
|
|
|
42
42
|
* ],
|
|
43
43
|
* });
|
|
44
44
|
*
|
|
45
|
-
* // Never record inputs/outputs regardless of
|
|
45
|
+
* // Never record inputs/outputs regardless of global dataCollection config
|
|
46
46
|
* Sentry.init({
|
|
47
|
-
*
|
|
47
|
+
* dataCollection: { genAI: { inputs: true, outputs: true } },
|
|
48
48
|
* integrations: [
|
|
49
49
|
* Sentry.langGraphIntegration({
|
|
50
50
|
* recordInputs: false,
|
|
@@ -21,18 +21,18 @@ export declare const instrumentOpenAi: ((options?: OpenAiOptions | undefined) =>
|
|
|
21
21
|
*
|
|
22
22
|
* ## Options
|
|
23
23
|
*
|
|
24
|
-
* - `recordInputs`: Whether to record prompt messages (default:
|
|
25
|
-
* - `recordOutputs`: Whether to record response text (default:
|
|
24
|
+
* - `recordInputs`: Whether to record prompt messages (default: follows `sendDefaultPii` or `dataCollection.genAI.inputs`)
|
|
25
|
+
* - `recordOutputs`: Whether to record response text (default: follows `sendDefaultPii` or `dataCollection.genAI.outputs`)
|
|
26
26
|
*
|
|
27
27
|
* ### Default Behavior
|
|
28
28
|
*
|
|
29
29
|
* By default, the integration will:
|
|
30
|
-
* - Record inputs and outputs
|
|
31
|
-
* -
|
|
30
|
+
* - Record inputs and outputs based on `sendDefaultPii` or `dataCollection.genAI` in your Sentry client options
|
|
31
|
+
* - Integration-level `recordInputs`/`recordOutputs` options take precedence over global config
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```javascript
|
|
35
|
-
* //
|
|
35
|
+
* // Always record inputs and outputs regardless of global dataCollection config
|
|
36
36
|
* Sentry.init({
|
|
37
37
|
* integrations: [
|
|
38
38
|
* Sentry.openAIIntegration({
|
|
@@ -42,9 +42,9 @@ export declare const instrumentOpenAi: ((options?: OpenAiOptions | undefined) =>
|
|
|
42
42
|
* ],
|
|
43
43
|
* });
|
|
44
44
|
*
|
|
45
|
-
* // Never record inputs/outputs regardless of
|
|
45
|
+
* // Never record inputs/outputs regardless of global dataCollection config
|
|
46
46
|
* Sentry.init({
|
|
47
|
-
*
|
|
47
|
+
* dataCollection: { genAI: { inputs: true, outputs: true } },
|
|
48
48
|
* integrations: [
|
|
49
49
|
* Sentry.openAIIntegration({
|
|
50
50
|
* recordInputs: false,
|
|
@@ -17,7 +17,10 @@ interface RedisOptions {
|
|
|
17
17
|
}
|
|
18
18
|
export declare let _redisOptions: RedisOptions;
|
|
19
19
|
export declare const cacheResponseHook: IORedisResponseCustomAttributeFunction;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* To be able to preload all Redis OTel instrumentations with just one ID
|
|
22
|
+
* ("Redis"), all the instrumentations are generated in this one function
|
|
23
|
+
*/
|
|
21
24
|
export declare const instrumentRedis: (() => void) & {
|
|
22
25
|
id: string;
|
|
23
26
|
};
|
|
@@ -22,9 +22,9 @@ export declare function cleanupToolCallSpanContexts(content: Array<object>): voi
|
|
|
22
22
|
* 1. The vercel ai integration options
|
|
23
23
|
* 2. The experimental_telemetry options in the vercel ai method calls
|
|
24
24
|
* 3. When telemetry is explicitly enabled (isEnabled: true), default to recording
|
|
25
|
-
* 4. Otherwise, use the
|
|
25
|
+
* 4. Otherwise, use the dataCollection.genAI settings from client options
|
|
26
26
|
*/
|
|
27
|
-
export declare function determineRecordingSettings(integrationRecordingOptions: RecordingOptions | undefined, methodTelemetryOptions: RecordingOptions, telemetryExplicitlyEnabled: boolean | undefined,
|
|
27
|
+
export declare function determineRecordingSettings(integrationRecordingOptions: RecordingOptions | undefined, methodTelemetryOptions: RecordingOptions, telemetryExplicitlyEnabled: boolean | undefined, defaultInputsEnabled: boolean, defaultOutputsEnabled: boolean): {
|
|
28
28
|
recordInputs: boolean;
|
|
29
29
|
recordOutputs: boolean;
|
|
30
30
|
};
|
|
@@ -38,13 +38,15 @@ export type TelemetrySettings = {
|
|
|
38
38
|
export declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
|
39
39
|
export interface VercelAiOptions {
|
|
40
40
|
/**
|
|
41
|
-
* Enable or disable input recording. Enabled if `sendDefaultPii` is `true`
|
|
42
|
-
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings
|
|
41
|
+
* Enable or disable input recording. Enabled if `sendDefaultPii` or `dataCollection.genAI.inputs` is `true`
|
|
42
|
+
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
|
|
43
|
+
* Integration-level options take precedence over global `dataCollection` config.
|
|
43
44
|
*/
|
|
44
45
|
recordInputs?: boolean;
|
|
45
46
|
/**
|
|
46
|
-
* Enable or disable output recording. Enabled if `sendDefaultPii` is `true`
|
|
47
|
-
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings
|
|
47
|
+
* Enable or disable output recording. Enabled if `sendDefaultPii` or `dataCollection.genAI.outputs` is `true`
|
|
48
|
+
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
|
|
49
|
+
* Integration-level options take precedence over global `dataCollection` config.
|
|
48
50
|
*/
|
|
49
51
|
recordOutputs?: boolean;
|
|
50
52
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set the `http.route` attribute on the root HTTP server span for the current trace.
|
|
3
|
+
*
|
|
4
|
+
* No-op when there is no active span, no root span, or the root span is not an
|
|
5
|
+
* `http.server` span — so framework instrumentations can call this unconditionally
|
|
6
|
+
* without risking attribute pollution on non-HTTP root spans.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setHttpServerSpanRouteAttribute(route: string): void;
|
|
9
|
+
//# sourceMappingURL=setHttpServerSpanRouteAttribute.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/node",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.56.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",
|
|
@@ -70,9 +70,10 @@
|
|
|
70
70
|
"@opentelemetry/instrumentation": "^0.214.0",
|
|
71
71
|
"@opentelemetry/sdk-trace-base": "^2.6.1",
|
|
72
72
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
73
|
-
"@sentry/
|
|
74
|
-
"@sentry/
|
|
75
|
-
"@sentry/
|
|
73
|
+
"@sentry-internal/server-utils": "10.56.0",
|
|
74
|
+
"@sentry/core": "10.56.0",
|
|
75
|
+
"@sentry/node-core": "10.56.0",
|
|
76
|
+
"@sentry/opentelemetry": "10.56.0",
|
|
76
77
|
"import-in-the-middle": "^3.0.0"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const tracingChannel = require('@sentry/opentelemetry/tracing-channel');
|
|
5
|
-
const redisCommon = require('./vendored/redis-common.js');
|
|
6
|
-
const semconv = require('./vendored/semconv.js');
|
|
7
|
-
|
|
8
|
-
const CHANNEL_COMMAND = "node-redis:command";
|
|
9
|
-
const CHANNEL_BATCH = "node-redis:batch";
|
|
10
|
-
const CHANNEL_CONNECT = "node-redis:connect";
|
|
11
|
-
const ORIGIN = "auto.db.redis.diagnostic_channel";
|
|
12
|
-
const NOOP = () => {
|
|
13
|
-
};
|
|
14
|
-
let subscribed = false;
|
|
15
|
-
let currentResponseHook;
|
|
16
|
-
function subscribeRedisDiagnosticChannels(responseHook) {
|
|
17
|
-
currentResponseHook = responseHook;
|
|
18
|
-
if (subscribed) return;
|
|
19
|
-
try {
|
|
20
|
-
setupCommandChannel();
|
|
21
|
-
setupBatchChannel();
|
|
22
|
-
setupConnectChannel();
|
|
23
|
-
subscribed = true;
|
|
24
|
-
} catch {
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function setupCommandChannel() {
|
|
28
|
-
const channel = tracingChannel.tracingChannel(CHANNEL_COMMAND, (data) => {
|
|
29
|
-
const actualArgs = data.args.slice(1);
|
|
30
|
-
const statement = safeSerialize(data.command, actualArgs);
|
|
31
|
-
return core.startSpanManual(
|
|
32
|
-
{
|
|
33
|
-
name: `redis-${data.command}`,
|
|
34
|
-
attributes: {
|
|
35
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
36
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db.redis",
|
|
37
|
-
[semconv.ATTR_DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
38
|
-
...statement != null ? { [semconv.ATTR_DB_STATEMENT]: statement } : {},
|
|
39
|
-
...data.serverAddress != null ? { [semconv.ATTR_NET_PEER_NAME]: data.serverAddress } : {},
|
|
40
|
-
...data.serverPort != null ? { [semconv.ATTR_NET_PEER_PORT]: data.serverPort } : {}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
(span) => span
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
channel.subscribe({
|
|
47
|
-
start: NOOP,
|
|
48
|
-
asyncStart: NOOP,
|
|
49
|
-
end: NOOP,
|
|
50
|
-
asyncEnd: (data) => {
|
|
51
|
-
const span = data._sentrySpan;
|
|
52
|
-
if (!span || data.error) return;
|
|
53
|
-
runResponseHook(span, data.command, data.args.slice(1), data.result);
|
|
54
|
-
span.end();
|
|
55
|
-
},
|
|
56
|
-
error: (data) => {
|
|
57
|
-
const span = data._sentrySpan;
|
|
58
|
-
if (!span) return;
|
|
59
|
-
if (data.error) {
|
|
60
|
-
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: data.error.message });
|
|
61
|
-
}
|
|
62
|
-
span.end();
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function setupBatchChannel() {
|
|
67
|
-
const channel = tracingChannel.tracingChannel(CHANNEL_BATCH, (data) => {
|
|
68
|
-
const operationName = data.batchMode === "PIPELINE" ? "PIPELINE" : "MULTI";
|
|
69
|
-
return core.startSpanManual(
|
|
70
|
-
{
|
|
71
|
-
name: operationName,
|
|
72
|
-
attributes: {
|
|
73
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
74
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db.redis",
|
|
75
|
-
[semconv.ATTR_DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
76
|
-
...data.batchSize != null ? { "db.redis.batch_size": data.batchSize } : {},
|
|
77
|
-
...data.serverAddress != null ? { [semconv.ATTR_NET_PEER_NAME]: data.serverAddress } : {},
|
|
78
|
-
...data.serverPort != null ? { [semconv.ATTR_NET_PEER_PORT]: data.serverPort } : {}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
(span) => span
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
channel.subscribe({
|
|
85
|
-
start: NOOP,
|
|
86
|
-
asyncStart: NOOP,
|
|
87
|
-
end: NOOP,
|
|
88
|
-
asyncEnd: (data) => {
|
|
89
|
-
if (!data.error) data._sentrySpan?.end();
|
|
90
|
-
},
|
|
91
|
-
error: (data) => {
|
|
92
|
-
const span = data._sentrySpan;
|
|
93
|
-
if (!span) return;
|
|
94
|
-
if (data.error) {
|
|
95
|
-
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: data.error.message });
|
|
96
|
-
}
|
|
97
|
-
span.end();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function setupConnectChannel() {
|
|
102
|
-
const channel = tracingChannel.tracingChannel(CHANNEL_CONNECT, (data) => {
|
|
103
|
-
return core.startSpanManual(
|
|
104
|
-
{
|
|
105
|
-
name: "redis-connect",
|
|
106
|
-
attributes: {
|
|
107
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
108
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db.redis.connect",
|
|
109
|
-
[semconv.ATTR_DB_SYSTEM]: semconv.DB_SYSTEM_VALUE_REDIS,
|
|
110
|
-
...data.serverAddress != null ? { [semconv.ATTR_NET_PEER_NAME]: data.serverAddress } : {},
|
|
111
|
-
...data.serverPort != null ? { [semconv.ATTR_NET_PEER_PORT]: data.serverPort } : {}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
(span) => span
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
channel.subscribe({
|
|
118
|
-
start: NOOP,
|
|
119
|
-
asyncStart: NOOP,
|
|
120
|
-
end: NOOP,
|
|
121
|
-
asyncEnd: (data) => {
|
|
122
|
-
if (!data.error) data._sentrySpan?.end();
|
|
123
|
-
},
|
|
124
|
-
error: (data) => {
|
|
125
|
-
const span = data._sentrySpan;
|
|
126
|
-
if (!span) return;
|
|
127
|
-
if (data.error) {
|
|
128
|
-
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: data.error.message });
|
|
129
|
-
}
|
|
130
|
-
span.end();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
function runResponseHook(span, command, args, result) {
|
|
135
|
-
const hook = currentResponseHook;
|
|
136
|
-
if (!hook) return;
|
|
137
|
-
try {
|
|
138
|
-
hook(span, command, args, result);
|
|
139
|
-
} catch {
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function safeSerialize(command, args) {
|
|
143
|
-
try {
|
|
144
|
-
return redisCommon.defaultDbStatementSerializer(command, args);
|
|
145
|
-
} catch {
|
|
146
|
-
return void 0;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
exports.subscribeRedisDiagnosticChannels = subscribeRedisDiagnosticChannels;
|
|
151
|
-
//# sourceMappingURL=redis-dc-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redis-dc-subscriber.js","sources":["../../../../../src/integrations/tracing/redis/redis-dc-subscriber.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\nimport { tracingChannel, type TracingChannelContextWithSpan } from '@sentry/opentelemetry/tracing-channel';\nimport { defaultDbStatementSerializer } from './vendored/redis-common';\nimport {\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_REDIS,\n} from './vendored/semconv';\nimport type { IORedisInstrumentationConfig } from './vendored/types';\n\n// Channel names as published by node-redis >= 5.12.0.\n// Hardcoded so we don't import `redis` at module-load time.\nconst CHANNEL_COMMAND = 'node-redis:command';\nconst CHANNEL_BATCH = 'node-redis:batch';\nconst CHANNEL_CONNECT = 'node-redis:connect';\n\nconst ORIGIN = 'auto.db.redis.diagnostic_channel';\n\ninterface CommandData {\n command: string;\n args: Array<string | Buffer>;\n database?: number;\n serverAddress?: string;\n serverPort?: number;\n result?: unknown;\n error?: Error;\n}\n\ninterface BatchData {\n batchMode?: 'MULTI' | 'PIPELINE';\n batchSize?: number;\n database?: number;\n clientId?: string | number;\n serverAddress?: string;\n serverPort?: number;\n result?: unknown[];\n error?: Error;\n}\n\ninterface ConnectData {\n serverAddress?: string;\n serverPort?: number;\n url?: string;\n error?: Error;\n}\n\nconst NOOP = (): void => {};\n\nlet subscribed = false;\nlet currentResponseHook: IORedisInstrumentationConfig['responseHook'] | undefined;\n\n/**\n * Subscribe Sentry handlers to node-redis diagnostics_channel events (>= 5.12.0).\n *\n * Uses `@sentry/opentelemetry/tracing-channel` so OTel AsyncLocalStorage context propagates\n * automatically via `bindStore` — without it, spans created in `start` would not become\n * the active context for subsequent operations.\n *\n * Safe on every runtime that exposes `node:diagnostics_channel` (Node, Bun, Deno, Workers).\n * In node-redis < 5.12.0 the channels are never published to, so subscribers are inert and\n * there is no double-instrumentation against the IITM-based patcher (gated to < 5.12.0).\n */\nexport function subscribeRedisDiagnosticChannels(responseHook?: IORedisInstrumentationConfig['responseHook']): void {\n currentResponseHook = responseHook;\n if (subscribed) return;\n\n try {\n setupCommandChannel();\n setupBatchChannel();\n setupConnectChannel();\n subscribed = true;\n } catch {\n // tracingChannel from @sentry/opentelemetry requires `node:diagnostics_channel`.\n // On runtimes where it isn't available, fail closed.\n }\n}\n\nfunction setupCommandChannel(): void {\n const channel = tracingChannel<CommandData>(CHANNEL_COMMAND, data => {\n // node-redis >= 5.12.0 includes the command name as args[0] in the DC payload.\n // Strip it so serialization and cache key extraction see only the actual arguments.\n const actualArgs = data.args.slice(1);\n const statement = safeSerialize(data.command, actualArgs);\n return startSpanManual(\n {\n name: `redis-${data.command}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis',\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n ...(statement != null ? { [ATTR_DB_STATEMENT]: statement } : {}),\n ...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),\n ...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),\n },\n },\n span => span,\n ) as Span;\n });\n\n channel.subscribe({\n start: NOOP,\n asyncStart: NOOP,\n end: NOOP,\n asyncEnd: data => {\n const span = data._sentrySpan;\n // only end if error handler isn't going to\n if (!span || data.error) return;\n // Same slice: strip command name from args before passing to the response hook.\n runResponseHook(span, data.command, data.args.slice(1), data.result);\n span.end();\n },\n error: data => {\n const span = data._sentrySpan;\n if (!span) return;\n if (data.error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });\n }\n span.end();\n },\n });\n}\n\nfunction setupBatchChannel(): void {\n const channel = tracingChannel<BatchData>(CHANNEL_BATCH, data => {\n const operationName = data.batchMode === 'PIPELINE' ? 'PIPELINE' : 'MULTI';\n\n return startSpanManual(\n {\n name: operationName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis',\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n ...(data.batchSize != null ? { 'db.redis.batch_size': data.batchSize } : {}),\n ...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),\n ...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),\n },\n },\n span => span,\n ) as Span;\n });\n\n channel.subscribe({\n start: NOOP,\n asyncStart: NOOP,\n end: NOOP,\n asyncEnd: data => {\n // only end if the error handler isn't going to\n if (!data.error) data._sentrySpan?.end();\n },\n error: data => {\n const span = data._sentrySpan;\n if (!span) return;\n if (data.error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });\n }\n span.end();\n },\n });\n}\n\nfunction setupConnectChannel(): void {\n const channel = tracingChannel<ConnectData>(CHANNEL_CONNECT, data => {\n return startSpanManual(\n {\n name: 'redis-connect',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis.connect',\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n ...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),\n ...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),\n },\n },\n span => span,\n ) as Span;\n });\n\n channel.subscribe({\n start: NOOP,\n asyncStart: NOOP,\n end: NOOP,\n asyncEnd: data => {\n // only end if the error handler isn't going to\n if (!data.error) data._sentrySpan?.end();\n },\n error: data => {\n const span = data._sentrySpan;\n if (!span) return;\n if (data.error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });\n }\n span.end();\n },\n });\n}\n\nfunction runResponseHook(span: Span, command: string, args: Array<string | Buffer>, result: unknown): void {\n const hook = currentResponseHook;\n if (!hook) return;\n try {\n hook(span, command, args as unknown as Parameters<typeof hook>[2], result);\n } catch {\n // never let user hooks break instrumentation\n }\n}\n\nfunction safeSerialize(command: string, args: Array<string | Buffer>): string | undefined {\n try {\n return defaultDbStatementSerializer(command, args);\n } catch {\n return undefined;\n }\n}\n\n// Test-only helper.\nexport function _resetRedisDiagnosticChannelsForTesting(): void {\n subscribed = false;\n currentResponseHook = undefined;\n}\n\n// Suppress unused-import lint when only used in types.\nexport type { TracingChannelContextWithSpan };\n"],"names":["tracingChannel","startSpanManual","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","ATTR_DB_SYSTEM","DB_SYSTEM_VALUE_REDIS","ATTR_DB_STATEMENT","ATTR_NET_PEER_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AAiB,IAAA,EAA8B,MAAA,EAAuB;AACzG,EAAA,MAAM,IAAA,GAAO,mBAAA;AACb,EAAA,IAAI,CAAC,IAAA,EAAM;AACX,EAAA,IAAI;AACF,IAAA,IAAA,CAAK,IAAA,EAAM,OAAA,EAAS,IAAA,EAA+C,MAAM,CAAA;AAAA,EAC3E,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAEA,SAAS,aAAA,CAAc,SAAiB,IAAA,EAAkD;AACxF,EAAA,IAAI;AACF,IAAA,OAAOC,wCAAA,CAA6B,SAAS,IAAI,CAAA;AAAA,EACnD,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { startSpanManual, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
2
|
-
import { tracingChannel } from '@sentry/opentelemetry/tracing-channel';
|
|
3
|
-
import { defaultDbStatementSerializer } from './vendored/redis-common.js';
|
|
4
|
-
import { DB_SYSTEM_VALUE_REDIS, ATTR_NET_PEER_PORT, ATTR_NET_PEER_NAME, ATTR_DB_STATEMENT, ATTR_DB_SYSTEM } from './vendored/semconv.js';
|
|
5
|
-
|
|
6
|
-
const CHANNEL_COMMAND = "node-redis:command";
|
|
7
|
-
const CHANNEL_BATCH = "node-redis:batch";
|
|
8
|
-
const CHANNEL_CONNECT = "node-redis:connect";
|
|
9
|
-
const ORIGIN = "auto.db.redis.diagnostic_channel";
|
|
10
|
-
const NOOP = () => {
|
|
11
|
-
};
|
|
12
|
-
let subscribed = false;
|
|
13
|
-
let currentResponseHook;
|
|
14
|
-
function subscribeRedisDiagnosticChannels(responseHook) {
|
|
15
|
-
currentResponseHook = responseHook;
|
|
16
|
-
if (subscribed) return;
|
|
17
|
-
try {
|
|
18
|
-
setupCommandChannel();
|
|
19
|
-
setupBatchChannel();
|
|
20
|
-
setupConnectChannel();
|
|
21
|
-
subscribed = true;
|
|
22
|
-
} catch {
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function setupCommandChannel() {
|
|
26
|
-
const channel = tracingChannel(CHANNEL_COMMAND, (data) => {
|
|
27
|
-
const actualArgs = data.args.slice(1);
|
|
28
|
-
const statement = safeSerialize(data.command, actualArgs);
|
|
29
|
-
return startSpanManual(
|
|
30
|
-
{
|
|
31
|
-
name: `redis-${data.command}`,
|
|
32
|
-
attributes: {
|
|
33
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
34
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db.redis",
|
|
35
|
-
[ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,
|
|
36
|
-
...statement != null ? { [ATTR_DB_STATEMENT]: statement } : {},
|
|
37
|
-
...data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {},
|
|
38
|
-
...data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
(span) => span
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
channel.subscribe({
|
|
45
|
-
start: NOOP,
|
|
46
|
-
asyncStart: NOOP,
|
|
47
|
-
end: NOOP,
|
|
48
|
-
asyncEnd: (data) => {
|
|
49
|
-
const span = data._sentrySpan;
|
|
50
|
-
if (!span || data.error) return;
|
|
51
|
-
runResponseHook(span, data.command, data.args.slice(1), data.result);
|
|
52
|
-
span.end();
|
|
53
|
-
},
|
|
54
|
-
error: (data) => {
|
|
55
|
-
const span = data._sentrySpan;
|
|
56
|
-
if (!span) return;
|
|
57
|
-
if (data.error) {
|
|
58
|
-
span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });
|
|
59
|
-
}
|
|
60
|
-
span.end();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function setupBatchChannel() {
|
|
65
|
-
const channel = tracingChannel(CHANNEL_BATCH, (data) => {
|
|
66
|
-
const operationName = data.batchMode === "PIPELINE" ? "PIPELINE" : "MULTI";
|
|
67
|
-
return startSpanManual(
|
|
68
|
-
{
|
|
69
|
-
name: operationName,
|
|
70
|
-
attributes: {
|
|
71
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
72
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db.redis",
|
|
73
|
-
[ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,
|
|
74
|
-
...data.batchSize != null ? { "db.redis.batch_size": data.batchSize } : {},
|
|
75
|
-
...data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {},
|
|
76
|
-
...data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
(span) => span
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
channel.subscribe({
|
|
83
|
-
start: NOOP,
|
|
84
|
-
asyncStart: NOOP,
|
|
85
|
-
end: NOOP,
|
|
86
|
-
asyncEnd: (data) => {
|
|
87
|
-
if (!data.error) data._sentrySpan?.end();
|
|
88
|
-
},
|
|
89
|
-
error: (data) => {
|
|
90
|
-
const span = data._sentrySpan;
|
|
91
|
-
if (!span) return;
|
|
92
|
-
if (data.error) {
|
|
93
|
-
span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });
|
|
94
|
-
}
|
|
95
|
-
span.end();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function setupConnectChannel() {
|
|
100
|
-
const channel = tracingChannel(CHANNEL_CONNECT, (data) => {
|
|
101
|
-
return startSpanManual(
|
|
102
|
-
{
|
|
103
|
-
name: "redis-connect",
|
|
104
|
-
attributes: {
|
|
105
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
106
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db.redis.connect",
|
|
107
|
-
[ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,
|
|
108
|
-
...data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {},
|
|
109
|
-
...data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
(span) => span
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
channel.subscribe({
|
|
116
|
-
start: NOOP,
|
|
117
|
-
asyncStart: NOOP,
|
|
118
|
-
end: NOOP,
|
|
119
|
-
asyncEnd: (data) => {
|
|
120
|
-
if (!data.error) data._sentrySpan?.end();
|
|
121
|
-
},
|
|
122
|
-
error: (data) => {
|
|
123
|
-
const span = data._sentrySpan;
|
|
124
|
-
if (!span) return;
|
|
125
|
-
if (data.error) {
|
|
126
|
-
span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });
|
|
127
|
-
}
|
|
128
|
-
span.end();
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function runResponseHook(span, command, args, result) {
|
|
133
|
-
const hook = currentResponseHook;
|
|
134
|
-
if (!hook) return;
|
|
135
|
-
try {
|
|
136
|
-
hook(span, command, args, result);
|
|
137
|
-
} catch {
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function safeSerialize(command, args) {
|
|
141
|
-
try {
|
|
142
|
-
return defaultDbStatementSerializer(command, args);
|
|
143
|
-
} catch {
|
|
144
|
-
return void 0;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export { subscribeRedisDiagnosticChannels };
|
|
149
|
-
//# sourceMappingURL=redis-dc-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redis-dc-subscriber.js","sources":["../../../../../src/integrations/tracing/redis/redis-dc-subscriber.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\nimport { tracingChannel, type TracingChannelContextWithSpan } from '@sentry/opentelemetry/tracing-channel';\nimport { defaultDbStatementSerializer } from './vendored/redis-common';\nimport {\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_REDIS,\n} from './vendored/semconv';\nimport type { IORedisInstrumentationConfig } from './vendored/types';\n\n// Channel names as published by node-redis >= 5.12.0.\n// Hardcoded so we don't import `redis` at module-load time.\nconst CHANNEL_COMMAND = 'node-redis:command';\nconst CHANNEL_BATCH = 'node-redis:batch';\nconst CHANNEL_CONNECT = 'node-redis:connect';\n\nconst ORIGIN = 'auto.db.redis.diagnostic_channel';\n\ninterface CommandData {\n command: string;\n args: Array<string | Buffer>;\n database?: number;\n serverAddress?: string;\n serverPort?: number;\n result?: unknown;\n error?: Error;\n}\n\ninterface BatchData {\n batchMode?: 'MULTI' | 'PIPELINE';\n batchSize?: number;\n database?: number;\n clientId?: string | number;\n serverAddress?: string;\n serverPort?: number;\n result?: unknown[];\n error?: Error;\n}\n\ninterface ConnectData {\n serverAddress?: string;\n serverPort?: number;\n url?: string;\n error?: Error;\n}\n\nconst NOOP = (): void => {};\n\nlet subscribed = false;\nlet currentResponseHook: IORedisInstrumentationConfig['responseHook'] | undefined;\n\n/**\n * Subscribe Sentry handlers to node-redis diagnostics_channel events (>= 5.12.0).\n *\n * Uses `@sentry/opentelemetry/tracing-channel` so OTel AsyncLocalStorage context propagates\n * automatically via `bindStore` — without it, spans created in `start` would not become\n * the active context for subsequent operations.\n *\n * Safe on every runtime that exposes `node:diagnostics_channel` (Node, Bun, Deno, Workers).\n * In node-redis < 5.12.0 the channels are never published to, so subscribers are inert and\n * there is no double-instrumentation against the IITM-based patcher (gated to < 5.12.0).\n */\nexport function subscribeRedisDiagnosticChannels(responseHook?: IORedisInstrumentationConfig['responseHook']): void {\n currentResponseHook = responseHook;\n if (subscribed) return;\n\n try {\n setupCommandChannel();\n setupBatchChannel();\n setupConnectChannel();\n subscribed = true;\n } catch {\n // tracingChannel from @sentry/opentelemetry requires `node:diagnostics_channel`.\n // On runtimes where it isn't available, fail closed.\n }\n}\n\nfunction setupCommandChannel(): void {\n const channel = tracingChannel<CommandData>(CHANNEL_COMMAND, data => {\n // node-redis >= 5.12.0 includes the command name as args[0] in the DC payload.\n // Strip it so serialization and cache key extraction see only the actual arguments.\n const actualArgs = data.args.slice(1);\n const statement = safeSerialize(data.command, actualArgs);\n return startSpanManual(\n {\n name: `redis-${data.command}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis',\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n ...(statement != null ? { [ATTR_DB_STATEMENT]: statement } : {}),\n ...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),\n ...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),\n },\n },\n span => span,\n ) as Span;\n });\n\n channel.subscribe({\n start: NOOP,\n asyncStart: NOOP,\n end: NOOP,\n asyncEnd: data => {\n const span = data._sentrySpan;\n // only end if error handler isn't going to\n if (!span || data.error) return;\n // Same slice: strip command name from args before passing to the response hook.\n runResponseHook(span, data.command, data.args.slice(1), data.result);\n span.end();\n },\n error: data => {\n const span = data._sentrySpan;\n if (!span) return;\n if (data.error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });\n }\n span.end();\n },\n });\n}\n\nfunction setupBatchChannel(): void {\n const channel = tracingChannel<BatchData>(CHANNEL_BATCH, data => {\n const operationName = data.batchMode === 'PIPELINE' ? 'PIPELINE' : 'MULTI';\n\n return startSpanManual(\n {\n name: operationName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis',\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n ...(data.batchSize != null ? { 'db.redis.batch_size': data.batchSize } : {}),\n ...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),\n ...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),\n },\n },\n span => span,\n ) as Span;\n });\n\n channel.subscribe({\n start: NOOP,\n asyncStart: NOOP,\n end: NOOP,\n asyncEnd: data => {\n // only end if the error handler isn't going to\n if (!data.error) data._sentrySpan?.end();\n },\n error: data => {\n const span = data._sentrySpan;\n if (!span) return;\n if (data.error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });\n }\n span.end();\n },\n });\n}\n\nfunction setupConnectChannel(): void {\n const channel = tracingChannel<ConnectData>(CHANNEL_CONNECT, data => {\n return startSpanManual(\n {\n name: 'redis-connect',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis.connect',\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n ...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),\n ...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),\n },\n },\n span => span,\n ) as Span;\n });\n\n channel.subscribe({\n start: NOOP,\n asyncStart: NOOP,\n end: NOOP,\n asyncEnd: data => {\n // only end if the error handler isn't going to\n if (!data.error) data._sentrySpan?.end();\n },\n error: data => {\n const span = data._sentrySpan;\n if (!span) return;\n if (data.error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: data.error.message });\n }\n span.end();\n },\n });\n}\n\nfunction runResponseHook(span: Span, command: string, args: Array<string | Buffer>, result: unknown): void {\n const hook = currentResponseHook;\n if (!hook) return;\n try {\n hook(span, command, args as unknown as Parameters<typeof hook>[2], result);\n } catch {\n // never let user hooks break instrumentation\n }\n}\n\nfunction safeSerialize(command: string, args: Array<string | Buffer>): string | undefined {\n try {\n return defaultDbStatementSerializer(command, args);\n } catch {\n return undefined;\n }\n}\n\n// Test-only helper.\nexport function _resetRedisDiagnosticChannelsForTesting(): void {\n subscribed = false;\n currentResponseHook = undefined;\n}\n\n// Suppress unused-import lint when only used in types.\nexport type { TracingChannelContextWithSpan };\n"],"names":[],"mappings":";;;;;AAoBA,MAAM,eAAA,GAAkB,oBAAA;AACxB,MAAM,aAAA,GAAgB,kBAAA;AACtB,MAAM,eAAA,GAAkB,oBAAA;AAExB,MAAM,MAAA,GAAS,kCAAA;AA8Bf,MAAM,OAAO,MAAY;AAAC,CAAA;AAE1B,IAAI,UAAA,GAAa,KAAA;AACjB,IAAI,mBAAA;AAaG,SAAS,iCAAiC,YAAA,EAAmE;AAClH,EAAA,mBAAA,GAAsB,YAAA;AACtB,EAAA,IAAI,UAAA,EAAY;AAEhB,EAAA,IAAI;AACF,IAAA,mBAAA,EAAoB;AACpB,IAAA,iBAAA,EAAkB;AAClB,IAAA,mBAAA,EAAoB;AACpB,IAAA,UAAA,GAAa,IAAA;AAAA,EACf,CAAA,CAAA,MAAQ;AAAA,EAGR;AACF;AAEA,SAAS,mBAAA,GAA4B;AACnC,EAAA,MAAM,OAAA,GAAU,cAAA,CAA4B,eAAA,EAAiB,CAAA,IAAA,KAAQ;AAGnE,IAAA,MAAM,UAAA,GAAa,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA;AACpC,IAAA,MAAM,SAAA,GAAY,aAAA,CAAc,IAAA,CAAK,OAAA,EAAS,UAAU,CAAA;AACxD,IAAA,OAAO,eAAA;AAAA,MACL;AAAA,QACE,IAAA,EAAM,CAAA,MAAA,EAAS,IAAA,CAAK,OAAO,C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I,CAAC,IAAA,EAAM;AACX,MAAA,IAAI,KAAK,KAAA,EAAO;AACd,QAAA,IAAA,CAAK,SAAA,CAAU,EAAE,IAAA,EAAM,iBAAA,EAAmB,SAAS,IAAA,CAAK,KAAA,CAAM,SAAS,CAAA;AAAA,MACzE;AACA,MAAA,IAAA,CAAK,GAAA,EAAI;AAAA,IACX;AAAA,GACD,CAAA;AACH;AAEA,SAAS,eAAA,CAAgB,IAAA,EAAY,OAAA,EAAiB,IAAA,EAA8B,MAAA,EAAuB;AACzG,EAAA,MAAM,IAAA,GAAO,mBAAA;AACb,EAAA,IAAI,CAAC,IAAA,EAAM;AACX,EAAA,IAAI;AACF,IAAA,IAAA,CAAK,IAAA,EAAM,OAAA,EAAS,IAAA,EAA+C,MAAM,CAAA;AAAA,EAC3E,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAEA,SAAS,aAAA,CAAc,SAAiB,IAAA,EAAkD;AACxF,EAAA,IAAI;AACF,IAAA,OAAO,4BAAA,CAA6B,SAAS,IAAI,CAAA;AAAA,EACnD,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type TracingChannelContextWithSpan } from '@sentry/opentelemetry/tracing-channel';
|
|
2
|
-
import type { IORedisInstrumentationConfig } from './vendored/types';
|
|
3
|
-
/**
|
|
4
|
-
* Subscribe Sentry handlers to node-redis diagnostics_channel events (>= 5.12.0).
|
|
5
|
-
*
|
|
6
|
-
* Uses `@sentry/opentelemetry/tracing-channel` so OTel AsyncLocalStorage context propagates
|
|
7
|
-
* automatically via `bindStore` — without it, spans created in `start` would not become
|
|
8
|
-
* the active context for subsequent operations.
|
|
9
|
-
*
|
|
10
|
-
* Safe on every runtime that exposes `node:diagnostics_channel` (Node, Bun, Deno, Workers).
|
|
11
|
-
* In node-redis < 5.12.0 the channels are never published to, so subscribers are inert and
|
|
12
|
-
* there is no double-instrumentation against the IITM-based patcher (gated to < 5.12.0).
|
|
13
|
-
*/
|
|
14
|
-
export declare function subscribeRedisDiagnosticChannels(responseHook?: IORedisInstrumentationConfig['responseHook']): void;
|
|
15
|
-
export declare function _resetRedisDiagnosticChannelsForTesting(): void;
|
|
16
|
-
export type { TracingChannelContextWithSpan };
|
|
17
|
-
//# sourceMappingURL=redis-dc-subscriber.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redis-dc-subscriber.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/redis/redis-dc-subscriber.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkB,KAAK,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAS3G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AA2CrE;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,cAAc,CAAC,GAAG,IAAI,CAalH;AA6ID,wBAAgB,uCAAuC,IAAI,IAAI,CAG9D;AAGD,YAAY,EAAE,6BAA6B,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TracingChannelContextWithSpan } from '@sentry/opentelemetry/tracing-channel';
|
|
2
|
-
import { IORedisInstrumentationConfig } from './vendored/types';
|
|
3
|
-
/**
|
|
4
|
-
* Subscribe Sentry handlers to node-redis diagnostics_channel events (>= 5.12.0).
|
|
5
|
-
*
|
|
6
|
-
* Uses `@sentry/opentelemetry/tracing-channel` so OTel AsyncLocalStorage context propagates
|
|
7
|
-
* automatically via `bindStore` — without it, spans created in `start` would not become
|
|
8
|
-
* the active context for subsequent operations.
|
|
9
|
-
*
|
|
10
|
-
* Safe on every runtime that exposes `node:diagnostics_channel` (Node, Bun, Deno, Workers).
|
|
11
|
-
* In node-redis < 5.12.0 the channels are never published to, so subscribers are inert and
|
|
12
|
-
* there is no double-instrumentation against the IITM-based patcher (gated to < 5.12.0).
|
|
13
|
-
*/
|
|
14
|
-
export declare function subscribeRedisDiagnosticChannels(responseHook?: IORedisInstrumentationConfig['responseHook']): void;
|
|
15
|
-
export declare function _resetRedisDiagnosticChannelsForTesting(): void;
|
|
16
|
-
export { TracingChannelContextWithSpan };
|
|
17
|
-
//# sourceMappingURL=redis-dc-subscriber.d.ts.map
|