Skip to content

Commit 6fbc62d

Browse files
committed
fix(aio-pika): Accept message & routing_key as either positional or kw args
Signed-off-by: Varsha GS <[email protected]>
1 parent ddceea5 commit 6fbc62d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/instana/instrumentation/aio_pika.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ async def publish_with_instana(
5151
"rabbitmq", span_context=parent_context
5252
) as span:
5353
connection = instance.channel._connection
54+
message = kwargs["message"] if kwargs.get("message") else args[0]
55+
routing_key = (
56+
kwargs["routing_key"] if kwargs.get("routing_key") else args[1]
57+
)
58+
5459
_extract_span_attributes(
55-
span, connection, "publish", kwargs["routing_key"], instance.name
60+
span, connection, "publish", routing_key, instance.name
5661
)
5762

58-
message = args[0]
5963
tracer.inject(
6064
span.context,
6165
Format.HTTP_HEADERS,

0 commit comments

Comments
 (0)