Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'set test-key [1 other arguments]',
op: 'db',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'sentry.op': 'db',
'db.system': 'redis',
Expand All @@ -23,6 +24,7 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'get test-key',
op: 'db',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'sentry.op': 'db',
'db.system': 'redis',
Expand All @@ -48,6 +50,7 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'set ioredis-cache:test-key [1 other arguments]',
op: 'cache.put',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'db.statement': 'set ioredis-cache:test-key [1 other arguments]',
'cache.key': 'ioredis-cache:test-key',
Expand All @@ -60,6 +63,7 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'get ioredis-cache:test-key',
op: 'cache.get_item', // todo: will be changed to cache.get
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'db.statement': 'get ioredis-cache:test-key',
'cache.hit': true,
Expand All @@ -73,6 +77,7 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'get ioredis-cache:unavailable-data',
op: 'cache.get_item', // todo: will be changed to cache.get
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'db.statement': 'get ioredis-cache:unavailable-data',
'cache.hit': false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'set test-key [1 other arguments]',
op: 'db',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'sentry.op': 'db',
'sentry.origin': 'auto.db.otel.redis',
'db.system': 'redis',
'net.peer.name': 'localhost',
'net.peer.port': 6379,
Expand All @@ -23,8 +25,10 @@ describe('redis auto instrumentation', () => {
expect.objectContaining({
description: 'get test-key',
op: 'db',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'sentry.op': 'db',
'sentry.origin': 'auto.db.otel.redis',
'db.system': 'redis',
'net.peer.name': 'localhost',
'net.peer.port': 6379,
Expand Down
3 changes: 3 additions & 0 deletions packages/node/src/integrations/tracing/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE,
SEMANTIC_ATTRIBUTE_CACHE_KEY,
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
defineIntegration,
spanToJSON,
} from '@sentry/core';
Expand Down Expand Up @@ -49,6 +50,8 @@ const _redisIntegration = ((options?: RedisOptions) => {
responseHook: (span, redisCommand, cmdArgs, response) => {
const key = cmdArgs[0];

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

if (!options?.cachePrefixes || !shouldConsiderForCache(redisCommand, key, options.cachePrefixes)) {
// not relevant for cache
return;
Expand Down