-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Describe the feature
Python Async client creates OTel spans for regular commands in _execute_command and batches in _execute_batch, but _execute_script has no span creation at all. Script invocations (EVALSHA) are completely invisible in OTel traces.
Current behavior
_execute_command (glide_client.py:~423-445) — regular commands:
# Create span if OpenTelemetry is configured and sampling indicates we should trace
span = None
if OpenTelemetry.should_sample():
command_name = RequestType.Name(request_type)
span = create_otel_span(command_name)
# ...
# Add span pointer to request if span was created
if span:
request.root_span_ptr = span_execute_script (glide_client.py:~501-530) — script invocations:
# No span creation at all
request = CommandRequest()
request.callback_idx = self._get_callback_index()
# ... builds script_invocation or script_invocation_pointers ...
set_protobuf_route(request, route)
return await self._write_request_await_response(request)EVALSHA calls produce no OTel spans.
Expected behavior
_execute_script should create a span and attach it to the request, following the same pattern as _execute_command:
# Create span if OpenTelemetry is configured and sampling indicates we should trace
span = None
if OpenTelemetry.should_sample():
span = create_otel_span("EVALSHA")
request = CommandRequest()
request.callback_idx = self._get_callback_index()
# ... existing script_invocation setup ...
# Add span pointer to request if span was created
if span:
request.root_span_ptr = span
set_protobuf_route(request, route)
return await self._write_request_await_response(request)EVALSHA spans should appear in traces with DB semantic convention attributes (db.operation.name=EVALSHA, db.query.text, etc.). The span will be cleaned up by the existing drop_otel_span call in the response handler (glide_client.py:~694-696).
Use Case
Without any span, EVALSHA calls are completely invisible in OTel traces. Users cannot see script execution latency, errors, or DB attributes in their observability platform. This is a gap compared to regular commands and batches which both have span support.
Files to modify
python/glide-async/python/glide/glide_client.py—_execute_script(~line 501)- The
CommandRequestprotobuf already hasroot_span_ptr, andcreate_otel_spanis already imported — just needs to be used in the script path.
Reference
- Regular command span creation:
_execute_commandinglide_client.py:~423-445 - Batch span creation:
_execute_batchinglide_client.py:~465-496 - Span cleanup: response handler at
glide_client.py:~694-696 - OTel Semantic Conventions for Redis
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
Client version used
2.2.7
Environment details
macOS Tahoe 26.3