Describe the bug
ListContainersWithPagination (and likely other *WithPagination methods) can terminate pagination prematurely when the Datadog API returns fewer items than the requested page[size] on a page that is not the last page.
To Reproduce
It only happens when the API returns fewer containers than the page[size] parameter, albeit also with a next_cursor present. We are able to reproduce this on an environment with 900k+ containers at about the 200k mark.
Expected behavior
The API would paginate all containers in the query and not stop prematurely, by respecting the next_cursor returned by the API rather than exiting early due to pages not filled to capacity.
Screenshots
The last response before exiting:
stefanmuraru ~/Downloads> cat response.json | jq -r '.data | length'
952
stefanmuraru ~/Downloads> cat response.json | jq -r '.meta'
{
"pagination": {
"cursor": "c3RhcnRlZ....MmM5OA==",
"limit": 1000,
"next_cursor": "c3RhcnRlZ....MzMxZA==",
"prev_cursor": null,
"total": 943801,
"type": "cursor_limit"
}
}
Environment and Versions (please complete the following information):
Go 1.25.6
github.com/DataDog/datadog-api-client-go/v2 v2.54.0
Describe the bug
ListContainersWithPagination(and likely other *WithPagination methods) can terminate pagination prematurely when the Datadog API returns fewer items than the requested page[size] on a page that is not the last page.To Reproduce
It only happens when the API returns fewer containers than the page[size] parameter, albeit also with a next_cursor present. We are able to reproduce this on an environment with 900k+ containers at about the 200k mark.
Expected behavior
The API would paginate all containers in the query and not stop prematurely, by respecting the next_cursor returned by the API rather than exiting early due to pages not filled to capacity.
Screenshots
The last response before exiting:
Environment and Versions (please complete the following information):
Go 1.25.6
github.com/DataDog/datadog-api-client-go/v2 v2.54.0