Skip to content

Conversation

@s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Oct 28, 2025

This removes the automatic truncation of the span description. Now, all cache keys are set in the description.

part of #17389

@s1gr1d s1gr1d added the Integration: redis Issues related to Redis support for the Sentry Node SDK label Oct 28, 2025
Comment on lines +34 to +50
describe('early returns', () => {
it.each([
{ desc: 'no args', cmd: 'get', args: [], response: 'test' },
{ desc: 'unsupported command', cmd: 'exists', args: ['key'], response: 'test' },
{ desc: 'no cache prefixes', cmd: 'get', args: ['key'], response: 'test', options: {} },
{ desc: 'non-matching prefix', cmd: 'get', args: ['key'], response: 'test', options: { cachePrefixes: ['c'] } },
])('should always set sentry.origin but return early when $desc', ({ cmd, args, response, options = {} }) => {
vi.clearAllMocks();
Object.assign(_redisOptions, options);

cacheResponseHook(mockSpan, cmd, args, response);

expect(mockSpan.setAttribute).toHaveBeenCalledWith('sentry.origin', 'auto.db.otel.redis');
expect(mockSpan.setAttributes).not.toHaveBeenCalled();
expect(mockSpan.updateName).not.toHaveBeenCalled();
});
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some general tests for the handler, as there were none for this behavior so far.

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,290 - 8,786 +6%
GET With Sentry 1,325 14% 1,286 +3%
GET With Sentry (error only) 6,107 66% 6,012 +2%
POST Baseline 1,106 - 1,157 -4%
POST With Sentry 503 45% 470 +7%
POST With Sentry (error only) 973 88% 1,009 -4%
MYSQL Baseline 3,324 - 3,242 +3%
MYSQL With Sentry 534 16% 391 +37%
MYSQL With Sentry (error only) 2,690 81% 2,614 +3%

View base workflow run

@s1gr1d s1gr1d requested review from JPeer264 and chargome November 4, 2025 12:40
{ desc: 'no cache prefixes', cmd: 'get', args: ['key'], response: 'test', options: {} },
{ desc: 'non-matching prefix', cmd: 'get', args: ['key'], response: 'test', options: { cachePrefixes: ['c'] } },
])('should always set sentry.origin but return early when $desc', ({ cmd, args, response, options = {} }) => {
vi.clearAllMocks();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: Maybe it is more future proof to move this into the afterEach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration: redis Issues related to Redis support for the Sentry Node SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants