Skip to content

Commit 37ae969

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add handling to metric collect error"
2 parents e64156c + 676fd7e commit 37ae969

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

cloudkitty/orchestrator.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import hashlib
2121
import multiprocessing
2222
import random
23-
import sys
2423
import time
2524

2625
import cotyledon
@@ -331,7 +330,7 @@ def _get_result(metric):
331330
# collection will be retried during the next collect
332331
# cycle. In the future, we should implement a retrying
333332
# system in workers
334-
sys.exit(1)
333+
raise e
335334

336335
return self._do_execute_collection(_get_result, metrics)
337336

@@ -640,12 +639,19 @@ def internal_run(self):
640639
lock_name=lock_name,
641640
scope_id=tenant_id))
642641

642+
_success = True
643643
try:
644644
self.process_scope(tenant_id)
645+
except Exception as e:
646+
_success = False
647+
LOG.error('Error processing scope %s, we will try it again'
648+
' later.', tenant_id)
649+
LOG.exception(e)
645650
finally:
646651
lock.release()
647652

648-
LOG.debug("Finished processing scope [%s].", tenant_id)
653+
if _success:
654+
LOG.debug("Finished processing scope [%s].", tenant_id)
649655
else:
650656
LOG.debug("Could not acquire lock [%s] for processing "
651657
"scope [%s] with worker [%s].", lock_name,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Changes the metric collector exception handling to raise an exception
5+
instead of killing the processor when an error happens in the metric
6+
collect, so the problematic scope will be skipped till next
7+
collection and the other scopes will be processed normally.

0 commit comments

Comments
 (0)