Skip to content

DM-54429: Update logging and unit tests#18

Merged
bsmartradio merged 2 commits into
mainfrom
tickets/DM-54429
May 8, 2026
Merged

DM-54429: Update logging and unit tests#18
bsmartradio merged 2 commits into
mainfrom
tickets/DM-54429

Conversation

@bsmartradio

Copy link
Copy Markdown
Contributor

No description provided.

Reduce logging to debug and add total messages stored log line
@bsmartradio bsmartradio requested a review from ebellm April 28, 2026 21:19

@ebellm ebellm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some questions about the daily reset behavior, maybe I'm missing something.

Comment thread alertingest/ingester.py
state_tracker["daily_stored"],
)
state_tracker["daily_stored"] = 0
state_tracker["day_start_time"] += one_day

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is going to get weird with things like leap seconds. Is there a reason not to use datetime or similar here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, you are right datetime is the way to go.

Comment thread alertingest/ingester.py
"""
one_day = 86400
while current_time - state_tracker["day_start_time"] >= one_day:
logger.info(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

don't you need to reset prefix_counts in here somewhere?

Comment thread alertingest/ingester.py
idle_seconds = current_time - prefix_last_write[prefix]
if idle_seconds >= self.prefix_idle_timeout:
logger.info(
"Alert prefix %s: %d alert(s) stored to S3 "

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Because I don't see the logic that resets prefix_counts daily, it seems like this will emit more and more logs over time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So you are right and prefix_counts don't reset daily, as they are meant to be a per prefix measure anyways since each prefix should only exist for a day. I do want to keep the logs over a certain period of time, but you are right and the current behavior means they will exist forever and the logging already occurs in logged_prefixes. I've changed it now so prefix_countsandprefix_last_writeis removed oncelogged_prefixes` happens.

@bsmartradio bsmartradio merged commit 15bece4 into main May 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants