mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 14:02:36 +00:00
working nested tracing
This commit is contained in:
parent
9cebac8a3c
commit
d2e6e59647
2 changed files with 19 additions and 74 deletions
|
|
@ -123,7 +123,7 @@ def setup_logger(api: Telemetry, level: int = logging.INFO):
|
|||
logger.addHandler(TelemetryHandler())
|
||||
|
||||
|
||||
async def start_trace(name: str, attributes: Dict[str, Any] = None):
|
||||
async def start_trace(name: str, attributes: Dict[str, Any] = None) -> TraceContext:
|
||||
global CURRENT_TRACE_CONTEXT, BACKGROUND_LOGGER
|
||||
|
||||
if BACKGROUND_LOGGER is None:
|
||||
|
|
@ -135,6 +135,7 @@ async def start_trace(name: str, attributes: Dict[str, Any] = None):
|
|||
context.push_span(name, {"__root__": True, **(attributes or {})})
|
||||
|
||||
CURRENT_TRACE_CONTEXT = context
|
||||
return context
|
||||
|
||||
|
||||
async def end_trace(status: SpanStatus = SpanStatus.OK):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue