mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-26 21:52:00 +00:00
chore(test): fix flaky telemetry tests
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
This commit is contained in:
parent
20c3197952
commit
81361add26
2 changed files with 9 additions and 4 deletions
|
|
@ -83,6 +83,7 @@ class SQLiteTraceStore(TraceStore):
|
||||||
)
|
)
|
||||||
SELECT DISTINCT trace_id, root_span_id, start_time, end_time
|
SELECT DISTINCT trace_id, root_span_id, start_time, end_time
|
||||||
FROM filtered_traces
|
FROM filtered_traces
|
||||||
|
WHERE root_span_id IS NOT NULL
|
||||||
LIMIT {limit} OFFSET {offset}
|
LIMIT {limit} OFFSET {offset}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -166,7 +167,11 @@ class SQLiteTraceStore(TraceStore):
|
||||||
return spans_by_id
|
return spans_by_id
|
||||||
|
|
||||||
async def get_trace(self, trace_id: str) -> Trace:
|
async def get_trace(self, trace_id: str) -> Trace:
|
||||||
query = "SELECT * FROM traces WHERE trace_id = ?"
|
query = """
|
||||||
|
SELECT *
|
||||||
|
FROM traces t
|
||||||
|
WHERE t.trace_id = ?
|
||||||
|
"""
|
||||||
async with aiosqlite.connect(self.conn_string) as conn:
|
async with aiosqlite.connect(self.conn_string) as conn:
|
||||||
conn.row_factory = aiosqlite.Row
|
conn.row_factory = aiosqlite.Row
|
||||||
async with conn.execute(query, (trace_id,)) as cursor:
|
async with conn.execute(query, (trace_id,)) as cursor:
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,12 @@ def setup_telemetry_data(llama_stack_client, text_model_id):
|
||||||
if len(traces) < 4:
|
if len(traces) < 4:
|
||||||
pytest.fail(f"Failed to create sufficient telemetry data after 30s. Got {len(traces)} traces.")
|
pytest.fail(f"Failed to create sufficient telemetry data after 30s. Got {len(traces)} traces.")
|
||||||
|
|
||||||
|
# Wait for 5 seconds to ensure traces has completed logging
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Skipping telemetry tests for now")
|
|
||||||
def test_query_traces_basic(llama_stack_client):
|
def test_query_traces_basic(llama_stack_client):
|
||||||
"""Test basic trace querying functionality with proper data validation."""
|
"""Test basic trace querying functionality with proper data validation."""
|
||||||
all_traces = llama_stack_client.telemetry.query_traces(limit=5)
|
all_traces = llama_stack_client.telemetry.query_traces(limit=5)
|
||||||
|
|
@ -106,7 +108,6 @@ def test_query_traces_basic(llama_stack_client):
|
||||||
assert hasattr(trace, "root_span_id") and trace.root_span_id, "Each trace should have non-empty root_span_id"
|
assert hasattr(trace, "root_span_id") and trace.root_span_id, "Each trace should have non-empty root_span_id"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Skipping telemetry tests for now")
|
|
||||||
def test_query_spans_basic(llama_stack_client):
|
def test_query_spans_basic(llama_stack_client):
|
||||||
"""Test basic span querying functionality with proper validation."""
|
"""Test basic span querying functionality with proper validation."""
|
||||||
spans = llama_stack_client.telemetry.query_spans(attribute_filters=[], attributes_to_return=[])
|
spans = llama_stack_client.telemetry.query_spans(attribute_filters=[], attributes_to_return=[])
|
||||||
|
|
@ -155,7 +156,6 @@ def test_query_spans_basic(llama_stack_client):
|
||||||
assert hasattr(span, attr) and getattr(span, attr), f"All spans should have non-empty {attr}"
|
assert hasattr(span, attr) and getattr(span, attr), f"All spans should have non-empty {attr}"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Skipping telemetry tests for now")
|
|
||||||
def test_telemetry_pagination(llama_stack_client):
|
def test_telemetry_pagination(llama_stack_client):
|
||||||
"""Test pagination in telemetry queries."""
|
"""Test pagination in telemetry queries."""
|
||||||
# Get total count of traces
|
# Get total count of traces
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue