mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 16:12:46 +00:00
working telemetry v0
This commit is contained in:
parent
d790be28b3
commit
9cebac8a3c
10 changed files with 196 additions and 101 deletions
|
|
@ -20,7 +20,7 @@ from llama_stack.apis.telemetry import * # noqa: F403
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def generate_short_uuid(len: int = 12):
|
||||
def generate_short_uuid(len: int = 8):
|
||||
full_uuid = uuid.uuid4()
|
||||
uuid_bytes = full_uuid.bytes
|
||||
encoded = base64.urlsafe_b64encode(uuid_bytes)
|
||||
|
|
@ -130,7 +130,7 @@ async def start_trace(name: str, attributes: Dict[str, Any] = None):
|
|||
log.info("No Telemetry implementation set. Skipping trace initialization...")
|
||||
return
|
||||
|
||||
trace_id = generate_short_uuid()
|
||||
trace_id = generate_short_uuid(16)
|
||||
context = TraceContext(BACKGROUND_LOGGER, trace_id)
|
||||
context.push_span(name, {"__root__": True, **(attributes or {})})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue