Class: QaServer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/qa_server/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#display_historical_datatable=(value) ⇒ Object (writeonly)

Displays a datatable of historical test data when true

Parameters:

  • display (Boolean)

    history datatable when true



56
57
58
# File 'lib/qa_server/configuration.rb', line 56

def display_historical_datatable=(value)
  @display_historical_datatable = value
end

#display_historical_graph=(value) ⇒ Object (writeonly)

Displays a graph of historical test data when true

Parameters:

  • display (Boolean)

    history graph when true



48
49
50
# File 'lib/qa_server/configuration.rb', line 48

def display_historical_graph=(value)
  @display_historical_graph = value
end

#display_performance_datatable=(value) ⇒ Object (writeonly)

Displays a datatable of performance test data when true

Parameters:

  • display (Boolean)

    performance datatable when true



130
131
132
# File 'lib/qa_server/configuration.rb', line 130

def display_performance_datatable=(value)
  @display_performance_datatable = value
end

#display_performance_graph=(value) ⇒ Object (writeonly)

Displays a graph of performance test data when true

Parameters:

  • display (Boolean)

    performance graph when true



78
79
80
# File 'lib/qa_server/configuration.rb', line 78

def display_performance_graph=(value)
  @display_performance_graph = value
end

Additional menu items to add to the main navigation menu’s set of left justified menu items

Examples:

[
  { label: 'New Item Label', url: 'http://new.item/one' },
  { label: '2nd New Item Label', url: 'http://new.item/two' }
]

Parameters:

  • array (Array<Hash<String,String>>)

    of menu items to append with hash key = menu item label to display and hash value = URL for the menu item link



171
172
173
# File 'lib/qa_server/configuration.rb', line 171

def navmenu_extra_leftitems
  @navmenu_extra_leftitems
end

#performance_datatable_max_thresholdObject



153
154
155
# File 'lib/qa_server/configuration.rb', line 153

def performance_datatable_max_threshold
  @performance_datatable_max_threshold ||= 1500
end

#performance_datatable_warning_thresholdObject



160
161
162
# File 'lib/qa_server/configuration.rb', line 160

def performance_datatable_warning_threshold
  @performance_datatable_warning_threshold ||= 1000
end

#performance_graph_load_colorObject



102
103
104
# File 'lib/qa_server/configuration.rb', line 102

def performance_graph_load_color
  @performance_graph_load_color ||= '#E8DCD3'
end

#performance_normalization_colorObject



110
111
112
# File 'lib/qa_server/configuration.rb', line 110

def performance_normalization_color
  @performance_normalization_color ||= '#CCBE9F'
end

#performance_retrieve_colorObject



94
95
96
# File 'lib/qa_server/configuration.rb', line 94

def performance_retrieve_color
  @performance_retrieve_color ||= '#ABC3C9'
end

#performance_y_axis_maxObject



86
87
88
# File 'lib/qa_server/configuration.rb', line 86

def performance_y_axis_max
  @performance_y_axis_max ||= 4000
end

#preferred_time_zone_nameObject



8
9
10
# File 'lib/qa_server/configuration.rb', line 8

def preferred_time_zone_name
  @preferred_time_zone_name ||= 'Eastern Time (US & Canada)'
end

#suppress_logging_performance_datailsObject



200
201
202
# File 'lib/qa_server/configuration.rb', line 200

def suppress_logging_performance_datails
  @suppress_logging_performance_datails ||= false
end

#suppress_performance_gatheringObject



192
193
194
# File 'lib/qa_server/configuration.rb', line 192

def suppress_performance_gathering
  @suppress_performance_gathering ||= false
end

Instance Method Details

#display_historical_datatable?Boolean

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/qa_server/configuration.rb', line 57

def display_historical_datatable?
  return @display_historical_datatable unless @display_historical_datatable.nil?
  @display_historical_datatable = true
end

#display_historical_graph?Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/qa_server/configuration.rb', line 49

def display_historical_graph?
  return @display_historical_graph unless @display_historical_graph.nil?
  @display_historical_graph = false
end

#display_performance_datatable?Boolean

Returns:

  • (Boolean)


131
132
133
134
# File 'lib/qa_server/configuration.rb', line 131

def display_performance_datatable?
  return @display_performance_datatable unless @display_performance_datatable.nil?
  @display_performance_datatable = true
end

#display_performance_graph?Boolean

Returns:

  • (Boolean)


79
80
81
82
# File 'lib/qa_server/configuration.rb', line 79

def display_performance_graph?
  return @display_performance_graph unless @display_performance_graph.nil?
  @display_performance_graph = false
end

#historical_datatable_default_time_periodSymbol

Historical datatable default time period.

Returns:

  • (Symbol)

    time period for calculating historical pass/fail (i.e., one of :month, :year, or :all)



72
73
74
# File 'lib/qa_server/configuration.rb', line 72

def historical_datatable_default_time_period
  @historical_datatable_default_time_period ||= :year
end

#historical_datatable_default_time_period=(time_period) ⇒ Object

Historical datatable default time period.

Parameters:

  • time (Symbol)

    period for calculating historical pass/fail (i.e., one of :month, :year, or :all)

Raises:

  • (ArgumentError)

    if time_period is not one of :month, :year, or :all



65
66
67
68
# File 'lib/qa_server/configuration.rb', line 65

def historical_datatable_default_time_period=(time_period)
  raise ArgumentError, 'time_period must be one of :day, :month, or :year' unless [:month, :year, :all].include? time_period
  @historical_datatable_default_time_period = time_period
end

#hour_offset_to_expire_cacheInteger Also known as: hour_offset_to_run_monitoring_tests

Preferred hour to expire caches related to slow running calculations (e.g. monitoring tests, performance data)

Returns:

  • (Integer)

    count of hours after midnight (0-23 with 0=midnight)



25
26
27
# File 'lib/qa_server/configuration.rb', line 25

def hour_offset_to_expire_cache
  @hour_offset_to_expire_cache ||= 3
end

#hour_offset_to_expire_cache=(offset) ⇒ Object

Set preferred hour to expire caches related to slow running calculations (e.g. monitoring tests, performance data)

Examples:

For preferred_time_zone_name of 'Eastern Time (US & Canada)', use 3 for slow down at midnight PT/3am ET
For preferred_time_zone_name of 'Pacific Time (US & Canada)', use 0 for slow down at midnight PT/3am ET

Parameters:

  • count (Integer)

    of hours after midnight (0-23 with 0=midnight)

Raises:

  • (ArgumentError)

    if offset is not between 0 and 23



18
19
20
21
# File 'lib/qa_server/configuration.rb', line 18

def hour_offset_to_expire_cache=(offset)
  raise ArgumentError, 'offset must be between 0 and 23' unless (0..23).cover? offset
  @hour_offset_to_expire_cache = offset
end

#hour_offset_to_run_monitoring_tests=(offset) ⇒ Object

Deprecated.

Set preferred hour to run monitoring tests (deprecated)

Examples:

For preferred_time_zone_name of 'Eastern Time (US & Canada)', use 3 for slow down at midnight PT/3am ET
For preferred_time_zone_name of 'Pacific Time (US & Canada)', use 0 for slow down at midnight PT/3am ET

Parameters:

  • count (Integer)

    of hours from midnight (0-23 with 0=midnight)



35
36
37
38
# File 'lib/qa_server/configuration.rb', line 35

def hour_offset_to_run_monitoring_tests=(offset)
  Deprecation.warn(QaServer, "hour_offset_to_run_monitoring_tests= is deprecated and will be removed from a future release (use #hour_offset_to_expire_cache= instead)")
  @hour_offset_to_expire_cache = offset
end

#monitor_loggerObject

For internal use only



211
212
213
# File 'lib/qa_server/configuration.rb', line 211

def monitor_logger
  @monitor_logger ||= Logger.new(ENV['MONITOR_LOG_PATH'] || File.join("log", "monitor.log"))
end

Get the one and only instance of the navigation menu presenter used to construct the main navigation menu. To extend, set additional navigation menu items using #navmenu_extra_leftitems



175
176
177
178
179
180
# File 'lib/qa_server/configuration.rb', line 175

def navmenu_presenter
  return @navmenu_presenter if @navmenu_presenter.present?
  @navmenu_presenter ||= QaServer::NavmenuPresenter.new
  @navmenu_presenter.append_leftmenu_items(navmenu_extra_leftitems)
  @navmenu_presenter
end

#performance_cacheObject

For internal use only TODO: consider refactor performance caching to use Rails cache



206
207
208
# File 'lib/qa_server/configuration.rb', line 206

def performance_cache
  @performance_cache ||= QaServer::PerformanceCache.new
end

#performance_datatable_default_time_periodSymbol

Performance datatable default time period for calculating stats.

Returns:

  • (Symbol)

    time period for calculating performance stats (i.e., one of :day, :month, :year, or :all)



146
147
148
# File 'lib/qa_server/configuration.rb', line 146

def performance_datatable_default_time_period
  @performance_datatable_default_time_period ||= :year
end

#performance_datatable_default_time_period=(time_period) ⇒ Object

Performance datatable default time period for calculating stats.

Parameters:

  • time (Symbol)

    period for calculating performance stats (i.e., one of :day, :month, :year, or :all)

Raises:

  • (ArgumentError)

    if time_period is not one of :day, :month, :year, or :all



139
140
141
142
# File 'lib/qa_server/configuration.rb', line 139

def performance_datatable_default_time_period=(time_period)
  raise ArgumentError, 'time_period must be one of :day, :month, :year, or :all' unless [:day, :month, :year, :all].include? time_period
  @performance_datatable_default_time_period = time_period
end

#performance_graph_default_time_periodSymbol

Performance graph default time period for all graphs. All authorities will show the graph for this time period on page load.

Returns:

  • (Symbol)

    time period for default display of performance graphs (i.e., one of :day, :month, or :year)



124
125
126
# File 'lib/qa_server/configuration.rb', line 124

def performance_graph_default_time_period
  @performance_graph_default_time_period ||= :month
end

#performance_graph_default_time_period=(time_period) ⇒ Object

Performance graph default time period for all graphs. All authorities will show the graph for this time period on page load.

Parameters:

  • time (Symbol)

    period for default display of performance graphs (i.e., one of :day, :month, or :year)

Raises:

  • (ArgumentError)

    if time_period is not one of :day, :month, or :year



117
118
119
120
# File 'lib/qa_server/configuration.rb', line 117

def performance_graph_default_time_period=(time_period)
  raise ArgumentError, 'time_period must be one of :day, :month, or :year' unless [:day, :month, :year].include? time_period
  @performance_graph_default_time_period = time_period
end

#performance_trackerObject



182
183
184
185
186
# File 'lib/qa_server/configuration.rb', line 182

def performance_tracker
  @performance_tracker ||= File.new('log/performance.csv', 'w').tap do |f|
    f.puts('action, http request, load graph, normalization, TOTAL, data size, authority')
  end
end