1) Fixed get_final_versions statsd timer key

2) Added individual model operations statsd monitoring for ClickHouseMultiModel
This commit is contained in:
M1ha 2019-01-18 10:47:26 +05:00
parent 96b625ecff
commit 6a4bf14ea6
2 changed files with 7 additions and 3 deletions

View File

@ -282,10 +282,14 @@ class ClickHouseMultiModel(ClickHouseModel):
batches = {}
with statsd.timer(statsd_key.format('steps.get_insert_batch')):
for model_cls in cls.sub_models:
model_statsd_key = "%s.sync.%s.{0}" % (config.STATSD_PREFIX, model_cls.__name__)
with statsd.timer(model_statsd_key.format('steps.get_insert_batch')):
batches[model_cls] = model_cls.get_insert_batch(import_objects)
with statsd.timer(statsd_key.format('steps.insert')):
for model_cls, batch in batches.items():
model_statsd_key = "%s.sync.%s.{0}" % (config.STATSD_PREFIX, model_cls.__name__)
with statsd.timer(model_statsd_key.format('steps.insert')):
model_cls.insert_batch(batch)
with statsd.timer(statsd_key.format('steps.post_sync')):

View File

@ -129,7 +129,7 @@ class CollapsingMergeTree(InsertOnlyEngineMixin, infi_engines.CollapsingMergeTre
"""
new_objs = super(CollapsingMergeTree, self).get_insert_batch(model_cls, objects)
statsd_key = "%s.sync.%s.get_final_versions" % (config.STATSD_PREFIX, model_cls.__name__)
statsd_key = "%s.sync.%s.steps.get_final_versions" % (config.STATSD_PREFIX, model_cls.__name__)
with statsd.timer(statsd_key):
old_objs = self.get_final_versions(model_cls, new_objs)