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::BPMS_GRPH, QaServer::PerformanceHistoryDataKeys::BPMS_NORM, QaServer::PerformanceHistoryDataKeys::BPMS_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::MSPB_GRPH, QaServer::PerformanceHistoryDataKeys::MSPB_NORM, QaServer::PerformanceHistoryDataKeys::MSPB_RETR, QaServer::PerformanceHistoryDataKeys::SEARCH, QaServer::PerformanceHistoryDataKeys::SRC_BYTES, QaServer::PerformanceHistoryDataKeys::STATS
Class Method Summary collapse
-
.calculate_last_12_months(authority_name:, action:) ⇒ Object
Performance data for the last 12 months for a specific authority and action.
-
.calculate_last_24_hours(authority_name:, action:) ⇒ Object
Performance data for the last 24 hours for a specific authority and action.
-
.calculate_last_30_days(authority_name:, action:) ⇒ Object
Performance data for the last 30 days for a specific authority and action.
-
.recalculate_last_hour(authority_name:, action:, averages:) ⇒ Object
Performance data for the last 24 hours for a specific authority and action.
Class Method Details
.calculate_last_12_months(authority_name:, action:) ⇒ Object
Performance data for the last 12 months for a specific authority and action
23 24 25 26 27 28 29 30 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 23 def calculate_last_12_months(authority_name:, action:) start_month = QaServer::TimeService.current_time.beginning_of_month - 11.months 0.upto(11).each_with_object({}) do |idx, averages| records = records_by(, action, start_month..start_month.end_of_month) averages[idx] = calculate_from_records(records, BY_MONTH, start_month.strftime("%m-%Y")) start_month += 1.month end end |
.calculate_last_24_hours(authority_name:, action:) ⇒ Object
Performance data for the last 24 hours for a specific authority and action
63 64 65 66 67 68 69 70 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 63 def calculate_last_24_hours(authority_name:, action:) start_hour = QaServer::TimeService.current_time.beginning_of_hour - 23.hours 0.upto(23).each_with_object({}) do |idx, averages| records = records_by(, action, start_hour..start_hour.end_of_hour) averages[idx] = calculate_from_records(records, BY_HOUR, performance_by_hour_label(idx, start_hour)) start_hour += 1.hour end end |
.calculate_last_30_days(authority_name:, action:) ⇒ Object
Performance data for the last 30 days for a specific authority and action
43 44 45 46 47 48 49 50 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 43 def calculate_last_30_days(authority_name:, action:) start_day = QaServer::TimeService.current_time.beginning_of_day - 29.days 0.upto(29).each_with_object({}) do |idx, averages| records = records_by(, action, start_day..start_day.end_of_day) averages[idx] = calculate_from_records(records, BY_DAY, performance_by_day_label(idx, start_day)) start_day += 1.day end end |
.recalculate_last_hour(authority_name:, action:, averages:) ⇒ Object
Performance data for the last 24 hours for a specific authority and action
84 85 86 87 88 89 |
# File 'app/services/qa_server/performance_graph_data_service.rb', line 84 def recalculate_last_hour(authority_name:, action:, averages:) start_hour = QaServer::TimeService.current_time.beginning_of_hour records = records_by(, action, start_hour..start_hour.end_of_hour) averages[23] = calculate_from_records(records, BY_HOUR, performance_by_hour_label(23, start_hour)) averages end |