From b5b7c649846275d79991f09f6a82fa704af544e3 Mon Sep 17 00:00:00 2001 From: Tai An Date: Thu, 10 Sep 2026 03:19:53 -0700 Subject: [PATCH] fix(observer): pass the pod list into log_for_query_filter log_for_query_filter is a module-level function, but its body reads `self.log_pod_list`. `self` is not defined there, so evaluating it raises NameError on the first log -- and the bare `except Exception: continue` right below swallows it and skips that log. Every log takes the same path, so the filter returns an empty list no matter what Elasticsearch returned, and LogAPI.query() always yields nothing. Take the pod list as a parameter and pass self.log_pod_list from the one call site in LogAPI.query(), which is the value the function was reaching for. Signed-off-by: Tai An --- aiopslab/observer/log_api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aiopslab/observer/log_api.py b/aiopslab/observer/log_api.py index 6a60b15f..c50bda5b 100644 --- a/aiopslab/observer/log_api.py +++ b/aiopslab/observer/log_api.py @@ -247,7 +247,7 @@ def query( scroll_id = page["_scroll_id"] except ConnectionTimeout as e: print("Connection Timeout:", e) - data = log_for_query_filter(data) + data = log_for_query_filter(data, self.log_pod_list) print("len data", len(data)) return data @@ -362,12 +362,12 @@ def log_processing_online_boutique(logs): return dt -def log_for_query_filter(logs): +def log_for_query_filter(logs, log_pod_list): filtered_log = [] for log in logs: try: cmdb_id = log["_source"]["kubernetes"]["pod"]["name"] - if cmdb_id not in self.log_pod_list: + if cmdb_id not in log_pod_list: continue except Exception as e: continue