Rename confusing query timeout options
These do not actually define timeout but interval. Rename the options to reflect what they actually define. The existing deprecated options in the [gnocchi_client] are also removed, because these have been kept for 6 years. In addition, fix inconsistent name (query vs call). Change-Id: Ib29115746a25b45bdff1c3da8df9d7167c2db662 Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``[collector] api_query_timeout`` option was deprecated in favor of
|
||||||
|
the ``[collector] api_query_interval`` option.
|
||||||
|
|
||||||
|
- |
|
||||||
|
The ``[collector] api_call_retries`` option was deprecated in favor of
|
||||||
|
the ``[collector] api_query_max_retries`` option.
|
||||||
|
|
||||||
|
- |
|
||||||
|
The ``[watcher_datasources] query_timeout`` option was deprecated in favor
|
||||||
|
of the ``[watcher_datasources] query_interval`` option.
|
||||||
|
|
||||||
|
- |
|
||||||
|
The following deprecated options were removed.
|
||||||
|
|
||||||
|
- ``[gnocchi_client] query_timeout`` (Use
|
||||||
|
``[watcher_datsources] query_interval``)
|
||||||
|
- ``[gnocchi_client] query_max_retries`` (Use
|
||||||
|
``[watcher_datasources] query_max_retires``)
|
@@ -35,13 +35,18 @@ Supported in-tree collectors include:
|
|||||||
Custom data model collector plugins can be defined with the
|
Custom data model collector plugins can be defined with the
|
||||||
``watcher_cluster_data_model_collectors`` extension point.
|
``watcher_cluster_data_model_collectors`` extension point.
|
||||||
"""),
|
"""),
|
||||||
cfg.IntOpt('api_call_retries',
|
cfg.IntOpt('api_query_max_retries',
|
||||||
|
min=1,
|
||||||
default=10,
|
default=10,
|
||||||
help="Number of retries before giving up on external service "
|
help="Number of retries before giving up on query to "
|
||||||
"calls."),
|
"external service.",
|
||||||
cfg.IntOpt('api_query_timeout',
|
deprecated_name="api_call_retries"),
|
||||||
|
cfg.IntOpt('api_query_interval',
|
||||||
|
min=0,
|
||||||
default=1,
|
default=1,
|
||||||
help="Time before retry after failed call to external service.")
|
help="Time before retry after failed query to "
|
||||||
|
"external service.",
|
||||||
|
deprecated_name="api_query_timeout")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -46,14 +46,13 @@ DATASOURCES_OPTS = [
|
|||||||
min=1,
|
min=1,
|
||||||
default=10,
|
default=10,
|
||||||
mutable=True,
|
mutable=True,
|
||||||
help='How many times Watcher is trying to query again',
|
help='How many times Watcher is trying to query again'),
|
||||||
deprecated_group="gnocchi_client"),
|
cfg.IntOpt('query_interval',
|
||||||
cfg.IntOpt('query_timeout',
|
|
||||||
min=0,
|
min=0,
|
||||||
default=1,
|
default=1,
|
||||||
mutable=True,
|
mutable=True,
|
||||||
help='How many seconds Watcher should wait to do query again',
|
help='How many seconds Watcher should wait to do query again',
|
||||||
deprecated_group="gnocchi_client")
|
deprecated_name="query_timeout")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ class DataSourceBase(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
num_retries = CONF.watcher_datasources.query_max_retries
|
num_retries = CONF.watcher_datasources.query_max_retries
|
||||||
timeout = CONF.watcher_datasources.query_timeout
|
interval = CONF.watcher_datasources.query_interval
|
||||||
ignored_exc = ignored_exc or tuple()
|
ignored_exc = ignored_exc or tuple()
|
||||||
|
|
||||||
for i in range(num_retries):
|
for i in range(num_retries):
|
||||||
@@ -92,8 +92,8 @@ class DataSourceBase(object):
|
|||||||
LOG.exception(e)
|
LOG.exception(e)
|
||||||
self.query_retry_reset(e)
|
self.query_retry_reset(e)
|
||||||
LOG.warning("Retry %d of %d while retrieving metrics retry "
|
LOG.warning("Retry %d of %d while retrieving metrics retry "
|
||||||
"in %d seconds", i+1, num_retries, timeout)
|
"in %d seconds", i+1, num_retries, interval)
|
||||||
time.sleep(timeout)
|
time.sleep(interval)
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def query_retry_reset(self, exception_instance):
|
def query_retry_reset(self, exception_instance):
|
||||||
|
@@ -201,15 +201,15 @@ class BaseModelBuilder(object):
|
|||||||
|
|
||||||
Attempts to access data from the external service and handles
|
Attempts to access data from the external service and handles
|
||||||
exceptions. The retrieval should be retried in accordance
|
exceptions. The retrieval should be retried in accordance
|
||||||
to the value of api_call_retries
|
to the value of api_query_max_retries
|
||||||
:param f: The method that performs the actual querying for metrics
|
:param f: The method that performs the actual querying for metrics
|
||||||
:param args: Array of arguments supplied to the method
|
:param args: Array of arguments supplied to the method
|
||||||
:param kwargs: The amount of arguments supplied to the method
|
:param kwargs: The amount of arguments supplied to the method
|
||||||
:return: The value as retrieved from the external service
|
:return: The value as retrieved from the external service
|
||||||
"""
|
"""
|
||||||
|
|
||||||
num_retries = CONF.collector.api_call_retries
|
num_retries = CONF.collector.api_query_max_retries
|
||||||
timeout = CONF.collector.api_query_timeout
|
interval = CONF.collector.api_query_interval
|
||||||
|
|
||||||
for i in range(num_retries):
|
for i in range(num_retries):
|
||||||
try:
|
try:
|
||||||
@@ -219,8 +219,8 @@ class BaseModelBuilder(object):
|
|||||||
self.call_retry_reset(e)
|
self.call_retry_reset(e)
|
||||||
LOG.warning("Retry %d of %d, error while calling service "
|
LOG.warning("Retry %d of %d, error while calling service "
|
||||||
"retry in %s seconds",
|
"retry in %s seconds",
|
||||||
i+1, num_retries, timeout)
|
i+1, num_retries, interval)
|
||||||
time.sleep(timeout)
|
time.sleep(interval)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
@@ -37,7 +37,7 @@ class TestBaseDatasourceHelper(base.BaseTestCase):
|
|||||||
CONF.set_override("query_max_retries", 2,
|
CONF.set_override("query_max_retries", 2,
|
||||||
group='watcher_datasources')
|
group='watcher_datasources')
|
||||||
# Reduce sleep time to 0
|
# Reduce sleep time to 0
|
||||||
CONF.set_override("query_timeout", 0,
|
CONF.set_override("query_interval", 0,
|
||||||
group='watcher_datasources')
|
group='watcher_datasources')
|
||||||
|
|
||||||
helper = datasource.DataSourceBase()
|
helper = datasource.DataSourceBase()
|
||||||
@@ -55,7 +55,7 @@ class TestBaseDatasourceHelper(base.BaseTestCase):
|
|||||||
CONF.set_override("query_max_retries", 2,
|
CONF.set_override("query_max_retries", 2,
|
||||||
group='watcher_datasources')
|
group='watcher_datasources')
|
||||||
# Reduce sleep time to 0
|
# Reduce sleep time to 0
|
||||||
CONF.set_override("query_timeout", 0,
|
CONF.set_override("query_interval", 0,
|
||||||
group='watcher_datasources')
|
group='watcher_datasources')
|
||||||
|
|
||||||
helper = datasource.DataSourceBase()
|
helper = datasource.DataSourceBase()
|
||||||
|
Reference in New Issue
Block a user