diff options
author | Rafael Weingärtner <rafael@apache.org> | 2021-05-07 14:36:26 -0300 |
---|---|---|
committer | Rafael Weingärtner <rafael@apache.org> | 2021-05-07 14:36:32 -0300 |
commit | 30ada660f0d5e4bcbddb2b13aa6af834ab295444 (patch) | |
tree | 013bf0b523d510fc2a10f6b31d2b75a37b6462e9 | |
parent | 122c55591fa90989e66fb803d9a5aac2db8a7211 (diff) | |
download | ceilometer-30ada660f0d5e4bcbddb2b13aa6af834ab295444.tar.gz |
Introduce `timeout` in dynamic pollsters sub-system
This patch introduces a new option for the dynamic pollsters'
sub-system to define the request timeout for requests executed
by the dynamic pollsters. The default timeout value will be 30
seconds. If it (the timeout option) is set to `None`, this means
that the request never times out on the client-side. Therefore,
one might have problems if the server never closes the connection.
The pollsters are executed serially, one after the other; if the
request hangs, all pollsters (including the non-dynamic ones) will
stop executing.
This option is being introduced after a failure that we had when
using the dynamic pollsters; one of the APIs did not respond, and the
server did not close the connection of the request, which made
Ceilometer dynamic pollsters stop gathering data. To avoid such a
situation, we recommend the community review and merge this patch.
Change-Id: I4735f20d75d329ccafc797fe285d9fef579f593e
-rw-r--r-- | ceilometer/polling/dynamic_pollster.py | 4 | ||||
-rw-r--r-- | doc/source/admin/telemetry-dynamic-pollster.rst | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/ceilometer/polling/dynamic_pollster.py b/ceilometer/polling/dynamic_pollster.py index e11dc179..df2d754a 100644 --- a/ceilometer/polling/dynamic_pollster.py +++ b/ceilometer/polling/dynamic_pollster.py @@ -411,7 +411,8 @@ class PollsterDefinitions(object): PollsterDefinition(name='user_id_attribute', default="user_id"), PollsterDefinition(name='resource_id_attribute', default="id"), PollsterDefinition(name='project_id_attribute', default="project_id"), - PollsterDefinition(name='headers')] + PollsterDefinition(name='headers'), + PollsterDefinition(name='timeout', default=30)] extra_definitions = [] @@ -613,6 +614,7 @@ class PollsterSampleGatherer(object): request_headers = self.definitions.configurations['headers'] if request_headers: request_args['headers'] = request_headers + request_args['timeout'] = self.definitions.configurations['timeout'] return request_args def get_request_linked_samples_url(self, kwargs): diff --git a/doc/source/admin/telemetry-dynamic-pollster.rst b/doc/source/admin/telemetry-dynamic-pollster.rst index 12999c6c..9a321cb6 100644 --- a/doc/source/admin/telemetry-dynamic-pollster.rst +++ b/doc/source/admin/telemetry-dynamic-pollster.rst @@ -190,6 +190,14 @@ attributes to define a dynamic pollster: headers: "x-openstack-nova-api-version": "2.46" +* ``timeout``: optional parameter. Defines the request timeout for the + requests executed by the dynamic pollsters to gather data. The default + timeout value is 30 seconds. If it is set to `None`, this means that the + request never times out on the client side. Therefore, one might have + problems if the server never closes the connection. The pollsters are + executed serially, one after the other. Therefore, if the request hangs, + all pollsters (including the non-dynamic ones) will stop executing. + The complete YAML configuration to gather data from Magnum (that has been used as an example) is the following: |