Fixed statsd counters

This commit is contained in:
M1ha 2018-12-19 16:15:17 +05:00
parent 6a1ffbadd3
commit e8a15e4330
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -117,6 +117,7 @@ class Storage:
% (operation, len(pks), import_key))
statsd_key = "%s.sync.%s.register_operations" % (config.STATSD_PREFIX, import_key)
statsd.incr(statsd_key + '.%s' % operation, len(pks))
with statsd.timer(statsd_key):
return self.register_operations(import_key, operation, *pks)