summaryrefslogtreecommitdiff
path: root/ceilometer/service.py
diff options
context:
space:
mode:
authorZhiQiang Fan <zhiqiang.fan@huawei.com>2014-11-03 20:57:04 +0800
committerZhiQiang Fan <aji.zqfan@gmail.com>2014-11-20 03:00:22 +0800
commitbd0244ffe63b752649ae74f65a46563e986dcb00 (patch)
treec761fcd12297a45fd5ecfbc8950771aac62e597e /ceilometer/service.py
parent2117ba760cffd03bf4ce14d63f30fe53f2b363bd (diff)
downloadceilometer-bd0244ffe63b752649ae74f65a46563e986dcb00.tar.gz
Add timeout to all http requests
Currently, we generate lots of samples by polling data from other services, but theses rest requests have no timeout limitation. We have observed that some requests (for example, keystone due to openssl problem) may stuck for over several days (maybe forever if we don't restart the service). Other pollsters in same thread will not be able to work too. The worst thing is that, when outside (keystone) service becomes normal, Ceilometer cannot recover itself automatically, cloud operator needs to restart it manually. So I strongly suggest that we should add timeout limit to **every** rest api call, this is quite important to improve Ceilometer's robust and reliability. This patch adds a new option named http_timeout, and applies it to almost all http requests in Ceilometer project. Change-Id: I76df2c0a9ffacb252e15edbb125e37ccb2aac4aa Closes-Bug: #1388778
Diffstat (limited to 'ceilometer/service.py')
-rw-r--r--ceilometer/service.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ceilometer/service.py b/ceilometer/service.py
index 9f7d6f92..9f75fd51 100644
--- a/ceilometer/service.py
+++ b/ceilometer/service.py
@@ -43,6 +43,10 @@ OPTS = [
default=1,
help='Number of workers for notification service. A single '
'notification agent is enabled by default.'),
+ cfg.IntOpt('http_timeout',
+ default=600,
+ help='Timeout seconds for HTTP requests. Set it to None to '
+ 'disable timeout.'),
]
cfg.CONF.register_opts(OPTS)