fix(redis): build ClusterPipeline span metadata from _execution_strategy in redis-py 6+ (#4728)
* fix(redis): build ClusterPipeline span metadata from _execution_strategy in redis-py 6+ redis-py 6 refactored ClusterPipeline so that queued commands are no longer appended to `command_stack`; they now live on `_execution_strategy.command_queue`. As a result the redis instrumentor emitted ClusterPipeline spans with an empty DB_STATEMENT and a `db.redis.pipeline_length` of 0. `_build_span_meta_data_for_pipeline` now reads commands from `_execution_strategy.command_queue` when present, falling back to `command_stack` / `_command_stack` for non-cluster pipelines and older redis-py versions. Fixes #4084 * chore(redis): rename changelog fragment to PR number * test(redis): add docker regression test for ClusterPipeline span metadata Exercises a real RedisCluster pipeline and asserts the redis-py 6+ code path (command_stack empty, _execution_strategy.command_queue populated) is genuinely hit before checking the emitted span statement and db.redis.pipeline_length. Guards against regression #4084. * Bump redis-py to 6.4.0 in docker tests so the ClusterPipeline regression test exercises the redis-py 6+ code path * Fix RediSearch import for redis-py 6+ in docker tests redis-py 6.x renamed redis.commands.search.indexDefinition to index_definition (snake_case). The camelCase module was removed, so bumping redis to 6.4.0 broke collection of the entire redis functional test module. IndexDefinition/IndexType are unchanged in the new module. * fix(redis): read async ClusterPipeline commands from private _command_queue The redis-py 6+ sync cluster strategy exposes queued commands via a public command_queue property, but the async cluster strategy only exposes the private _command_queue attribute. Reading only command_queue left the async ClusterPipeline span with an empty statement and a default "redis" name once the docker tests were bumped to redis-py 6.4.0. Resolve _command_queue as a fallback so both sync and async cluster pipelines populate span metadata. --------- Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
U
Utkarsh Batham committed
a8359fd8ac2ec5d3e22561a38bd57eee168540da
Parent: 79f9e57
Committed by GitHub <noreply@github.com>
on 7/17/2026, 9:36:29 AM