-
-
Save ssorj/c989aa2f1188a9b6d0ffd76e5a45eee7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IncomingMessageHandler(ProtonIncomingMessageHandler): | |
def on_message(self, event): | |
if self.delegate is not None: | |
tracer = get_tracer() | |
message = event.message | |
receiver = event.receiver | |
connection = event.connection | |
span_tags = { | |
tags.SPAN_KIND: tags.SPAN_KIND_CONSUMER, | |
tags.MESSAGE_BUS_DESTINATION: receiver.source.address, | |
tags.PEER_ADDRESS: connection.connected_address, | |
tags.PEER_HOSTNAME: connection.hostname, | |
'inserted_by': 'proton-message-tracing' | |
} | |
if message.annotations is not None: | |
headers = message.annotations[_trace_key] # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
span_ctx = tracer.extract(Format.TEXT_MAP, headers) | |
with tracer.start_active_span('amqp-delivery-receive', child_of=span_ctx, tags=span_tags): | |
proton._events._dispatch(self.delegate, 'on_message', event) | |
else: | |
with tracer.start_active_span('amqp-delivery-receive', ignore_active_span=True, tags=span_tags): | |
proton._events._dispatch(self.delegate, 'on_message', event) | |
-- | |
BACKEND: Opened anonymous sender for responses | |
Traceback (most recent call last): | |
File "backends/python/app.py", line 91, in <module> | |
main() | |
File "backends/python/app.py", line 87, in main | |
container.run() | |
File "/usr/lib64/python3.7/site-packages/proton/_reactor.py", line 184, in run | |
while self.process(): pass | |
File "/usr/lib64/python3.7/site-packages/proton/_reactor.py", line 241, in process | |
event.dispatch(handler) | |
File "/usr/lib64/python3.7/site-packages/proton/_events.py", line 165, in dispatch | |
self.dispatch(h, type) | |
File "/usr/lib64/python3.7/site-packages/proton/_events.py", line 165, in dispatch | |
self.dispatch(h, type) | |
File "/usr/lib64/python3.7/site-packages/proton/_events.py", line 162, in dispatch | |
_dispatch(handler, type.method, self) | |
File "/usr/lib64/python3.7/site-packages/proton/_events.py", line 123, in _dispatch | |
m(*args) | |
File "/usr/lib64/python3.7/site-packages/proton/_handlers.py", line 260, in on_delivery | |
self.on_message(event) | |
File "/usr/lib64/python3.7/site-packages/proton/_tracing.py", line 90, in on_message | |
headers = message.annotations[_trace_key] | |
KeyError: symbol('x-opt-qpid-tracestate') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment