Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZADD is broken - Instrumentation Redis init - Lumigo Opentelemetry 1.0.118 #547

Open
pasolid opened this issue Oct 26, 2023 · 0 comments
Open

Comments

@pasolid
Copy link

pasolid commented Oct 26, 2023

Last version of Lumigo Opentelemetry 1.0.118, the Redis instrumentation breaks Redis ZADD functionality

Exact placeumigo_opentelemetry/instrumentations/redis/__init__.p:
fix: update opentelemetry dependencies to patch security vulnerability

# when this hook is called, but only includes the command name for some
# versions so we need to set it ourselves.
add_body_attribute(span, " ".join(args), "db.statement")

Expected behavior

When calling the redis client zadd operation with multiple values like this:

redis_client.zadd("zset", {"One": 10, "Two": 20, "Three": 30})

it should add all values into the ZSet.

Actual result

The operation fails with next error:

args = ('ZADD', 'zset', 10, 'One', 20, 'Two', ...), kwargs = {}
    def request_hook(
        span: Span, instance: Connection, args: List[Any], kwargs: Dict[Any, Any]
    ) -> None:
        # a db.statement attribute is automatically added by the RedisInstrumentor
        # when this hook is called, but only includes the command name for some
        # versions so we need to set it ourselves.
>       add_body_attribute(span, " ".join(args), "db.statement")
E       TypeError: sequence item 2: expected str instance, int found
/usr/local/lib/python3.7/site-packages/lumigo_opentelemetry/instrumentations/redis/__init__.py:28: TypeError

Workaround

To downgrade to version 1.0.117

Potential solution

Revert to using json.dumps(args) or split into two parts:

  1. redis command which usually comes first
  2. redis command attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant