mirror of https://github.com/apache/superset.git
chore(reports): add metrics to report schedule and log prune (#25080)
This commit is contained in:
parent
7402379346
commit
04bb73cf27
|
@ -26,6 +26,7 @@ from superset.extensions import celery_app
|
|||
from superset.reports.commands.exceptions import ReportScheduleUnexpectedError
|
||||
from superset.reports.commands.execute import AsyncExecuteReportScheduleCommand
|
||||
from superset.reports.commands.log_prune import AsyncPruneReportScheduleLogCommand
|
||||
from superset.stats_logger import BaseStatsLogger
|
||||
from superset.tasks.cron_util import cron_schedule_window
|
||||
from superset.utils.celery import session_scope
|
||||
from superset.utils.core import LoggerLevel
|
||||
|
@ -39,6 +40,9 @@ def scheduler() -> None:
|
|||
"""
|
||||
Celery beat main scheduler for reports
|
||||
"""
|
||||
stats_logger: BaseStatsLogger = app.config["STATS_LOGGER"]
|
||||
stats_logger.incr("reports.scheduler")
|
||||
|
||||
if not is_feature_enabled("ALERT_REPORTS"):
|
||||
return
|
||||
with session_scope(nullpool=True) as session:
|
||||
|
@ -68,6 +72,9 @@ def scheduler() -> None:
|
|||
|
||||
@celery_app.task(name="reports.execute", bind=True)
|
||||
def execute(self: Celery.task, report_schedule_id: int) -> None:
|
||||
stats_logger: BaseStatsLogger = app.config["STATS_LOGGER"]
|
||||
stats_logger.incr("reports.execute")
|
||||
|
||||
task_id = None
|
||||
try:
|
||||
task_id = execute.request.id
|
||||
|
@ -100,6 +107,9 @@ def execute(self: Celery.task, report_schedule_id: int) -> None:
|
|||
|
||||
@celery_app.task(name="reports.prune_log")
|
||||
def prune_log() -> None:
|
||||
stats_logger: BaseStatsLogger = app.config["STATS_LOGGER"]
|
||||
stats_logger.incr("reports.prune_log")
|
||||
|
||||
try:
|
||||
AsyncPruneReportScheduleLogCommand().run()
|
||||
except SoftTimeLimitExceeded as ex:
|
||||
|
|
Loading…
Reference in New Issue