You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/02/08 02:14:49 UTC

[skywalking-python] branch master updated: Fix sw-rabbitmq TypeError when there are no headers in message (#182)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git


The following commit(s) were added to refs/heads/master by this push:
     new c268dc9  Fix sw-rabbitmq TypeError when there are no headers in message (#182)
c268dc9 is described below

commit c268dc9542cf5d0b25478f42b49895c2fdfe322c
Author: dcryans <14...@users.noreply.github.com>
AuthorDate: Mon Feb 7 21:14:44 2022 -0500

    Fix sw-rabbitmq TypeError when there are no headers in message (#182)
---
 skywalking/plugins/sw_rabbitmq.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/skywalking/plugins/sw_rabbitmq.py b/skywalking/plugins/sw_rabbitmq.py
index a87c643..cc07a88 100644
--- a/skywalking/plugins/sw_rabbitmq.py
+++ b/skywalking/plugins/sw_rabbitmq.py
@@ -80,8 +80,11 @@ def _sw__on_deliver_func(__on_deliver):
         routing_key = method_frame.method.routing_key
         carrier = Carrier()
         for item in carrier:
-            if item.key in header_frame.properties.headers:
-                item.val = header_frame.properties.headers[item.key]
+            try:
+                if item.key in header_frame.properties.headers:
+                    item.val = header_frame.properties.headers[item.key]
+            except TypeError:
+                pass
 
         with context.new_entry_span(op='RabbitMQ/Topic/' + exchange + '/Queue/' + routing_key
                                        + '/Consumer' or '', carrier=carrier) as span: