amazon-cloudwatch-agent icon indicating copy to clipboard operation
amazon-cloudwatch-agent copied to clipboard

Add DescribeLogGroups/PutRetentionPolicy rate limiter

Open duhminick opened this issue 8 months ago • 1 comments

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

  1. 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.

  1. Run make fmt and make fmt-sh
  2. Run make lint

duhminick avatar May 19 '25 19:05 duhminick

This PR was marked stale due to lack of activity.

github-actions[bot] avatar May 27 '25 00:05 github-actions[bot]