amazon-cloudwatch-agent
amazon-cloudwatch-agent copied to clipboard
Add DescribeLogGroups/PutRetentionPolicy rate limiter
Description of the issue
DescribeLogGroups (DLG) and PutRetentionPolicy (PRP) are getting throttled when there are either high deployment of agents and/or high number of log groups configured.
Description of changes
Adding a rate limiter for both DLG and PRP that limits to one operation call per second.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
- The test is just like the other tests except the time between calls are recorded. The assertion is that the time between calls is greater than or equal to 995 milliseconds. Ideally this would just be 1 second, but the time between calls is not exactly perfect so I had loosened up the threshold. a. This test is done for both DLG and PRP
You may notice that a mutex is used for the call times array, that's because the data-race-check would fail since multiple go routines are writing to that array.
Requirements
Before commit the code, please do the following steps.
- Run
make fmtandmake fmt-sh - Run
make lint
This PR was marked stale due to lack of activity.