mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-31 16:01:46 +00:00
fix(telemetry): get rid of annoying sqlite span export error
This commit is contained in:
parent
3faf1e4a79
commit
83d02df028
1 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,7 @@ import os
|
|||
import sqlite3
|
||||
import threading
|
||||
from datetime import datetime, timezone
|
||||
from enum import Enum
|
||||
|
||||
from opentelemetry.sdk.trace import SpanProcessor
|
||||
from opentelemetry.trace import Span
|
||||
|
@ -153,6 +154,9 @@ class SQLiteSpanProcessor(SpanProcessor):
|
|||
)
|
||||
|
||||
for event in span.events:
|
||||
name = event.name
|
||||
if isinstance(name, Enum):
|
||||
name = name.value
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO span_events (
|
||||
|
@ -161,7 +165,7 @@ class SQLiteSpanProcessor(SpanProcessor):
|
|||
""",
|
||||
(
|
||||
span_id,
|
||||
event.name,
|
||||
name,
|
||||
datetime.fromtimestamp(event.timestamp / 1e9, timezone.utc).isoformat(),
|
||||
json.dumps(dict(event.attributes)),
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue