Class: QaServer::PerformanceHistory

Inherits:
ApplicationRecord
  • Object
show all
Extended by:
PerformanceHistoryDataKeys
Defined in:
app/models/qa_server/performance_history.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

Class Method Details

.create_record(authority:, action:, dt_stamp: QaServer::TimeService.current_time) ⇒ Object

Save a scenario result

Parameters:

  • authority (String)

    name of the authority

  • action (Symbol)

    type of action being evaluated (e.g. :fetch, :search)

  • dt_stamp (Time) (defaults to: QaServer::TimeService.current_time)

    defaults to current time in preferred time zone

Returns:

  • ActveRecord::Base for the new performance history record



21
22
23
24
25
# File 'app/models/qa_server/performance_history.rb', line 21

def create_record(authority:, action:, dt_stamp: QaServer::TimeService.current_time)
  create(dt_stamp: dt_stamp,
         authority: authority,
         action: action)
end

.performance_graph_data(force: false) ⇒ Object

Performance data for a day, a month, a year, and all time for each authority.

Examples:

{ all_authorities:
  { search:
    {
      day:
        { 0: { hour: '1400', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          1: { hour: '1500', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          2: { hour: '1600', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          ...,
          23: { hour: 'NOW', retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }}
        },
      month:
        { 0: { day: '07-15-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          1: { day: '07-16-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          2: { day: '07-17-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          ...,
          29: { day: 'TODAY', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }}
        },
      year:
        { 0: { month: '09-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          1: { month: '10-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          2: { month: '11-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }},
          ...,
          11: { month: '08-2019', stats: { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5, etc. }}
        }
    },
    fetch: { ... # same data as for search_stats },
    all: { ... # same data as for search_stats }
  },
  AGROVOC_LD4L_CACHE: { ... # same data for each authority  }
}

Parameters:

  • datatype (Symbol)

    what type of data should be calculated (e.g. :datatable, :graph, :all)



79
80
81
# File 'app/models/qa_server/performance_history.rb', line 79

def performance_graph_data(force: false)
  graph_data_service_class.calculate_graph_data(force: force)
end

.performance_table_data(force: false) ⇒ Object

Performance data for a day, a month, a year, and all time for each authority.

Examples:

{ all_authorities:
  { search:
    { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5,
      retrieve_10th_ms: 12.3, graph_load_10th_ms: 12.3, normalization_10th_ms: 4.2, full_request_10th_ms: 16.5,
      retrieve_90th_ms: 12.3, graph_load_90th_ms: 12.3, normalization_90th_ms: 4.2, full_request_90th_ms: 16.5 },
    fetch: { ... # same data as for search_stats },
    all: { ... # same data as for search_stats }
  },
  AGROVOC_LD4L_CACHE: { ... # same data for each authority  }
}

Parameters:

  • datatype (Symbol)

    what type of data should be calculated (e.g. :datatable, :graph, :all)



41
42
43
# File 'app/models/qa_server/performance_history.rb', line 41

def performance_table_data(force: false)
  datatable_data_service_class.calculate_datatable_data(force: force)
end