Class: QaServer::PerformanceGraphDataService
- Inherits:
-
Object
- Object
- QaServer::PerformanceGraphDataService
- Extended by:
- PerformanceHistoryDataKeys
- Defined in:
- app/services/qa_server/performance_graph_data_service.rb
Constant Summary
Constants included from PerformanceHistoryDataKeys
QaServer::PerformanceHistoryDataKeys::ALL_ACTIONS, QaServer::PerformanceHistoryDataKeys::ALL_AUTH, QaServer::PerformanceHistoryDataKeys::AVG_ACTN, QaServer::PerformanceHistoryDataKeys::AVG_FULL, QaServer::PerformanceHistoryDataKeys::AVG_GRPH, QaServer::PerformanceHistoryDataKeys::AVG_LOAD, QaServer::PerformanceHistoryDataKeys::AVG_NORM, QaServer::PerformanceHistoryDataKeys::AVG_RETR, QaServer::PerformanceHistoryDataKeys::BY_DAY, QaServer::PerformanceHistoryDataKeys::BY_HOUR, QaServer::PerformanceHistoryDataKeys::BY_MONTH, QaServer::PerformanceHistoryDataKeys::FETCH, QaServer::PerformanceHistoryDataKeys::FOR_DATATABLE, QaServer::PerformanceHistoryDataKeys::FOR_DAY, QaServer::PerformanceHistoryDataKeys::FOR_MONTH, QaServer::PerformanceHistoryDataKeys::FOR_YEAR, QaServer::PerformanceHistoryDataKeys::HIGH_ACTN, QaServer::PerformanceHistoryDataKeys::HIGH_FULL, QaServer::PerformanceHistoryDataKeys::HIGH_GRPH, QaServer::PerformanceHistoryDataKeys::HIGH_LOAD, QaServer::PerformanceHistoryDataKeys::HIGH_NORM, QaServer::PerformanceHistoryDataKeys::HIGH_RETR, QaServer::PerformanceHistoryDataKeys::LOW_ACTN, QaServer::PerformanceHistoryDataKeys::LOW_FULL, QaServer::PerformanceHistoryDataKeys::LOW_GRPH, QaServer::PerformanceHistoryDataKeys::LOW_LOAD, QaServer::PerformanceHistoryDataKeys::LOW_NORM, QaServer::PerformanceHistoryDataKeys::LOW_RETR, QaServer::PerformanceHistoryDataKeys::SEARCH, QaServer::PerformanceHistoryDataKeys::STATS
Class Method Summary collapse
-
.average_last_12_months(authority_name: nil, action: nil, force: false) ⇒ Object
Get daily average for the past 12 months.
-
.average_last_24_hours(authority_name: nil, action: nil, force: false) ⇒ Object
Get hourly average for the past 24 hours.
-
.average_last_30_days(authority_name: nil, action: nil, force: false) ⇒ Object
Get daily average for the past 30 days.
Class Method Details
.average_last_12_months(authority_name: nil, action: nil, force: false) ⇒ Object
Get daily average for the past 12 months.
65 66 67 68 69 70 71 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 65 def average_last_12_months(authority_name: nil, action: nil, force: false) Rails.cache.fetch("#{self.class}/#{__method__}/#{authority_name || ALL_AUTH}/#{action}/#{FOR_YEAR}", expires_in: QaServer.cache_expiry, race_condition_ttl: 1.hour, force: force) do Rails.logger.info("#{self.class}##{__method__} - calculating performance stats for last 12 months - cache expired or refresh requested (#{force})") calculate_last_12_months(, action) end end |
.average_last_24_hours(authority_name: nil, action: nil, force: false) ⇒ Object
Get hourly average for the past 24 hours.
24 25 26 27 28 29 30 31 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 24 def average_last_24_hours(authority_name: nil, action: nil, force: false) Rails.cache.fetch("#{self.class}/#{__method__}/#{authority_name || ALL_AUTH}/#{action}/#{FOR_DAY}", expires_in: QaServer.current_time.end_of_hour - QaServer.current_time, race_condition_ttl: 1.hour, force: force) do Rails.logger.info("#{self.class}##{__method__} - calculating performance stats for last 24 hours - cache expired or refresh requested (#{force})") calculate_last_24_hours(, action) end end |
.average_last_30_days(authority_name: nil, action: nil, force: false) ⇒ Object
Get daily average for the past 30 days.
45 46 47 48 49 50 51 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 45 def average_last_30_days(authority_name: nil, action: nil, force: false) Rails.cache.fetch("#{self.class}/#{__method__}/#{authority_name || ALL_AUTH}/#{action}/#{FOR_MONTH}", expires_in: QaServer.cache_expiry, race_condition_ttl: 1.hour, force: force) do Rails.logger.info("#{self.class}##{__method__} - calculating performance stats for last 30 days - cache expired or refresh requested (#{force})") calculate_last_30_days(, action) end end |