Logging a few more actions (#2783)

* Logging a few more actions

* adding statsd dep
This commit is contained in:
Maxime Beauchemin 2017-05-19 10:25:58 -07:00 committed by GitHub
parent 922cc037bf
commit ce506bdf65
4 changed files with 8 additions and 0 deletions

View File

@ -9,5 +9,6 @@ psycopg2
pylint
pythrifthiveapi
pyyaml
statsd
# Also install everything we need to build Sphinx docs
-r dev-reqs-for-docs.txt

View File

@ -52,6 +52,8 @@ try:
self.client.decr(key)
def gauge(self, key):
# pylint: disable=no-value-for-parameter
self.client.gauge(key)
except Exception as e:
pass

View File

@ -46,6 +46,7 @@ from .base import (
)
config = app.config
stats_logger = config.get('STATS_LOGGER')
log_this = models.Log.log_this
can_access = utils.can_access
DAR = models.DatasourceAccessRequest
@ -2091,6 +2092,7 @@ class Superset(BaseSupersetView):
@expose("/queries/<last_updated_ms>")
def queries(self, last_updated_ms):
"""Get the updated queries."""
stats_logger.incr('queries')
if not g.user.get_id():
return json_error_response(
"Please login to access the queries.", status=403)

View File

@ -31,6 +31,7 @@ from superset import app, utils, cache
from superset.utils import DTTM_ALIAS
config = app.config
stats_logger = config.get('STATS_LOGGER')
class BaseViz(object):
@ -214,6 +215,7 @@ class BaseViz(object):
payload = cache.get(cache_key)
if payload:
stats_logger.incr('loaded_from_source')
is_cached = True
try:
cached_data = zlib.decompress(payload)
@ -227,6 +229,7 @@ class BaseViz(object):
logging.info("Serving from cache")
if not payload:
stats_logger.incr('loaded_from_cache')
data = None
is_cached = False
cache_timeout = self.cache_timeout