Add logging for octavia stats collector

Change-Id: I64736b3347d050f4c1a542a3fb15efb2cf2f1e0c
This commit is contained in:
asarfaty 2020-10-13 13:37:35 +02:00 committed by Adit Sarfaty
parent fda1ad4a28
commit b3618d641a
1 changed files with 9 additions and 1 deletions

View File

@ -677,6 +677,8 @@ class NSXOctaviaListenerEndpoint(object):
class NSXOctaviaStatisticsCollector(object):
def __init__(self, core_plugin, listener_stats_getter,
loadbalancer_status_getter=None):
LOG.info("NSXOctaviaStatisticsCollector starting with interval of "
"%s seconds", cfg.CONF.octavia_stats_interval)
self.core_plugin = core_plugin
self.listener_stats_getter = listener_stats_getter
self.loadbalancer_status_getter = loadbalancer_status_getter
@ -685,12 +687,18 @@ class NSXOctaviaStatisticsCollector(object):
cfg.CONF.octavia_stats_interval)
def thread_runner(self, interval):
LOG.info("NSXOctaviaStatisticsCollector thread_runner is running")
while True:
time.sleep(interval)
self.collect()
try:
self.collect()
except Exception as e:
LOG.error("Octavia stats collect failed with %s", e)
def collect(self):
if not self.core_plugin.octavia_listener:
LOG.warning("Octavia stats collector cannot run with plugin %s",
self.core_plugin)
return
endpoint = self.core_plugin.octavia_listener.endpoints[0]