Skip to content

fix(redis): extract ClusterPipeline commands from _execution_strategy in redis-py 6+#4436

Open
alliasgher wants to merge 2 commits intoopen-telemetry:mainfrom
alliasgher:fix-redis-cluster-pipeline-commands
Open

fix(redis): extract ClusterPipeline commands from _execution_strategy in redis-py 6+#4436
alliasgher wants to merge 2 commits intoopen-telemetry:mainfrom
alliasgher:fix-redis-cluster-pipeline-commands

Conversation

@alliasgher
Copy link
Copy Markdown
Contributor

@alliasgher alliasgher commented Apr 14, 2026

Description

In redis-py 6+, ClusterPipeline moved its pending command list from a direct attribute to an internal _execution_strategy object. The instrumentation still read the old attribute path and therefore saw an empty command list, so span attributes for pipelined cluster commands were blank.

Extract the command list from _execution_strategy when present so the span attributes reflect the actual pipelined commands.

Fixes #4420

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Changelog entry added under Unreleased / Fixed

… in redis-py 6+

redis-py 6 refactored ClusterPipeline so that commands are appended to
_execution_strategy.command_queue instead of instance.command_stack.
The latter still exists but is never populated, causing pipeline spans
to always show an empty command list.

Prefer _execution_strategy.command_queue when it exists, falling back
to the old command_stack / _command_stack attributes for older versions
and non-cluster pipelines.

Fixes open-telemetry#4084

Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher alliasgher force-pushed the fix-redis-cluster-pipeline-commands branch from 9a5e669 to ce7ee4f Compare April 15, 2026 20:17
Signed-off-by: Ali <alliasgher123@gmail.com>
@alliasgher alliasgher requested a review from a team as a code owner April 15, 2026 20:21
Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Looks good - thanks @alliasgher.

Worth noting #3478 is also modifying this func, so we need to be aware whichever comes second will have a conflict to resolve.

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved PRs

Development

Successfully merging this pull request may close these issues.

2 participants