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
4 changes: 3 additions & 1 deletion scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@
"*": ["fakeredis!=1.7.4", "pytest<8.0.0"],
">=4.0,<5.0": ["fakeredis<2.31.0"],
"py3.6,py3.7,py3.8": ["fakeredis<2.26.0"],
"py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13": ["pytest-asyncio"],
"py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14,py3.14t": [
"pytest-asyncio"
],
},
},
"redis_py_cluster_legacy": {
Expand Down
15 changes: 8 additions & 7 deletions scripts/populate_tox/package_dependencies.jsonl

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions scripts/populate_tox/releases.jsonl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion tests/integrations/redis/cluster/test_redis_cluster.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from unittest.mock import MagicMock

import pytest
import redis

Expand All @@ -14,7 +16,9 @@ def monkeypatch_rediscluster_class(reset_integrations):
pipeline_cls = redis.cluster.ClusterPipeline
redis.cluster.NodesManager.initialize = lambda *_, **__: None
redis.RedisCluster.command = lambda *_: []
redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(None, None)
redis.RedisCluster.pipeline = lambda *_, **__: pipeline_cls(
MagicMock(), MagicMock()
)
redis.RedisCluster.get_default_node = lambda *_, **__: redis.cluster.ClusterNode(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The sync Redis ClusterPipeline integration passes the pipeline instance to _set_cluster_db_data instead of the cluster client, causing a silently-suppressed AttributeError and missing span data.
Severity: MEDIUM

Suggested Fix

Create a new wrapper function for the sync case, similar to _set_async_cluster_pipeline_db_data. This function should extract the RedisCluster client from the ClusterPipeline instance and then pass the client to _set_cluster_db_data. Update the patch_redis_pipeline call for cluster.ClusterPipeline to use this new wrapper function as its set_db_data_fn.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: tests/integrations/redis/cluster/test_redis_cluster.py#L22

Potential issue: In the synchronous Redis cluster pipeline integration, the
`patch_redis_pipeline` function incorrectly passes the `ClusterPipeline` instance itself
to the `_set_cluster_db_data` function. This function expects a `RedisCluster` instance
to fetch connection details. When it calls `get_default_node()` on the pipeline object,
an `AttributeError` occurs. This error is silently caught by
`capture_internal_exceptions()`, resulting in the failure to add database connection
metadata (host, port) to the corresponding APM spans. This issue does not occur in the
async implementation, which correctly extracts the client from the pipeline before
gathering data.

Did we get this right? 👍 / 👎 to inform future reviews.

"localhost", 6379
)
Expand Down
98 changes: 52 additions & 46 deletions tox.ini

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading