How to use the opentelemetry-api.src.opentelemetry.context.async_context.AsyncRuntimeContext function in opentelemetry-api

To help you get started, we’ve selected a few opentelemetry-api 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 open-telemetry / opentelemetry-python / opentelemetry-api / src / opentelemetry / context / __init__.py View on Github external
print(Context)
            await asyncio.sleep(0.1)
        print(Context)

    if __name__ == '__main__':
        asyncio.run(main())
"""

from .base_context import BaseRuntimeContext

__all__ = ["Context"]

try:
    from .async_context import AsyncRuntimeContext

    Context = AsyncRuntimeContext()  # type: BaseRuntimeContext
except ImportError:
    from .thread_local_context import ThreadLocalRuntimeContext

    Context = ThreadLocalRuntimeContext()

opentelemetry-api

OpenTelemetry Python API

Apache-2.0
Latest version published 11 days ago

Package Health Score

94 / 100
Full package analysis