def test_succeeded_existing_span(self):
        tracer = MockTracer()
        tracing = CommandTracing(tracer, span_tags=dict(one=123))
        event = MockEvent()
        tracing.started(event)
        scope = tracing._scopes.get('request_id')
        tracing.succeeded(event)
        assert tracing._scopes.get('request_id') is None

        tags = scope.span.tags
        assert tags['event.reply'] == json.dumps(event.reply)
        assert tags['reported_duration'] == event.duration_micros
 def test_succeeded_no_existing_scope(self):
     tracer = MockTracer()
     tracing = CommandTracing(tracer, span_tags=dict(one=123))
     tracing.succeeded(MockEvent())