Example #1
0
def tracer(engine):
    original_tracer = ddtrace.tracer
    tracer = DummyTracer()
    if sys.version_info < (3, 7):
        # enable legacy asyncio support
        from ddtrace.contrib.asyncio.provider import AsyncioContextProvider

        Pin.override(engine, tracer=tracer)
        tracer.configure(context_provider=AsyncioContextProvider())

    setattr(ddtrace, "tracer", tracer)
    starlette_patch()
    yield tracer
    setattr(ddtrace, "tracer", original_tracer)
    starlette_unpatch()
Example #2
0
def snapshot_app(engine):
    starlette_patch()
    app = get_app(engine)
    yield app
    starlette_unpatch()