Skip to content
Snippets Groups Projects
Commit 0f80c4f1 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fix utils

parent 813b804c
No related branches found
No related tags found
No related merge requests found
......@@ -45,14 +45,23 @@ class Operation(object):
def span_exception(self, exception):
if self.parent_span is not None:
if self.processing_span is not None:
if self.enqueued_span is None:
from opentracing import tags, logs
self.processing_span.set_tag(tags.ERROR, True)
self.processing_span.log_kv({logs.EVENT: tags.ERROR,
self.enqueued_span.set_tag(tags.ERROR, True)
self.enqueued_span.log_kv({logs.EVENT: tags.ERROR,
logs.ERROR_KIND: exception,
logs.ERROR_OBJECT: exception})
self.processing_span.finish()
self.processing_span = None
self.enqueued_span.finish()
self.enqueued_span = None
if self.processing_span is not None:
from opentracing import tags, logs
self.processing_span.set_tag(tags.ERROR, True)
self.processing_span.log_kv({logs.EVENT: tags.ERROR,
logs.ERROR_KIND: exception,
logs.ERROR_OBJECT: exception})
self.processing_span.finish()
self.processing_span = None
if self.enqueued_span is not None:
self.enqueued_span.finish()
self.enqueued_span = None
......@@ -73,10 +82,12 @@ class Operation(object):
self.processing_span = self.declarer.cluster.tracer.start_span('Declaring',
child_of=self.parent_span,
references=follows_from(self.enqueued_span))
self.enqueued_span = None
def span_finished(self):
if self.parent_span is None:
if self.processing_span is None:
self.processing_span.finish()
self.processing_span = None
def span_begin(self):
if self.enqueued_span is not None:
......
......@@ -212,8 +212,8 @@ class Publisher(Channeler, Synchronized):
if not fut.set_running_or_notify_cancel():
if span_enqueued is not None:
import opentracing
span_enqueued.log_kv({opentracing.logs.EVENT: 'Cancelled'})
from opentracing import logs
span_enqueued.log_kv({logs.EVENT: 'Cancelled'})
span_enqueued.finish()
parent_span.finish()
continue # cancelled
......
......@@ -135,8 +135,7 @@ class AtomicTagger(object):
i = len(self.tags) - 1 # start index
while i > 0: # this will terminate at i=0
if self.tags[i][
0] > tag: # this means we should insert it here...
if self.tags[i][0] > tag: # this means we should insert it here...
break
i -= 1 # previousl index
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment