Skip to content

feat: added support for redis v6#2578

Open
instanacd wants to merge 8 commits into
mainfrom
currency-bot-major-redis-600
Open

feat: added support for redis v6#2578
instanacd wants to merge 8 commits into
mainfrom
currency-bot-major-redis-600

Conversation

@instanacd
Copy link
Copy Markdown
Contributor

@instanacd instanacd commented Jun 2, 2026

Added support for Redis v6.

https://github.com/redis/node-redis/releases/tag/redis%406.0.0

Changes

Based on the Redis 6.0 release notes, Redis v6 introduces the following changes that affect our instrumentation:

  • Node.js 20 is now the minimum supported runtime.
  • The package now publicly exposes RedisClient, RedisCluster, RedisSentinel, and pool-related classes.

Instrumentation Changes

Previously, the instrumentation used the presence of RedisClient to determine whether to apply legacy prototype-based instrumentation. This assumption is no longer valid because:

Version RedisClient Multi
v3
v4
v5
v6

As Redis v6 reintroduces the RedisClient export, checking for RedisClient alone incorrectly classifies v6 as a legacy client. Detect the legacy implementation via the combined presence of:

  • RedisClient.prototype
  • Multi

This uniquely identifies the Redis v3 API shape while ensuring Redis v4–v6 continue to use the modern factory-based instrumentation path.

Reference

@instanacd instanacd requested a review from a team as a code owner June 2, 2026 17:04
// RedisClient exists in both v3 and v6. Detect the legacy v3 API via
// the combined presence of RedisClient and Multi rather than RedisClient alone.
const isLegacyRedisAPI =
redis.RedisClient?.prototype && typeof redis.Multi?.prototype?.exec_transaction === 'function';
Copy link
Copy Markdown
Contributor

@aryamohanan aryamohanan Jun 4, 2026

Choose a reason for hiding this comment

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

RedisClient alone cannot be used to distinguish v3 from newer v6 because it is present in both v3 and v6.

Replaced the RedisClient-only detection with a check for the legacy class-based API shape.
Detect the legacy implementation via the combined presence of:

  • RedisClient
  • Multi

Continue using prototype instrumentation only for v3. Use the createClient-based instrumentation for v4+.

@aryamohanan aryamohanan changed the title [Currency Bot] Bumped redis from 5.12.1 to 6.0.0 feat: added support for redis v6 Jun 4, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants