This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
Patch Logger to reduce repeated messages frequency #122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello Hans,
Sorry for this 'unsolicited' PR but I wanted to submit you a proposal for reducing the frequency of the integration logs which lead my working HA to some stressful situations (I have logging in ramdisk on my pi - so blame on me for that :)
This happened sometimes when the Viessmann api was unavailable for many hours and my HA log got overwhelmed. I saw other complaints about this on HA forums too and I've decided to share with you my idea about the matter without opening an issue but directly here:
This patch basically sets a timeout (fixed in code but customizable 'per call') where a logged message doesnt get repeated until the timeout elapses. The idea is that once you know something wrong is happening there's no need to repeat this on every entity update cycle or so since the situation is likely stalling somewehere else and there's no actual solution (As stated before this happened a couple of time when the Viessmann api went offline for a long time)
The logic for 'gating' each message is handled in the patched
Logger
class (hidden behind_Logger
in the added modulehelpers.py
)There's another issue in my opinion in the fact the entity
update
code is not totally tryed/catched so it happens sometimes some exceptions pop up in the runner and this starts an annoying stack dump also impairing the HA log readability. I'm thinking about a general catcher which just logs the error message in normal circumstances and eventually sets the stack trace only when logging is configured for DEBUGI'm working on a separate PR for this which I should be able to deliver in 1 or 2 days so to share the ideas