store attributes values in builtin types to avoid otel warnings (#649)

# What does this PR do?

Serialize objects to built in types to avoid otel warnings


## Test Plan

╰─❯ llama stack run
~/.llama/distributions/llamastack-together/together-run.yaml
This commit is contained in:
Dinesh Yeduguru 2024-12-17 17:10:43 -08:00 committed by GitHub
parent 0e2a99e223
commit 3700022d6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View file

@ -16,6 +16,7 @@ from typing import Any, Callable, Dict, List
from llama_stack.apis.telemetry import * # noqa: F403
from llama_stack.providers.utils.telemetry.trace_protocol import serialize_value
log = logging.getLogger(__name__)
@ -223,7 +224,7 @@ class SpanContextManager:
if self.span:
if self.span.attributes is None:
self.span.attributes = {}
self.span.attributes[key] = value
self.span.attributes[key] = serialize_value(value)
async def __aenter__(self):
global CURRENT_TRACE_CONTEXT