diff --git a/src/django_clickhouse/clickhouse_models.py b/src/django_clickhouse/clickhouse_models.py index ebd1737..588b13b 100644 --- a/src/django_clickhouse/clickhouse_models.py +++ b/src/django_clickhouse/clickhouse_models.py @@ -282,11 +282,15 @@ class ClickHouseMultiModel(ClickHouseModel): batches = {} with statsd.timer(statsd_key.format('steps.get_insert_batch')): for model_cls in cls.sub_models: - batches[model_cls] = model_cls.get_insert_batch(import_objects) + 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_cls.insert_batch(batch) + 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')): storage.post_sync(import_key) diff --git a/src/django_clickhouse/engines.py b/src/django_clickhouse/engines.py index af116bc..b2e8f0d 100644 --- a/src/django_clickhouse/engines.py +++ b/src/django_clickhouse/engines.py @@ -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)