fix(telemetry): jsonify attributes for easy unmarshalling

This commit is contained in:
Emilio Garcia 2025-10-14 11:16:04 -04:00
parent b3099d40e2
commit dafffe8d1e

View file

@ -70,7 +70,7 @@ def trace_protocol[T](cls: type[T]) -> type[T]:
"__class__": class_name, "__class__": class_name,
"__method__": method_name, "__method__": method_name,
"__type__": span_type, "__type__": span_type,
"__args__": str(combined_args), "__args__": json.dumps(combined_args),
} }
return class_name, method_name, span_attributes return class_name, method_name, span_attributes
@ -82,8 +82,8 @@ def trace_protocol[T](cls: type[T]) -> type[T]:
class_name, method_name, span_attributes = create_span_context(self, *args, **kwargs) class_name, method_name, span_attributes = create_span_context(self, *args, **kwargs)
with tracing.span(f"{class_name}.{method_name}", span_attributes) as span: with tracing.span(f"{class_name}.{method_name}", span_attributes) as span:
count = 0
try: try:
count = 0
async for item in method(self, *args, **kwargs): async for item in method(self, *args, **kwargs):
yield item yield item
count += 1 count += 1