mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-01 16:24:44 +00:00
add trace chunk count as span attr for async
This commit is contained in:
parent
e5c85b9dba
commit
4dd08e5595
1 changed files with 3 additions and 1 deletions
|
@ -102,10 +102,12 @@ def trace_protocol(cls: Type[T]) -> Type[T]:
|
|||
|
||||
with tracing.span(f"{class_name}.{method_name}", span_attributes) as span:
|
||||
try:
|
||||
count = 0
|
||||
async for item in method(self, *args, **kwargs):
|
||||
yield item
|
||||
count += 1
|
||||
finally:
|
||||
span.set_attribute("output", "streaming output")
|
||||
span.set_attribute("chunk_count", count)
|
||||
|
||||
@wraps(method)
|
||||
async def async_wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue