Class: QaServer::PerformanceHistory

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/qa_server/performance_history.rb

Constant Summary collapse

PERFORMANCE_FOR_DAY_KEY =
:day
PERFORMANCE_BY_HOUR_KEY =
:hour
PERFORMANCE_FOR_MONTH_KEY =
:month
PERFORMANCE_BY_DAY_KEY =
:day
PERFORMANCE_FOR_YEAR_KEY =
:year
PERFORMANCE_BY_MONTH_KEY =
:month
LOAD_TIME_KEY =
:load_avg_ms
NORMALIZATION_TIME_KEY =
:normalization_avg_ms
COMBINED_TIME_KEY =
:combined_avg_ms

Class Method Summary collapse

Class Method Details

.performance_dataObject

Performance data for a day, a month, and a year.

Examples:

{ 0: { hour: 1400, load_avg_ms: 12.3, normalization_avg_ms: 4.2 },
  1: { hour: 1500, load_avg_ms: 12.3, normalization_avg_ms: 4.2 },
  2: { hour: 1600, load_avg_ms: 12.3, normalization_avg_ms: 4.2 },
  ...,
  23: { hour: 1300, load_avg_ms: 12.3, normalization_avg_ms: 4.2 }
}


45
46
47
48
49
50
51
# File 'app/models/qa_server/performance_history.rb', line 45

def performance_data
  data = {}
  data[PERFORMANCE_FOR_DAY_KEY] = average_last_24_hours
  data[PERFORMANCE_FOR_MONTH_KEY] = average_last_30_days
  data[PERFORMANCE_FOR_YEAR_KEY] = average_last_12_months
  data
end

.save_result(dt_stamp:, authority:, action:, size_bytes:, load_time_ms:, normalization_time_ms:) ⇒ Object

Save a scenario result

Parameters:

  • run_id (Integer)

    the run on which to gather statistics

  • result (Hash)

    the scenario result to be saved



27
28
29
30
31
32
33
34
# File 'app/models/qa_server/performance_history.rb', line 27

def save_result(dt_stamp:, authority:, action:, size_bytes:, load_time_ms:, normalization_time_ms: )
  QaServer::PerformanceHistory.create(dt_stamp: dt_stamp,
                                      authority: authority,
                                      action: action,
                                      size_bytes: size_bytes,
                                      load_time_ms: load_time_ms,
                                      normalization_time_ms: normalization_time_ms)
end