Merge "Introduce `timeout` in dynamic pollsters sub-system"

This commit is contained in:
Zuul 2021-06-14 08:24:21 +00:00 committed by Gerrit Code Review
commit e396932505
2 changed files with 11 additions and 1 deletions

View File

@ -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):

View File

@ -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: