mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
Revert "add tracing to library client (#591)"
This reverts commit bc1fddf1df
.
This commit is contained in:
parent
16d103842a
commit
2e3d3a62a5
2 changed files with 17 additions and 49 deletions
|
@ -20,7 +20,6 @@ class SQLiteSpanProcessor(SpanProcessor):
|
|||
"""Initialize the SQLite span processor with a connection string."""
|
||||
self.conn_string = conn_string
|
||||
self.ttl_days = ttl_days
|
||||
self._shutdown_event = threading.Event()
|
||||
self.cleanup_task = None
|
||||
self._thread_local = threading.local()
|
||||
self._connections: Dict[int, sqlite3.Connection] = {}
|
||||
|
@ -145,10 +144,9 @@ class SQLiteSpanProcessor(SpanProcessor):
|
|||
"""Run cleanup periodically."""
|
||||
import time
|
||||
|
||||
while not self._shutdown_event.is_set():
|
||||
while True:
|
||||
time.sleep(3600) # Sleep for 1 hour
|
||||
if not self._shutdown_event.is_set():
|
||||
self._cleanup_old_data()
|
||||
self._cleanup_old_data()
|
||||
|
||||
def on_start(self, span: Span, parent_context=None):
|
||||
"""Called when a span starts."""
|
||||
|
@ -233,23 +231,11 @@ class SQLiteSpanProcessor(SpanProcessor):
|
|||
|
||||
def shutdown(self):
|
||||
"""Cleanup any resources."""
|
||||
self._shutdown_event.set()
|
||||
|
||||
# Wait for cleanup thread to finish if it exists
|
||||
if self.cleanup_task and self.cleanup_task.is_alive():
|
||||
self.cleanup_task.join(timeout=5.0)
|
||||
current_thread_id = threading.get_ident()
|
||||
|
||||
with self._lock:
|
||||
# Close all connections from the current thread
|
||||
for thread_id, conn in list(self._connections.items()):
|
||||
if thread_id == current_thread_id:
|
||||
try:
|
||||
if conn:
|
||||
conn.close()
|
||||
del self._connections[thread_id]
|
||||
except sqlite3.Error:
|
||||
pass # Ignore errors during shutdown
|
||||
for conn in self._connections.values():
|
||||
if conn:
|
||||
conn.close()
|
||||
self._connections.clear()
|
||||
|
||||
def force_flush(self, timeout_millis=30000):
|
||||
"""Force export of spans."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue