-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Ct 1191 event history cleanup #5858
Conversation
af3fe3d
to
b6062ab
Compare
# TODO the flags module has not yet been resolved when this is created | ||
global EVENT_HISTORY | ||
EVENT_HISTORY = deque(maxlen=flags.EVENT_BUFFER_SIZE) # type: ignore | ||
EVENT_HISTORY = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating the deque here, I check and create it when calling 'fire_event'.
@@ -52,10 +44,6 @@ | |||
|
|||
|
|||
def setup_event_logger(log_path, level_override=None): | |||
# flags have been resolved, and log_path is known |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed setting the event_history here because of discussions we have about events not lasting for multiple calls. Does this make sense? Would it be better to reset it here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Makes sense that EVENT_HISTORY
wants to last for the duration of the application, rather than just the duration of the invocation
global EVENT_HISTORY | ||
if EVENT_HISTORY is None: | ||
reset_event_history() | ||
EVENT_HISTORY.append(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stopped emitting the EventBufferFull event here because for small deque sizes we'd get strange behavior. What do we do if the deque is set to 1? to 2? Event at 10, we'd get a really high numberof EventBufferFull messages. I'm also not sure what the utility of the EventBufferFull message is.
Is this the right way to go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that this message is oftentimes confusing / misleading for users. I do get why we added it, though. Let's keep it if EventBuffer is >=10000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
|
||
def add_to_event_history(event): | ||
if flags.EVENT_BUFFER_SIZE == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to turn the event buffer off by setting to 0, which we couldn't do before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, all function in the description achieved!
resolves #5848
Description
Some logging events were holding references to nodes in exceptions, which prevented garbage collection. Change Exceptions in events to strings. Enable setting event_buffer_size to 0. Provide 'reset_event_history' and refactor code to add to event history. Add 'event_buffer_size' to user config. Stop providing an "end of buffer" event.
Checklist
changie new
to create a changelog entry