mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
* Allow running multiple statements from SQL Lab * fix tests * More tests * merge heads * fix heads
16 lines
402 B
Python
16 lines
402 B
Python
from contextlib2 import contextmanager
|
|
|
|
from superset.utils.dates import now_as_float
|
|
|
|
|
|
@contextmanager
|
|
def stats_timing(stats_key, stats_logger):
|
|
"""Provide a transactional scope around a series of operations."""
|
|
start_ts = now_as_float()
|
|
try:
|
|
yield start_ts
|
|
except Exception as e:
|
|
raise e
|
|
finally:
|
|
stats_logger.timing(stats_key, now_as_float() - start_ts)
|