mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-14 21:36:35 +03:00
Added query time statsd timer
This commit is contained in:
parent
780b13a42e
commit
882930a3a8
|
@ -1,5 +1,5 @@
|
|||
from infi.clickhouse_orm.database import Database as InfiDatabase, ServerError
|
||||
from infi.clickhouse_orm.migrations import MigrationHistory
|
||||
from infi.clickhouse_orm.database import Database as InfiDatabase
|
||||
from statsd.defaults.django import statsd
|
||||
|
||||
from .configuration import config
|
||||
from .exceptions import DBAliasError
|
||||
|
@ -26,6 +26,11 @@ class Database(InfiDatabase):
|
|||
def _get_applied_migrations(self, migrations_package_name):
|
||||
raise NotImplementedError("This method is not supported by django_clickhouse.")
|
||||
|
||||
def _send(self, data, settings=None, stream=False):
|
||||
statsd_key = "%s.query" % (config.STATSD_PREFIX)
|
||||
with statsd.timer(statsd_key):
|
||||
return super(Database, self)._send(data, settings=settings, stream=stream)
|
||||
|
||||
|
||||
class ConnectionProxy:
|
||||
_connections = {}
|
||||
|
|
|
@ -9,7 +9,7 @@ import six
|
|||
from django.db import transaction
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
from django.db.models import QuerySet as DjangoQuerySet, Manager as DjangoManager, Model as DjangoModel
|
||||
from django.db.models import QuesrySet as DjangoQuerySet, Manager as DjangoManager, Model as DjangoModel
|
||||
|
||||
from .configuration import config
|
||||
from .storages import Storage
|
||||
|
|
Loading…
Reference in New Issue
Block a user