Esempio n. 1
0
def test_http_no_context_extract():
    ot.tracer = InstanaTracer()

    carrier = {}
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert ctx is None
def test_text_mixed_case_extract():
    ot.tracer = InstanaTracer()

    carrier = {'x-insTana-T': '1', 'X-inSTANa-S': '1', 'X-INstana-l': '1'}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert (ctx is None)
Esempio n. 3
0
def test_text_no_context_extract():
    ot.tracer = InstanaTracer()

    carrier = {}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert ctx is None
Esempio n. 4
0
def test_binary_no_context_extract():
    ot.tracer = InstanaTracer()

    carrier = {}
    ctx = ot.tracer.extract(ot.Format.BINARY, carrier)

    assert ctx is None
Esempio n. 5
0
def test_text_no_context_extract():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert ctx is None
Esempio n. 6
0
def test_text_basic_extract():
    ot.tracer = InstanaTracer()

    carrier = {'x-instana-t': '1', 'x-instana-s': '1', 'x-instana-l': '1'}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert isinstance(ctx, SpanContext)
    assert ctx.trace_id == '0000000000000001'
    assert ctx.span_id == '0000000000000001'
def test_text_basic_extract():
    ot.tracer = InstanaTracer()

    carrier = {'X-INSTANA-T': '1', 'X-INSTANA-S': '1', 'X-INSTANA-L': '1'}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert isinstance(ctx, span.SpanContext)
    assert ('0000000000000001' == ctx.trace_id)
    assert ('0000000000000001' == ctx.span_id)
Esempio n. 8
0
def test_text_mixed_case_extract():
    ot.tracer = InstanaTracer()

    carrier = {'x-insTana-T': '1', 'X-inSTANa-S': '1', 'X-INstana-l': '1'}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert isinstance(ctx, SpanContext)
    assert ctx.trace_id == '0000000000000001'
    assert ctx.span_id == '0000000000000001'
Esempio n. 9
0
def test_http_inject_with_list():
    ot.tracer = InstanaTracer()

    carrier = []
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.HTTP_HEADERS, carrier)

    assert ('X-INSTANA-T', span.context.trace_id) in carrier
    assert ('X-INSTANA-S', span.context.span_id) in carrier
    assert ('X-INSTANA-L', "1") in carrier
Esempio n. 10
0
def test_text_basic_extract():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {'X-INSTANA-T': '1', 'X-INSTANA-S': '1', 'X-INSTANA-L': '1'}
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert type(ctx) is span_context.InstanaSpanContext
    assert_equals('0000000000000001', ctx.trace_id)
    assert_equals('0000000000000001', ctx.span_id)
Esempio n. 11
0
def test_http_mixed_case_extract():
    ot.tracer = InstanaTracer()

    carrier = {'x-insTana-T': '1', 'X-inSTANa-S': '1', 'X-INstana-l': '1'}
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert isinstance(ctx, SpanContext)
    assert ctx.trace_id == '0000000000000001'
    assert ctx.span_id == '0000000000000001'
    assert not ctx.synthetic
Esempio n. 12
0
def test_http_extract_synthetic_only():
    ot.tracer = InstanaTracer()

    carrier = {'X-INSTANA-SYNTHETIC': '1'}
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert isinstance(ctx, SpanContext)
    assert ctx.trace_id is None
    assert ctx.span_id is None
    assert ctx.synthetic
Esempio n. 13
0
def test_text_inject_with_list():
    ot.tracer = InstanaTracer()

    carrier = []
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.TEXT_MAP, carrier)

    assert ('x-instana-t', span.context.trace_id) in carrier
    assert ('x-instana-s', span.context.span_id) in carrier
    assert ('x-instana-l', "1") in carrier
Esempio n. 14
0
def test_basic_extract():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {'X-Instana-T': '1', 'X-Instana-S': '1', 'X-Instana-L': '1'}
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert type(ctx) is basictracer.context.SpanContext
    assert_equals('0000000000000001', ctx.trace_id)
    assert_equals('0000000000000001', ctx.span_id)
