Skip to content

Redis instrumentor doesn't correctly build span metadata for cluster pipelines in redis > 6.x #4084

@gabrielecerami

Description

@gabrielecerami

Describe your environment

OS: All
Python version: All
Package version: All
Redis-py version: >= 6.x

What happened?

The redis instrumentor currently builds the span metadata for pipelines starting from the command_stack attribute in the Pipeline and ClusterPipeline objects.
see here

In redis-py 6 the cluster pipeline has been refactored, and although the command_stack attribute has been maintained in the ClusterPipeline object (see here) it is not updated anymore with the commands added to the pipeline. As a result, spans for the cluster pipeline in redis > 6 will always have an empty list of commands.

The commands are now appended to the AbstractStategy class (see here and here) which is inherited by the PipelineStrategy class.

The instrumentation will probably need a different set of functions to handle the cluster pipeline.

Steps to Reproduce

  1. Install redis-py > 6.x
  2. Enable redis instrumentation
  3. Examine traces created

Expected Result

ClusterPipeline span attribute DB_STATEMENT contains at least one command and db.redis.pipeline_length is > 0

Actual Result

For all ClusterPipelines span attribute DB_STATEMENT is empty and db.redis.pipeline_length is 0

Additional context

No response

Would you like to implement a fix?

Yes

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions