Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions libs/kest-core/python/src/kest/core/telemetry/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,20 @@ def _init_db(self):
def export(self, spans):
"""Inserts a batch of spans into the SQLite database."""
with sqlite3.connect(self.db_path) as conn:
for span in spans:
conn.execute(
"INSERT OR REPLACE INTO spans (id, trace_id, name, start_time, end_time, attributes) VALUES (?, ?, ?, ?, ?, ?)",
conn.executemany(
"INSERT OR REPLACE INTO spans (id, trace_id, name, start_time, end_time, attributes) VALUES (?, ?, ?, ?, ?, ?)",
(
(
str(span.context.span_id),
str(span.context.trace_id),
span.name,
span.start_time,
span.end_time,
json.dumps(dict(span.attributes) if span.attributes else {}),
),
)
)
for span in spans
),
)
return True

def shutdown(self):
Expand Down
Loading