Esempio n. 15
0
def test_http_mixed_case_extract():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {'x-insTana-T': '1', 'X-inSTANa-S': '1', 'X-INstana-l': '1'}
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert type(ctx) is span_context.InstanaSpanContext
    assert_equals('0000000000000001', ctx.trace_id)
    assert_equals('0000000000000001', ctx.span_id)
Esempio n. 16
0
def test_binary_inject_with_list():
    ot.tracer = InstanaTracer()

    carrier = []
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.BINARY, carrier)

    assert (b'x-instana-t', str.encode(span.context.trace_id)) in carrier
    assert (b'x-instana-s', str.encode(span.context.span_id)) in carrier
    assert (b'x-instana-l', b'1') in carrier
Esempio n. 17
0
def test_128bit_headers():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {'X-Instana-T': '0000000000000000b0789916ff8f319f',
               'X-Instana-S': '0000000000000000b0789916ff8f319f', 'X-Instana-L': '1'}
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert type(ctx) is basictracer.context.SpanContext
    assert_equals('b0789916ff8f319f', ctx.trace_id)
    assert_equals('b0789916ff8f319f', ctx.span_id)
Esempio n. 18
0
def test_text_inject_with_list():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = []
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.TEXT_MAP, carrier)

    assert ('X-INSTANA-T', span.context.trace_id) in carrier
    assert ('X-INSTANA-S', span.context.span_id) in carrier
    assert ('X-INSTANA-L', "1") in carrier
Esempio n. 19
0
def test_binary_inject_with_dict():
    ot.tracer = InstanaTracer()

    carrier = {}
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.BINARY, carrier)

    assert b'x-instana-t' in carrier
    assert carrier[b'x-instana-t'] == str.encode(span.context.trace_id)
    assert b'x-instana-s' in carrier
    assert carrier[b'x-instana-s'] == str.encode(span.context.span_id)
    assert b'x-instana-l' in carrier
    assert carrier[b'x-instana-l'] == b'1'
def test_text_inject_with_dict():
    ot.tracer = InstanaTracer()

    carrier = {}
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.TEXT_MAP, carrier)

    assert 'X-INSTANA-T' in carrier
    assert (carrier['X-INSTANA-T'] == span.context.trace_id)
    assert 'X-INSTANA-S' in carrier
    assert (carrier['X-INSTANA-S'] == span.context.span_id)
    assert 'X-INSTANA-L' in carrier
    assert (carrier['X-INSTANA-L'] == "1")
def test_text_128bit_headers():
    ot.tracer = InstanaTracer()

    carrier = {
        'X-INSTANA-T': '0000000000000000b0789916ff8f319f',
        'X-INSTANA-S': ' 0000000000000000b0789916ff8f319f',
        'X-INSTANA-L': '1'
    }
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert isinstance(ctx, span.SpanContext)
    assert ('b0789916ff8f319f' == ctx.trace_id)
    assert ('b0789916ff8f319f' == ctx.span_id)
Esempio n. 22
0
def test_text_inject_with_dict():
    ot.tracer = InstanaTracer()

    carrier = {}
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.TEXT_MAP, carrier)

    assert 'x-instana-t' in carrier
    assert carrier['x-instana-t'] == span.context.trace_id
    assert 'x-instana-s' in carrier
    assert carrier['x-instana-s'] == span.context.span_id
    assert 'x-instana-l' in carrier
    assert carrier['x-instana-l'] == "1"
def test_http_128bit_headers():
    ot.tracer = InstanaTracer()

    carrier = {
        'X-Instana-T': '0000000000000000b0789916ff8f319f',
        'X-Instana-S': '0000000000000000b0789916ff8f319f',
        'X-Instana-L': '1'
    }
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert isinstance(ctx, span.SpanContext)
    assert ('b0789916ff8f319f' == ctx.trace_id)
    assert ('b0789916ff8f319f' == ctx.span_id)
