How to use the aiozipkin.helpers.make_context function in aiozipkin

To help you get started, we’ve selected a few aiozipkin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aiozipkin / tests / test_helpers.py View on Github external
def test_make_context_single_header(trace_context, other_trace_context):
    headers = make_single_header(trace_context)
    context = make_context(headers)
    assert trace_context == context

    headers = make_single_header(other_trace_context)
    context = make_context(headers)
    assert other_trace_context == context

    headers = {'b3': '0'}
    context = make_context(headers)
    assert context is None

    headers = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4'}
    context = make_context(headers)
    assert context is None
github aio-libs / aiozipkin / tests / test_helpers.py View on Github external
def test_make_context_single_header(trace_context, other_trace_context):
    headers = make_single_header(trace_context)
    context = make_context(headers)
    assert trace_context == context

    headers = make_single_header(other_trace_context)
    context = make_context(headers)
    assert other_trace_context == context

    headers = {'b3': '0'}
    context = make_context(headers)
    assert context is None

    headers = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4'}
    context = make_context(headers)
    assert context is None
github aio-libs / aiozipkin / tests / test_helpers.py View on Github external
def test_make_context(trace_context):
    headers = make_headers(trace_context)
    context = make_context(headers)
    assert trace_context == context

    context = make_context({})
    assert context is None
github aio-libs / aiozipkin / tests / test_helpers.py View on Github external
def test_make_context(trace_context):
    headers = make_headers(trace_context)
    context = make_context(headers)
    assert trace_context == context

    context = make_context({})
    assert context is None
github aio-libs / aiozipkin / aiozipkin / aiohttp_helpers.py View on Github external
def _get_span(request: Request, tracer: Tracer) -> SpanAbc:
    # builds span from incoming request, if no context found, create
    # new span
    context = make_context(request.headers)

    if context is None:
        sampled = parse_sampled_header(request.headers)
        debug = parse_debug_header(request.headers)
        span = tracer.new_trace(sampled=sampled, debug=debug)
    else:
        span = tracer.join_span(context)
    return span