From 54f572d5a9ba3a37ef8b97abcb7e04d64faf11fe Mon Sep 17 00:00:00 2001 From: Yaroslav Liakhovskyi Date: Wed, 16 Oct 2024 07:03:23 -0700 Subject: [PATCH 1/2] Handle AttributeError exceptions in logs CLI --- paasta_tools/cli/cmds/logs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paasta_tools/cli/cmds/logs.py b/paasta_tools/cli/cmds/logs.py index 5e7d44a0f4..99f1487edb 100644 --- a/paasta_tools/cli/cmds/logs.py +++ b/paasta_tools/cli/cmds/logs.py @@ -329,6 +329,9 @@ def paasta_app_output_passes_filter( # https://github.com/gweis/isodate/issues/53 except ValueError: return True + except AttributeError: + # timestamp might be missing at all + return False if not check_timestamp_in_range(timestamp, start_time, end_time): return False return ( From 4210e5b5beabb7b500d517982d769b8db8b46804 Mon Sep 17 00:00:00 2001 From: Yaroslav Liakhovskyi Date: Wed, 16 Oct 2024 07:28:49 -0700 Subject: [PATCH 2/2] Update comments --- paasta_tools/cli/cmds/logs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paasta_tools/cli/cmds/logs.py b/paasta_tools/cli/cmds/logs.py index 99f1487edb..f73f02286a 100644 --- a/paasta_tools/cli/cmds/logs.py +++ b/paasta_tools/cli/cmds/logs.py @@ -330,7 +330,10 @@ def paasta_app_output_passes_filter( except ValueError: return True except AttributeError: - # timestamp might be missing at all + # Timestamp might be missing. We had an issue where OTel was splitting overly long log lines + # and not including timestamps in the resulting log records (OBSPLAT-2216). + # Although this was then fixed in OTel, we should not rely on timestamps being present, + # as the format cannot be guaranteed. return False if not check_timestamp_in_range(timestamp, start_time, end_time): return False