Skip to content

Commit e4618cb

Browse files
committed
review comments
1 parent 3ded60f commit e4618cb

File tree

2 files changed

+4
-3
lines changed
  • dev-packages/node-integration-tests/suites/tracing/redis-cache
  • packages/node/src/utils

2 files changed

+4
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('redis cache auto instrumentation', () => {
5353
origin: 'auto.db.otel.redis',
5454
data: expect.objectContaining({
5555
'sentry.origin': 'auto.db.otel.redis',
56-
'db.statement': 'ioredis-cache:test-key [1 other arguments]',
56+
'db.statement': 'set ioredis-cache:test-key [1 other arguments]',
5757
'cache.key': 'ioredis-cache:test-key',
5858
'cache.item_size': 2,
5959
'network.peer.address': 'localhost',

packages/node/src/utils/redisCache.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ export function getCacheKeySafely(cmdArgs: IORedisCommandArgs): string {
5454
/** Determines whether a redis operation should be considered as "cache operation" by checking if a key is prefixed.
5555
* We only support certain commands (such as 'set', 'get', 'mget'). */
5656
export function shouldConsiderForCache(redisCommand: string, key: string, prefixes: string[]): boolean {
57-
const lowercaseCommand = redisCommand.toLowerCase();
58-
if (!SET_COMMANDS.includes(lowercaseCommand) && !GET_COMMANDS.includes(lowercaseCommand)) return false;
57+
if (!getCacheOperation(redisCommand)) {
58+
return false;
59+
}
5960

6061
return key.split(',').reduce((prev, key) => prev || keyHasPrefix(key, prefixes), false);
6162
}

0 commit comments

Comments
 (0)