Skip to content

Commit 7146bfb

Browse files
committed
set context if None
1 parent c6132d5 commit 7146bfb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

elasticapm/instrumentation/packages/asyncio/aioredis.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def call(self, module, method, wrapped, instance, args, kwargs):
5656
) as span:
5757
if span.context is not None:
5858
span.context["destination"] = _get_destination_info(instance)
59+
else:
60+
span.context = {"destination": _get_destination_info(instance)}
5961

6062
return wrapped(*args, **kwargs)
6163

@@ -73,6 +75,8 @@ def call(self, module, method, wrapped, instance, args, kwargs):
7375
) as span:
7476
if span.context is not None:
7577
span.context["destination"] = _get_destination_info(instance)
78+
else:
79+
span.context = {"destination": _get_destination_info(instance)}
7680

7781
return wrapped(*args, **kwargs)
7882

0 commit comments

Comments
 (0)