mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 22:59:47 +00:00
explicit span management using with
This commit is contained in:
parent
6411007024
commit
b3021ea2da
3 changed files with 114 additions and 96 deletions
|
|
@ -253,3 +253,11 @@ class SpanContextManager:
|
|||
|
||||
def span(name: str, attributes: Dict[str, Any] = None):
|
||||
return SpanContextManager(name, attributes)
|
||||
|
||||
|
||||
def get_current_span() -> Optional[Span]:
|
||||
global CURRENT_TRACE_CONTEXT
|
||||
context = CURRENT_TRACE_CONTEXT
|
||||
if context:
|
||||
return context.get_current_span()
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue