From 41dc9c2f44839cf7f05c3d21ff01b6c5ac5c25b8 Mon Sep 17 00:00:00 2001 From: Tim Sweeney Date: Tue, 29 Oct 2024 01:55:04 -0700 Subject: [PATCH] Fix test --- .../clickhouse_trace_server_batched.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/weave/trace_server/clickhouse_trace_server_batched.py b/weave/trace_server/clickhouse_trace_server_batched.py index 160448a5974..fe1cb6c7288 100644 --- a/weave/trace_server/clickhouse_trace_server_batched.py +++ b/weave/trace_server/clickhouse_trace_server_batched.py @@ -1967,24 +1967,29 @@ def _get_matched_calls_for_filters( def _flush_calls(self) -> None: if not self._call_batch: return - assert self._call_batch.project_id is not None + calls = self._call_batch.calls + if not calls: + return + project_id = self._call_batch.project_id + + assert project_id is not None try: - self._insert_call_batch(self._call_batch.calls) + self._insert_call_batch(calls) except InsertTooLarge: logger.info("Retrying with large objects stripped.") - batch = self._strip_large_values(self._call_batch.calls) + batch = self._strip_large_values(calls) self._insert_call_batch(batch) # Find and process matched calls for each filter matched_filters_and_calls = self._get_matched_calls_for_filters( - self._call_batch.project_id, self._call_batch.call_ids + project_id, self._call_batch.call_ids ) for filter, filter_ref, matched_calls in matched_filters_and_calls: self.actions_execute_batch( tsi.ActionsExecuteBatchReq( - project_id=self._call_batch.project_id, + project_id=project_id, call_ids=[call.id for call in matched_calls], configured_action_ref=filter.configured_action_ref, trigger_ref=filter_ref,