Add statistics polling interval option.
New --stats-poll option to specify statistics polling interval in seconds. Update documentation for the new option. Change-Id: I57deafec96bd2543217a45d3f52e8ffd46d208b0
This commit is contained in:
parent
dca86f2241
commit
1c2c932f53
@ -144,6 +144,10 @@ Worker Command Line Options
|
||||
Enable verbose output. Normally, only errors are logged. This enables
|
||||
additional logging, but not as much as the :option:`-d` option.
|
||||
|
||||
.. option:: --stats-poll <SECONDS>
|
||||
|
||||
The number of seconds to sleep between statistics polling of the
|
||||
load balancer driver. Default is 300 seconds.
|
||||
|
||||
Pool Manager Command Line Options
|
||||
---------------------------------
|
||||
@ -248,4 +252,4 @@ Pool Manager Command Line Options
|
||||
Enable verbose output. Normally, only errors are logged. This enables
|
||||
additional logging, but not as much as the :option:`-d` option.
|
||||
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@ user = haproxy
|
||||
group = haproxy
|
||||
driver = haproxy
|
||||
reconnect_sleep = 60
|
||||
stats_poll = 300
|
||||
server = 10.0.0.1:8080 10.0.0.2:8080
|
||||
pid = /var/run/libra/libra_worker.pid
|
||||
logfile = /var/log/libra/libra_worker.log
|
||||
|
@ -81,6 +81,10 @@ def main():
|
||||
choices=haproxy_services.keys(), default='ubuntu',
|
||||
help='os services to use with HAProxy driver (when used)'
|
||||
)
|
||||
options.parser.add_argument(
|
||||
'--stats-poll', dest='stats_poll', type=int, metavar='TIME',
|
||||
default=300, help='statistics polling interval in seconds'
|
||||
)
|
||||
args = options.run()
|
||||
|
||||
logger = setup_logging('libra_worker', args)
|
||||
@ -115,7 +119,7 @@ def main():
|
||||
# Tasks to execute in parallel
|
||||
task_list = [
|
||||
(config_manager, (logger, driver, args.server, args.reconnect_sleep)),
|
||||
(stats_manager, (logger, driver))
|
||||
(stats_manager, (logger, driver, args.stats_poll))
|
||||
]
|
||||
|
||||
if args.nodaemon:
|
||||
|
@ -15,16 +15,19 @@
|
||||
import eventlet
|
||||
|
||||
|
||||
def stats_manager(logger, driver):
|
||||
logger.debug("Statistics gathering process started.")
|
||||
def stats_manager(logger, driver, stats_poll):
|
||||
logger.debug("[stats] Statistics gathering process started.")
|
||||
logger.debug("[stats] Polling interval: %d" % stats_poll)
|
||||
|
||||
while True:
|
||||
try:
|
||||
driver.get_stats()
|
||||
except NotImplementedError:
|
||||
logger.warn("Driver does not implement statisics gathering.")
|
||||
logger.warn(
|
||||
"[stats] Driver does not implement statisics gathering."
|
||||
)
|
||||
break
|
||||
|
||||
eventlet.sleep(60)
|
||||
eventlet.sleep(stats_poll)
|
||||
|
||||
logger.info("Statistics gathering process terminated.")
|
||||
logger.info("[stats] Statistics gathering process terminated.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user