Skip to content

Commit aa9c09d

Browse files
authored
ref(node): Streamline ioredis instrumentation (#21560)
Streamlines the vendored `ioredis` instrumentation to use Sentry's span APIs instead of the OpenTelemetry tracing APIs. I removed the fake tests, added test cases to the integration tests, and dropped any unreachable code.
1 parent 60723b6 commit aa9c09d

6 files changed

Lines changed: 163 additions & 372 deletions

File tree

.oxlintrc.base.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@
156156
"**/integrations/tracing/amqplib/vendored/**/*.ts",
157157
"**/integrations/tracing/prisma/vendored/**/*.ts",
158158
"**/integrations/tracing/postgres/vendored/**/*.ts",
159-
"**/integrations/tracing/fastify/vendored/**/*.ts"
159+
"**/integrations/tracing/fastify/vendored/**/*.ts",
160+
"**/integrations/tracing/redis/vendored/**/*.ts"
160161
],
161162
"rules": {
162163
"typescript/no-explicit-any": "off",

dev-packages/node-integration-tests/suites/tracing/redis/scenario-ioredis.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ async function run() {
1414
await redis.set('test-key', 'test-value');
1515

1616
await redis.get('test-key');
17+
18+
// a failing command should produce a span with an error status
19+
await redis.incr('test-key').catch(() => {});
1720
} finally {
1821
await redis.disconnect();
1922
}

dev-packages/node-integration-tests/suites/tracing/redis/test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ describe('redis auto instrumentation', () => {
3535
'db.statement': 'get test-key',
3636
}),
3737
}),
38+
// a failing command produces a span with an error status
39+
expect.objectContaining({
40+
description: 'incr test-key',
41+
op: 'db',
42+
status: 'internal_error',
43+
origin: 'auto.db.otel.redis',
44+
data: expect.objectContaining({
45+
'sentry.op': 'db',
46+
'sentry.origin': 'auto.db.otel.redis',
47+
'db.system': 'redis',
48+
'net.peer.name': 'localhost',
49+
'net.peer.port': 6379,
50+
'db.statement': 'incr test-key',
51+
}),
52+
}),
3853
]),
3954
};
4055

0 commit comments

Comments
 (0)