Skip to content
Open
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `pylint` to `4.0.5`
([#4244](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4244))

### Fixed

- `opentelemetry-instrumentation-redis`: Extract `ClusterPipeline` commands from `_execution_strategy` in redis-py 6+ so span attributes include the pipelined commands instead of being empty
([#4436](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4436))

### Breaking changes

- Drop Python 3.9 support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,17 @@ def _build_span_meta_data_for_pipeline(
instance: PipelineInstance | AsyncPipelineInstance,
) -> tuple[list[Any], str, str]:
try:
command_stack = (
instance.command_stack
if hasattr(instance, "command_stack")
else instance._command_stack
)
# redis-py 6+ ClusterPipeline stores commands on _execution_strategy.
# Fall back to command_stack / _command_stack for older versions and
# non-cluster pipelines.
if hasattr(instance, "_execution_strategy") and hasattr(
instance._execution_strategy, "command_queue"
):
command_stack = instance._execution_strategy.command_queue
elif hasattr(instance, "command_stack"):
command_stack = instance.command_stack
else:
command_stack = instance._command_stack

cmds = [
_format_command_args(c.args if hasattr(c, "args") else c[0])
Expand Down