From 7881c150932ab88ed1d6186e84a5aa9eedac258a Mon Sep 17 00:00:00 2001 From: Luka Peschke Date: Mon, 29 Oct 2018 11:18:43 +0100 Subject: [PATCH] Don't update the state of a scope when no data was collected This makes the worker return instead of raising NoDataCollected when an exception occurs during collection. Before this patch, a NoDataCollected exception was raised when a collect exception occured. This caused the worker to update the collect state and to process the next period, leading to missing data in the storage backend. With this patch, the collect state is not updated anymore. Change-Id: I0f7c6d6e4cdc28ad6245b863d396c4f9403de380 Story: 2003828 Task: 26761 Task: 26763 --- cloudkitty/orchestrator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cloudkitty/orchestrator.py b/cloudkitty/orchestrator.py index f5b22fc2..05c06390 100644 --- a/cloudkitty/orchestrator.py +++ b/cloudkitty/orchestrator.py @@ -202,14 +202,19 @@ class Worker(BaseWorker): except Exception as e: LOG.warning( '[%(scope_id)s] Error while collecting metric ' - '%(metric)s: %(error)s', + '%(metric)s: %(error)s. Retrying on next ' + 'collection cycle.', { 'scope_id': self._tenant_id, 'metric': metric, 'error': e, }, ) - raise collector.NoDataCollected('', metric) + # FIXME(peschk_l): here we just exit, and the + # collection will be retried during the next collect + # cycle. In the future, we should implement a retrying + # system in workers + return except collector.NoDataCollected: LOG.info( '[{}] No data collected for metric {} '