Skip to content

fix(redis): Restore support for redis-py 3.4.1 and redis-py-cluster 2.1 - #8168

Merged
sentrivana merged 1 commit into
major/3.0from
ivana/redis-py-3-compat
Oct 30, 2026
Merged

sentrivana merged 1 commit into
major/3.0from
ivana/redis-py-3-compat

Conversation

@sentrivana

Copy link
Copy Markdown
Collaborator

Description

Partially reverts #7058 so projects pinned to redis-py 3.x and redis-py-cluster 2.x keep their Redis instrumentation in 3.0. With the 4.2 minimum, an explicitly configured RedisIntegration() raises DidNotEnable and sentry_sdk.init() fails.

This came up while dogfooding 3.0 in getsentry/sentry, which is pinned to redis-py 3.4.1 because it still uses redis-py-cluster (which requires redis<4). It also can't move past redis-py 4.x yet because rb breaks on redis-py 5+.

Only what's needed for those versions is restored:

  • Lower the redis-py minimum from 4.2 to 3.4.1.
  • Patch the redis.asyncio client and pipeline only if redis.asyncio exists (added in redis-py 4.2). This import was guarded in 2.x and chore(redis): Drop support for < 4.2 #7058 made it unconditional, which is the actual reason 3.x stopped working.
  • Restore the redis-py-cluster instrumentation, limited to 2.x. 1.x requires redis-py 2.x, which is below the new minimum, so the StrictRedisCluster/StrictClusterPipeline branches aren't brought back.
  • Re-add the redis_py_cluster_legacy test suite (rewritten for span streaming and the 3.0 attribute names) and its CI entry.

Kept from #7058: the max_data_size removal and the StrictRedis -> Redis switch.

tox.ini was regenerated with populate_tox.py --only redis redis_py_cluster_legacy to avoid unrelated matrix churn. This adds redis 3.4.1/3.5.3 and drops 4.2.2 as the lowest 4.x env. CI only runs redis 3.x on py3.7/3.8 because of its classifiers. I also checked 3.4.1 + rb + redis-py-cluster 2.1.0 on Python 3.13 manually against getsentry/sentry.

Partially revert #7058 so that projects pinned to redis-py 3.x and
redis-py-cluster 2.x keep their Redis instrumentation in 3.0:

- lower the minimum redis-py version from 4.2 to 3.4.1
- only patch the redis.asyncio client and pipeline if redis.asyncio is
  available (redis-py 4.2+)
- restore the redis-py-cluster instrumentation, limited to 2.x (1.x
  requires redis-py 2.x, which is below the new minimum)

The max_data_size removal and the StrictRedis to Redis switch from #7058
are kept.
@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

PY-3

@sentrivana
sentrivana marked this pull request as ready for review October 30, 2026 10:37
@sentrivana
sentrivana requested a review from a team as a code owner October 30, 2026 10:37
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 57541 passed | ⏭️ 3008 skipped | Total: 60549 | Pass Rate: 95.03% | Execution Time: 152m 48s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -83763
Passed Tests 📉 -79315
Failed Tests —
Skipped Tests 📉 -4448

All tests are passing successfully.

✅ Patch coverage is 100.00% (18 of 18 changed executable lines covered; target 80%).
Project statement coverage is 90.36% (up 0.03 percentage points from base (e0a5492) to head (ec553ab)).

Changed files with executable lines (3)
File Patch coverage Changed executable lines
sentry_sdk/integrations/redis/init.py 100.00% 2/2 covered
sentry_sdk/integrations/redis/redis.py 100.00% 6/6 covered
sentry_sdk/integrations/redis/redis_py_cluster_legacy.py 100.00% 10/10 covered
Coverage diff
@@            Coverage Diff             @@
##        master     #8168       +/-##
==========================================
+ Coverage    90.33%    90.36%    +0.03%
==========================================
  Files          203       199        -4
  Tracked lines     26872     21266     -5606
  Branches     10044      7360     -2684
==========================================
- Hits         24272     19215     -5057
+ Misses        2600      2051      -549
+ Partials      1520      1235      -285

Generated by Coverage Action

@sentrivana
sentrivana merged commit 1b27716 into major/3.0 Oct 30, 2026
153 checks passed
@sentrivana
sentrivana deleted the ivana/redis-py-3-compat branch October 30, 2026 11:10
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