aws_xray_sdk.core.async_context

Module Contents

class AsyncContext(*args, loop=None, use_task_factory=True, **kwargs)

Bases:aws_xray_sdk.core.context.Context

Async Context for storing segments.

Inherits nearly everything from the main Context class. Replaces threading.local with a task based local storage class, Also overrides clear_trace_entities

clear_trace_entities(self)

Clear all trace_entities stored in the task local context.

class TaskLocalStorage(loop=None)

Bases:object

Simple task local storage

__setattr__(self, name, value)
__getattribute__(self, item)
clear(self)
task_factory(loop, coro)

Task factory function

Fuction closely mirrors the logic inside of asyncio.BaseEventLoop.create_task. Then if there is a current task and the current task has a context then share that context with the new task