tracing fixes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-08-04 15:20:29 +02:00
parent 977fc98ed2
commit ee9dea06fb
3 changed files with 34 additions and 30 deletions

View File

@@ -19,16 +19,16 @@ from magic_doer import MagicDoer
def message_callback(channel, method, properties, body):
with opentracing.tracer.start_active_span('messageHandling', finish_on_close=True) as span:
with opentracing.tracer.start_active_span('main.handleMessage', finish_on_close=True) as scope:
try:
msg = json.loads(body.decode('utf-8'))
except (UnicodeDecodeError, json.JSONDecodeError) as e:
logging.warning(f"Invalid message recieved: {e}")
return
span.log_kv({'event': 'messageParsed', 'sampleTag': msg['tag']})
scope.span.log_kv({'event': 'messageParsed', 'sampleTag': msg['tag']})
with opentracing.tracer.start_active_span('runAlgorithm', child_of=span) as child_span:
with opentracing.tracer.start_active_span('magicDoer.run_everything'):
results = MagicDoer.run_everything(msg) # <- This is where the magic happens
if results: