コード例 #1
1
def test_db_span():
    tracer = opentracing.tracer
    span = tracer.start_span(operation_name='parent')
    with span_in_context(span=span):
        with db_span(_COMMIT, 'MySQLdb') as child_span:
            assert span is child_span
        with db_span('select * from X', 'MySQLdb') as child_span:
            assert span is child_span
def test_db_span():
    tracer = Tracer()
    span = tracer.start_trace(operation_name='parent')
    with RequestContextManager(span=span):
        with db_span(_COMMIT, 'MySQLdb') as child_span:
            assert span is child_span
        with db_span('select * from X', 'MySQLdb') as child_span:
            assert span is child_span
コード例 #3
0
def test_db_span_without_parent():
    with db_span('test', 'MySQLdb') as span:
        assert span is None