Measure time for inserting tuples

This commit is contained in:
M1ha 2019-02-05 15:13:15 +05:00
parent df422d11f1
commit ef6fc46c5c
2 changed files with 4 additions and 3 deletions

View File

@ -113,10 +113,11 @@ class Database(InfiDatabase):
# Return any remaining lines in partial batch
if lines:
statsd.incr(statsd_key.format('insert_batch'), count=lines)
statsd.incr(statsd_key, lines)
yield buf.getvalue()
self._send(gen())
with statsd.timer(statsd_key):
self._send(next(gen()))
class ConnectionProxy:

View File

@ -27,7 +27,7 @@ class ClickHouseCollapseTestModel(ClickHouseModel):
id = fields.Int32Field()
created = fields.DateTimeField()
value = fields.Int32Field()
sign = fields.Int8Field()
sign = fields.Int8Field(default=1)
version = fields.Int8Field(default=1)
engine = CollapsingMergeTree('created', ('id',), 'sign')