Add caching layer to metrics (#17617)

This commit is contained in:
Eugen Rochko
2022-02-22 15:27:08 +01:00
committed by GitHub
parent 8338826963
commit b377022cf9
18 changed files with 165 additions and 55 deletions

View File

@ -5,15 +5,17 @@ class Admin::Metrics::Measure::OpenedReportsMeasure < Admin::Metrics::Measure::B
'opened_reports'
end
def total
protected
def perform_total_query
Report.where(created_at: time_period).count
end
def previous_total
def perform_previous_total_query
Report.where(created_at: previous_time_period).count
end
def data
def perform_data_query
sql = <<-SQL.squish
SELECT axis.*, (
WITH new_reports AS (