ricardomaraschini / oomhero

Kubernetes sidecar for memory usage tracking
Apache License 2.0
108 stars 10 forks source link

Add signal rate limiting and automatic tests #15

Closed szarykott closed 1 year ago

szarykott commented 1 year ago

Rationale

OOMHero would send a signal to a process every second. This could overload some systems. I want to add a cooldown feature to limit how often signals are sent. It was inspired by work by @rtclauss on one of the forks, I cherry-picked his commit and based my work on it, therefore he is visible in the commit history.

Functionality-wise this change is backward compatible - pulling a new version of OOMHero would not change the observed behavior of it if an old configuration was used, due to the cooldown default being 1 second.

What this PR contains

rtclauss commented 1 year ago

Awesome! I look forward to trying this new feature out.

szarykott commented 1 year ago

@ricardomaraschini I also added one more commit regarding "time management" - it uses time that comes from the ticker as now. This makes the tests more readable and resemble the real application more as in both cases "now" comes from the same source code-wise. Please review.

ricardomaraschini commented 1 year ago

Merged, excellent work.

szarykott commented 1 year ago

I still did not implement parsing cooldown as 1m30s! This was a great idea, I just did not have time to implement it last week. Do you want me to submit another pull request?

ricardomaraschini commented 1 year ago

@szarykott Absolutely!