You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
The current execution_context implementation is hardcoded to use a thread local implementation. Applications running under different threading paradigms, such as asyncio or tornado, require a different context implementation. The only current option available to extend is to monkeypatch the execution_context`.
In order to provide for extensibility, the execution_context could delegate it's method calls to a pluggable implementation, i.e.:
_execution_context_delegate=ThreadLocalExecutionContextDelegate()
defget_opencensus_tracer():
"""Get the opencensus tracer from thread local."""return_execution_context_manager.get_opencensus_tracer()
where the ThreadLocalExecutionContextDelegate is just an implementation of the existing execution_context methods. The configuration for the delegate class could either be set directly on the execution_context object (although having a stateful configuration method on the class seems like an anti-pattern) or by introducing a global configuration object like config_integration.
Happy to submit a PR with feedback on the approach.
The current
execution_contextimplementation is hardcoded to use a thread local implementation. Applications running under different threading paradigms, such asasyncioortornado, require a different context implementation. The only current option available to extend is to monkeypatch theexecution_context`.In order to provide for extensibility, the
execution_contextcould delegate it's method calls to a pluggable implementation, i.e.:where the
ThreadLocalExecutionContextDelegateis just an implementation of the existingexecution_contextmethods. The configuration for the delegate class could either be set directly on theexecution_contextobject (although having a stateful configuration method on the class seems like an anti-pattern) or by introducing a global configuration object likeconfig_integration.Happy to submit a PR with feedback on the approach.