Fix statsd counters

This commit is contained in:
M1ha 2018-12-19 13:02:14 +05:00
parent 13b67ed77a
commit 1a3d512c57

View File

@ -193,7 +193,7 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)):
with statsd.timer(statsd_key.format('steps.get_operations')): with statsd.timer(statsd_key.format('steps.get_operations')):
operations = storage.get_operations(import_key, cls.get_sync_batch_size()) operations = storage.get_operations(import_key, cls.get_sync_batch_size())
statsd.incr(statsd_key.format('operations', count=len(operations))) statsd.incr(statsd_key.format('operations', len(operations)))
if operations: if operations:
with statsd.timer(statsd_key.format('steps.get_sync_objects')): with statsd.timer(statsd_key.format('steps.get_sync_objects')):
@ -201,7 +201,7 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)):
else: else:
import_objects = [] import_objects = []
statsd.incr(statsd_key.format('import_objects', count=len(import_objects))) statsd.incr(statsd_key.format('import_objects', len(import_objects)))
if import_objects: if import_objects:
with statsd.timer(statsd_key.format('steps.get_insert_batch')): with statsd.timer(statsd_key.format('steps.get_insert_batch')):
@ -258,7 +258,7 @@ class ClickHouseMultiModel(ClickHouseModel):
with statsd.timer(statsd_key.format('steps.get_operations')): with statsd.timer(statsd_key.format('steps.get_operations')):
operations = storage.get_operations(import_key, cls.get_sync_batch_size()) operations = storage.get_operations(import_key, cls.get_sync_batch_size())
statsd.incr(statsd_key.format('operations', count=len(operations))) statsd.incr(statsd_key.format('operations', len(operations)))
if operations: if operations:
with statsd.timer(statsd_key.format('steps.get_sync_objects')): with statsd.timer(statsd_key.format('steps.get_sync_objects')):
@ -266,7 +266,7 @@ class ClickHouseMultiModel(ClickHouseModel):
else: else:
import_objects = [] import_objects = []
statsd.incr(statsd_key.format('import_objects', count=len(import_objects))) statsd.incr(statsd_key.format('import_objects', len(import_objects)))
if import_objects: if import_objects:
batches = {} batches = {}