Skip to content

Commit 38c3ec9

Browse files
committed
test something
1 parent 144cbfc commit 38c3ec9

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

packages/node/src/integrations/tracing/redis.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ export const instrumentRedis = generateInstrumentOnce(INTEGRATION_NAME, () => {
3333

3434
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.redis');
3535

36+
const cacheOperation = getCacheOperation(redisCommand);
37+
3638
if (
39+
!cacheOperation ||
3740
!_redisOptions?.cachePrefixes ||
3841
!shouldConsiderForCache(redisCommand, safeKey, _redisOptions.cachePrefixes)
3942
) {
@@ -49,14 +52,11 @@ export const instrumentRedis = generateInstrumentOnce(INTEGRATION_NAME, () => {
4952
span.setAttributes({ 'network.peer.address': networkPeerAddress, 'network.peer.port': networkPeerPort });
5053
}
5154

52-
const cacheOperation = getCacheOperation(redisCommand);
53-
54-
if (!cacheOperation) {
55-
// redis command unsupported as cache operation
56-
return;
57-
}
58-
55+
// eslint-disable-next-line no-console
56+
console.log('response', response);
5957
const cacheItemSize = calculateCacheItemSize(response);
58+
// eslint-disable-next-line no-console
59+
console.log('cacheItemSize', cacheItemSize);
6060
if (cacheItemSize) {
6161
span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);
6262
}
@@ -71,6 +71,8 @@ export const instrumentRedis = generateInstrumentOnce(INTEGRATION_NAME, () => {
7171
});
7272

7373
span.updateName(safeKey.length > 1024 ? `${safeKey.substring(0, 1024)}...` : safeKey);
74+
// eslint-disable-next-line no-console
75+
console.log('span',span);
7476
},
7577
});
7678
});

packages/node/src/utils/redisCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export const SET_COMMANDS = ['set' /* todo: 'setex' */];
88

99
/** Determine cache operation based on redis statement */
1010
export function getCacheOperation(
11-
statement: string,
11+
command: string,
1212
): 'cache.get' | 'cache.put' | 'cache.remove' | 'cache.flush' | undefined {
13-
const lowercaseStatement = statement.toLowerCase();
13+
const lowercaseStatement = command.toLowerCase();
1414

1515
if (GET_COMMANDS.includes(lowercaseStatement)) {
1616
return 'cache.get';

packages/opentelemetry/src/utils/parseSpanDescription.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function parseSpanDescription(span: AbstractSpan): SpanDescription {
5252
// If db.type exists then this is a database call span
5353
// If the Redis DB is used as a cache, the span description should not be changed
5454
if (dbSystem && (!attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !opIsCache)) {
55-
return descriptionForDbSystem({ attributes, name });
55+
// return descriptionForDbSystem({ attributes, name });
5656
}
5757

5858
// If rpc.service exists then this is a rpc call span.

0 commit comments

Comments
 (0)