Skip to content

Commit

Permalink
Add span.is_recording check before adding additional parameters to spans
Browse files Browse the repository at this point in the history
  • Loading branch information
mpozniak95 committed Sep 17, 2024
1 parent 87374e4 commit fb3ba66
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ def _traced_execute_command(func, instance, args, kwargs):
span.set_attribute(SpanAttributes.DB_STATEMENT, query)
_set_connection_attributes(span, instance)
span.set_attribute("db.redis.args_length", len(args))
if span.name == "redis.create_index":
_add_create_attributes(span, args)
if callable(request_hook):
request_hook(span, instance, args, kwargs)
response = func(*args, **kwargs)
if span.name == "redis.search":
_add_search_attributes(span, response, args)
if span.name == "redis.create_index":
_add_create_attributes(span, args)
if span.is_recording():
if span.name == "redis.search":
_add_search_attributes(span, response, args)
if callable(response_hook):
response_hook(span, instance, response)
return response
Expand Down

0 comments on commit fb3ba66

Please sign in to comment.