Exemple #1
0
 def test_close_span(self):
     # it should keep track of closed spans, moving
     # the current active to its parent
     ctx = Context()
     span = Span(tracer=None, name="fake_span")
     ctx.add_span(span)
     ctx.close_span(span)
     assert ctx.get_current_span() is None
Exemple #2
0
    def test_add_span(self):
        ctx = Context()
        span = Span(tracer=None, name="fake_span")
        ctx.add_span(span)
        assert ctx == span.context
        assert ctx.span_id == span.span_id
        assert ctx.get_current_span() == span
        assert ctx.get_current_root_span() == span

        span2 = Span(tracer=None, name="fake_span2")
        span2.parent_id = span.span_id
        span2._parent = span
        ctx.add_span(span2)
        assert ctx == span2.context
        assert ctx.span_id == span2.span_id
        assert ctx.get_current_span() == span2
        assert ctx.get_current_root_span() == span
Exemple #3
0
 def test_close_span(self):
     # it should keep track of closed spans, moving
     # the current active to it's parent
     ctx = Context()
     span = Span(tracer=None, name='fake_span')
     ctx.add_span(span)
     ctx.close_span(span)
     eq_(1, ctx._finished_spans)
     ok_(ctx.get_current_span() is None)
Exemple #4
0
 def test_close_span(self):
     # it should keep track of closed spans, moving
     # the current active to it's parent
     ctx = Context()
     span = Span(tracer=None, name='fake_span')
     ctx.add_span(span)
     ctx.close_span(span)
     eq_(1, ctx._finished_spans)
     ok_(ctx.get_current_span() is None)
Exemple #5
0
 def test_current_span(self):
     # it should return the current active span
     ctx = Context()
     span = Span(tracer=None, name='fake_span')
     ctx.add_span(span)
     assert span == ctx.get_current_span()
Exemple #6
0
 def test_current_span(self):
     # it should return the current active span
     ctx = Context()
     span = Span(tracer=None, name='fake_span')
     ctx.add_span(span)
     eq_(span, ctx.get_current_span())