-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(redis): Add cache logic for redis-4 (#12429)
Follow-up as cache logic for `ioredis` was already added.
- Loading branch information
Showing
9 changed files
with
293 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
dev-packages/node-integration-tests/suites/tracing/redis-cache/scenario-redis-4.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { loggingTransport } = require('@sentry-internal/node-integration-tests'); | ||
const Sentry = require('@sentry/node'); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
tracesSampleRate: 1.0, | ||
transport: loggingTransport, | ||
integrations: [Sentry.redisIntegration({ cachePrefixes: ['redis-cache:'] })], | ||
}); | ||
|
||
// Stop the process from exiting before the transaction is sent | ||
setInterval(() => {}, 1000); | ||
|
||
const { createClient } = require('redis-4'); | ||
|
||
async function run() { | ||
const redisClient = await createClient().connect(); | ||
|
||
await Sentry.startSpan( | ||
{ | ||
name: 'Test Span Redis 4', | ||
op: 'test-span-redis-4', | ||
}, | ||
async () => { | ||
try { | ||
await redisClient.set('redis-test-key', 'test-value'); | ||
await redisClient.set('redis-cache:test-key', 'test-value'); | ||
|
||
await redisClient.set('redis-cache:test-key-set-EX', 'test-value', { EX: 10 }); | ||
await redisClient.setEx('redis-cache:test-key-setex', 10, 'test-value'); | ||
|
||
await redisClient.get('redis-test-key'); | ||
await redisClient.get('redis-cache:test-key'); | ||
await redisClient.get('redis-cache:unavailable-data'); | ||
|
||
await redisClient.mGet(['redis-test-key', 'redis-cache:test-key', 'redis-cache:unavailable-data']); | ||
} finally { | ||
await redisClient.disconnect(); | ||
} | ||
}, | ||
); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.