ENG-55392-Googlestackdriver collector: Handle the throttle error for pagination scenario #368
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.
Problem Description
During throttling, we increase the poll interval and decrease the time duration. However, when the collector is collecting data through pagination, it already sets the filter timestamp (timestamp >= since and timestamp < until). The actual until value changes in the state during throttling. Once pagination completes and the collector creates a new state, it starts again from the same timestamp, resulting in duplicate data collection.
ex. In below state example until value(i.e 2024-05-25T10:39:49.000Z) in filter and actual(i.e 2024-05-24T10:39:50.000Z) is different.
{"priv_collector_state":{"since":"2024-05-24T10:39:49.000Z","nextPage":{"filter":"timestamp >= \"2024-05-24T10:39:49.000Z\"\ntimestamp < \"2024-05-25T10:39:49.000Z\"","pageSize":1000,"resourceNames":["projects/prj-mstr-prod"],"pageToken":"EAA44cC8vNq0xP5RSq "},"stream":"projects/prj-mstr-prod","until":"2024-05-24T10:39:50.000Z","poll_interval_sec":420},"retry_count":0}
Solution Description
Now we just reduce the page size during pagination and not the until value.