Skip to content

Commit 0615a72

Browse files
authored
Protect against short tuples (#141)
1 parent 7465ea2 commit 0615a72

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

instana/instrumentation/asynqp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def publish_with_instana(wrapped, instance, argv, kwargs):
3030
scope.span.set_tag("exchange", instance.name)
3131
scope.span.set_tag("sort", "publish")
3232
scope.span.set_tag("address", host + ":" + str(port) )
33-
scope.span.set_tag("key", argv[1])
33+
34+
if len(argv) > 1 and argv[1] is not None:
35+
scope.span.set_tag("key", argv[1])
3436

3537
rv = wrapped(*argv, **kwargs)
3638
except Exception as e:

tests/test_asynqp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_publish(self):
6666
@asyncio.coroutine
6767
def test():
6868
with async_tracer.start_active_span('test'):
69-
msg = asynqp.Message({'hello': 'world'})
69+
msg = asynqp.Message({'hello': 'world'}, content_type='application/json')
7070
self.exchange.publish(msg, 'routing.key')
7171

7272
self.loop.run_until_complete(test())

0 commit comments

Comments
 (0)