Adds a utility method implementing paginated HTTP GET for Sensu API requests.
Motivation and Context
Users with a large number of clients, events and/or check results have reported timeouts and other errors when executing checks and handlers which request a complete data set from the Sensu API.
As of Sensu 1.4 the API supports pagination for HTTP GET on a number of endpoints.
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[ ] My change requires a change to the documentation.
[ ] I have updated the documentation accordingly.
[ ] I have updated the Changelog following the conventions laid out on Keep A Changelog
Known Caveats
I've added this method to the Sensu::Plugin::Utils module, because I think this method should be available to both check and handler plugins. That said, the method does call the api_request method which is part of Sensu::Plugin::Handler. Not 100% sure if this works in practice.
Possibly out of scope for this change, but can api_request and related methods be made available to Sensu::Plugin::Check::CLI without a breaking change to the library?
Description
Adds a utility method implementing paginated HTTP GET for Sensu API requests.
Motivation and Context
Users with a large number of clients, events and/or check results have reported timeouts and other errors when executing checks and handlers which request a complete data set from the Sensu API.
As of Sensu 1.4 the API supports pagination for HTTP GET on a number of endpoints.
How Has This Been Tested?
Same code has been implemented in an experimental branch of sensu-plugins-sensu, where pagination has been implemented in the check-stale-results.rb and handler-purge-stale-results.rb plugins.
Types of changes
Checklist:
Known Caveats
I've added this method to the Sensu::Plugin::Utils module, because I think this method should be available to both check and handler plugins. That said, the method does call the
api_request
method which is part of Sensu::Plugin::Handler. Not 100% sure if this works in practice.Possibly out of scope for this change, but can
api_request
and related methods be made available to Sensu::Plugin::Check::CLI without a breaking change to the library?