Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle AttributeError exceptions in logs CLI #3980

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions paasta_tools/cli/cmds/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a little more context about why they might be missing just to prevent someone from looking at logs in the future, seeing that they all have a timestamp field, and then deleting this block!

e.g., vector/otel-collector will split long log-lines and we might end up with entries that have missing fields - see TICKET-XXXX

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, added. Although catching AttributeError is probably a good practice disregard whether there is an actual issue or not :)

return False
if not check_timestamp_in_range(timestamp, start_time, end_time):
return False
return (
Expand Down
Loading