def tracer(): original_tracer = ddtrace.tracer tracer = DummyTracer() if sys.version_info < (3, 7): # enable legacy asyncio support from ddtrace.contrib.asyncio.provider import AsyncioContextProvider tracer.configure(context_provider=AsyncioContextProvider()) setattr(ddtrace, "tracer", tracer) fastapi_patch() yield tracer setattr(ddtrace, "tracer", original_tracer) fastapi_unpatch()
def snapshot_app(): fastapi_patch() application = app.get_app() yield application fastapi_unpatch()