Esempio n. 24
0
def test_http_inject_with_dict():
    ot.tracer = InstanaTracer()

    carrier = {}
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.HTTP_HEADERS, carrier)

    assert 'X-INSTANA-T' in carrier
    assert carrier['X-INSTANA-T'] == span.context.trace_id
    assert 'X-INSTANA-S' in carrier
    assert carrier['X-INSTANA-S'] == span.context.span_id
    assert 'X-INSTANA-L' in carrier
    assert carrier['X-INSTANA-L'] == "1"
Esempio n. 25
0
def test_inject_with_list():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = []
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.HTTP_HEADERS, carrier)

    assert ('X-Instana-T', span.context.trace_id) in carrier
    assert ('X-Instana-S', span.context.span_id) in carrier
    assert ('X-Instana-L', "1") in carrier
    server_timing_value = "intid;desc=%s" % span.context.trace_id
    assert ('Server-Timing', server_timing_value) in carrier
Esempio n. 26
0
def test_binary_128bit_headers():
    ot.tracer = InstanaTracer()

    carrier = {
        'X-INSTANA-T': '0000000000000000b0789916ff8f319f',
        'X-INSTANA-S': ' 0000000000000000b0789916ff8f319f',
        'X-INSTANA-L': '1'
    }
    ctx = ot.tracer.extract(ot.Format.BINARY, carrier)

    assert isinstance(ctx, SpanContext)
    assert ctx.trace_id == 'b0789916ff8f319f'
    assert ctx.span_id == 'b0789916ff8f319f'
Esempio n. 27
0
def test_http_extract_from_list_of_tuples():
    ot.tracer = InstanaTracer()

    carrier = [(b'user-agent', b'python-requests/2.23.0'),
               (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'),
               (b'connection', b'keep-alive'), (b'x-instana-t', b'1'),
               (b'x-instana-s', b'1'), (b'x-instana-l', b'1'),
               (b'X-INSTANA-SYNTHETIC', '1')]
    ctx = ot.tracer.extract(ot.Format.HTTP_HEADERS, carrier)

    assert isinstance(ctx, SpanContext)
    assert ctx.trace_id == '0000000000000001'
    assert ctx.span_id == '0000000000000001'
    assert ctx.synthetic
Esempio n. 28
0
def test_text_inject_with_dict():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {}
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.TEXT_MAP, carrier)

    assert 'X-INSTANA-T' in carrier
    assert_equals(carrier['X-INSTANA-T'], span.context.trace_id)
    assert 'X-INSTANA-S' in carrier
    assert_equals(carrier['X-INSTANA-S'], span.context.span_id)
    assert 'X-INSTANA-L' in carrier
    assert_equals(carrier['X-INSTANA-L'], "1")
Esempio n. 29
0
def test_text_128bit_headers():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {
        'X-INSTANA-T': '0000000000000000b0789916ff8f319f',
        'X-INSTANA-S': ' 0000000000000000b0789916ff8f319f',
        'X-INSTANA-L': '1'
    }
    ctx = ot.tracer.extract(ot.Format.TEXT_MAP, carrier)

    assert type(ctx) is span_context.InstanaSpanContext
    assert_equals('b0789916ff8f319f', ctx.trace_id)
    assert_equals('b0789916ff8f319f', ctx.span_id)
Esempio n. 30
0
def test_http_inject_with_dict():
    opts = options.Options()
    ot.tracer = InstanaTracer(opts)

    carrier = {}
    span = ot.tracer.start_span("nosetests")
    ot.tracer.inject(span.context, ot.Format.HTTP_HEADERS, carrier)

    assert 'X-Instana-T' in carrier
    assert_equals(carrier['X-Instana-T'], span.context.trace_id)
    assert 'X-Instana-S' in carrier
    assert_equals(carrier['X-Instana-S'], span.context.span_id)
    assert 'X-Instana-L' in carrier
    assert_equals(carrier['X-Instana-L'], "1")