Skip to content

Commit b755ca1

Browse files
chargomeclaude
andcommitted
pr feedback
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c2edea4 commit b755ca1

6 files changed

Lines changed: 19 additions & 36 deletions

File tree

packages/node/src/integrations/tracing/redis/vendored/ioredis-instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
startInactiveSpan,
2121
} from '@sentry/core';
2222
import { DB_STATEMENT, DB_SYSTEM, NET_PEER_NAME, NET_PEER_PORT } from '@sentry/conventions/attributes';
23-
import { defaultDbStatementSerializer } from './redis-common';
23+
import { defaultDbStatementSerializer } from '@sentry/server-utils';
2424
import { ATTR_DB_CONNECTION_STRING, DB_SYSTEM_VALUE_REDIS } from './semconv';
2525
import type { IORedisInstrumentationConfig } from './types';
2626

packages/node/src/integrations/tracing/redis/vendored/redis-common.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/node/src/integrations/tracing/redis/vendored/redis-instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
withActiveSpan,
2424
} from '@sentry/core';
2525
import { DB_STATEMENT, DB_SYSTEM, NET_PEER_NAME, NET_PEER_PORT } from '@sentry/conventions/attributes';
26+
import { defaultDbStatementSerializer } from '@sentry/server-utils';
2627
import { DEBUG_BUILD } from '../../../../debug-build';
2728
import { InstrumentationNodeModuleFile } from '../../InstrumentationNodeModuleFile';
28-
import { defaultDbStatementSerializer } from './redis-common';
2929
import { ATTR_DB_CONNECTION_STRING, DB_SYSTEM_VALUE_REDIS } from './semconv';
3030
import type { RedisInstrumentationConfig, RedisResponseCustomAttributeFunction } from './types';
3131

packages/node/src/sdk/experimentalUseDiagnosticsChannelInjection.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ export function experimentalUseDiagnosticsChannelInjection(): void {
4747
const replacements = [mysqlChannelIntegration(), lruMemoizerChannelIntegration()] as const;
4848

4949
return {
50-
// ioredis only supersedes the ioredis monkey-patch inside the composite OTel
51-
// `Redis` integration (gated off in `redisIntegration`), so it's added here
52-
// but kept out of `replacedOtelIntegrationNames` — `Redis` must stay.
50+
// The OTel `Redis` integration also covers node-redis and ioredis >=5.11
51+
// (native diagnostics_channel), so we keep it in the set to retain that
52+
// instrumentation. Only its ioredis <5.11 monkey-patch is gated off in
53+
// `redisIntegration` — hence `ioredisChannelIntegration` is added but kept
54+
// out of `replacedOtelIntegrationNames`.
5355
integrations: [...replacements, ioredisChannelIntegration({ responseHook: cacheResponseHook })],
5456
replacedOtelIntegrationNames: replacements.map(i => i.name),
5557
register: registerDiagnosticsChannelInjection,

packages/node/test/integrations/tracing/redis/redis-common.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* Licensed under the Apache License, Version 2.0
55
*/
66

7+
import { defaultDbStatementSerializer } from '@sentry/server-utils';
78
import { describe, expect, it } from 'vitest';
8-
import { defaultDbStatementSerializer } from '../../../../src/integrations/tracing/redis/vendored/redis-common';
99

1010
describe('defaultDbStatementSerializer()', () => {
1111
const testCases: Array<{

packages/server-utils/src/integrations/tracing-channel/ioredis.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ const _ioredisChannelIntegration = ((options: IORedisChannelIntegrationOptions =
113113
});
114114
},
115115
{
116-
captureError: false,
117116
beforeSpanEnd(span, data) {
118117
if ('error' in data || !responseHook) {
119118
return;
@@ -126,21 +125,17 @@ const _ioredisChannelIntegration = ((options: IORedisChannelIntegrationOptions =
126125
},
127126
);
128127

129-
bindTracingChannelToSpan(
130-
connectChannel,
131-
data => {
132-
if (!getActiveSpan()) {
133-
return undefined;
134-
}
135-
const { host, port } = getConnectionOptions(data.self);
136-
return startInactiveSpan({
137-
name: 'connect',
138-
op: 'db',
139-
attributes: { ...connectionAttributes(host, port), [DB_STATEMENT]: 'connect' },
140-
});
141-
},
142-
{ captureError: false },
143-
);
128+
bindTracingChannelToSpan(connectChannel, data => {
129+
if (!getActiveSpan()) {
130+
return undefined;
131+
}
132+
const { host, port } = getConnectionOptions(data.self);
133+
return startInactiveSpan({
134+
name: 'connect',
135+
op: 'db',
136+
attributes: { ...connectionAttributes(host, port), [DB_STATEMENT]: 'connect' },
137+
});
138+
});
144139
});
145140
},
146141
};

0 commit comments

Comments
 (0)