class QaServer::Configuration

Attributes

display_historical_datatable[W]

Displays a datatable of historical test data when true @param [Boolean] display history datatable when true

display_historical_graph[W]

Displays a graph of historical test data when true @param [Boolean] display history graph when true

display_performance_datatable[W]

Displays a datatable of performance test data when true @param [Boolean] display performance datatable when true

display_performance_graph[W]

Displays a graph of performance test data when true @param [Boolean] display performance graph when true

max_performance_cache_size[W]

Maximum amount of memory the performance cache can occupy before it is written to the database. @param [Integer] maximum size of performance cache before flushing

navmenu_extra_leftitems[RW]

Additional menu items to add to the main navigation menu's set of left justified menu items @param [Array<Hash<String,String>>] array of menu items to append with hash key = menu item label to display and hash value = URL for the menu item link @example

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

Performance datatable targeted maximum full request time. @param [Integer] targeted maximum full request time in ms

performance_datatable_warning_threshold[W]

Performance datatable targeted warning full request time. @param [Integer] targeted warning full request time in ms

performance_graph_load_color[W]

Color of the graph line for graph load times in the performance graphs. @param [String] color RGB code @note The default colors for the retrieve, graph_load, load, normalization, and full request lines in the performance graph are accessible.

performance_normalization_color[W]

Color of the graph line for normalization times in the performance graphs @param [String] color RGB code @note The default colors for the retrieve, graph_load, load, normalization, and full request lines in the performance graph are accessible.

performance_retrieve_color[W]

Color of the graph line for retrieve times in the performance graphs. @param [String] color RGB code @note The default colors for the retrieve, graph_load, load, normalization, and full request lines in the performance graph are accessible.

performance_y_axis_max[W]

Max time in milliseconds for y-axis in the performance graphs.

preferred_time_zone_name[W]

Preferred time zone for reporting historical data and performance data @param [String] time zone name @see api.rubyonrails.org/classes/ActiveSupport/TimeZone.html for possible values of TimeZone names

suppress_logging_performance_datails=[W]

Performance data is gathered on every incoming query. Basic stats are logged from QA. Full stats are logged by QaServer and can eat up logging realestate. To suppress the logging of details, set this config to true. @param [Boolean] do not log performance data details when true (defaults to false for backward compatibitily)

suppress_logging_performance_details[W]

Performance data is gathered on every incoming query. Basic stats are logged from QA. Full stats are logged by QaServer and can eat up logging realestate. To suppress the logging of details, set this config to true. @param [Boolean] do not log performance data details when true (defaults to false for backward compatibitily)

suppress_performance_gathering[W]

Performance data is gathered on every incoming query. If load is high, this can have a negative performance impact and may need to be suppressed. Performance stats will not be gathered when this config is true. @param [Boolean] do not gather performance data when true (defaults to false for backward compatibitily)

up_down_data_mostly_up_threshold[W]

Threshold for percentage of queries that are passing, below which are marked in the Authority Connection up-down History as barely_up @param [Float] required percentage of queries passing to be considered mostly-up when there are some failures

up_down_data_timeouts_max_threshold[W]

Threshold for percentage of queries that timed out after which it gets marked in the Authority Connection up-down History @param [Float] percentage of queries that are ok to timeout

Public Instance Methods

disable_monitor_status_logging() click to toggle source

Disable logging of performance cache

# File lib/qa_server/configuration.rb, line 261
def disable_monitor_status_logging
  monitor_logger.level = Logger::INFO
end
disable_performance_cache_logging() click to toggle source

Disable logging of performance cache

# File lib/qa_server/configuration.rb, line 246
def disable_performance_cache_logging
  performance_cache_logger.level = Logger::INFO
end
display_historical_datatable?() click to toggle source
# 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?() click to toggle source
# 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?() click to toggle source
# File lib/qa_server/configuration.rb, line 145
def display_performance_datatable?
  return @display_performance_datatable unless @display_performance_datatable.nil?
  @display_performance_datatable = true
end
display_performance_graph?() click to toggle source
# File lib/qa_server/configuration.rb, line 93
def display_performance_graph?
  return @display_performance_graph unless @display_performance_graph.nil?
  @display_performance_graph = false
end
enable_monitor_status_logging() click to toggle source

Enable logging of monitoring process

# File lib/qa_server/configuration.rb, line 256
def enable_monitor_status_logging
  monitor_logger.level = Logger::DEBUG
end
enable_performance_cache_logging() click to toggle source

Enable logging of performance cache

# File lib/qa_server/configuration.rb, line 241
def enable_performance_cache_logging
  performance_cache_logger.level = Logger::DEBUG
end
historical_datatable_default_time_period() click to toggle source

Historical datatable default time period. @return [Symbol] time period for calculating historical pass/fail (i.e., one of :month, :year, or :all)

# 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) click to toggle source

Historical datatable default time period. @param time_period [Symbol] time period for calculating historical pass/fail (i.e., one of :month, :year, or :all) @raise [ArgumentError] if time_period is not one of :month, :year, or :all

# File lib/qa_server/configuration.rb, line 65
def historical_datatable_default_time_period=(time_period)
  raise ArgumentError, 'time_period must be one of :month, :year, or :all' unless [:month, :year, :all].include? time_period
  @historical_datatable_default_time_period = time_period
end
hour_offset_to_expire_cache() click to toggle source

Preferred hour to expire caches related to slow running calculations (e.g. monitoring tests, performance data) @return [Integer] count of hours after midnight (0-23 with 0=midnight)

# 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) click to toggle source

Set preferred hour to expire caches related to slow running calculations (e.g. monitoring tests, performance data) @param offset [Integer] count of hours after midnight (0-23 with 0=midnight) @raise [ArgumentError] if offset is not between 0 and 23 @example

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
# 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()

Preferred hour to run monitoring tests (deprecated) @return [Integer] count of hours from midnight (0-23 with 0=midnight) @deprecated Use {#hour_offset_to_expire_cache} instead.

hour_offset_to_run_monitoring_tests=(offset) click to toggle source

Set preferred hour to run monitoring tests (deprecated) @param offset [Integer] count of hours from midnight (0-23 with 0=midnight) @example

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

@deprecated Use {#hour_offset_to_expire_cache=} instead.

# 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
max_performance_cache_size() click to toggle source
# File lib/qa_server/configuration.rb, line 231
def max_performance_cache_size
  @max_performance_cache_size ||= convert_size_to_bytes(ENV['MAX_PERFORMANCE_CACHE_SIZE']) || 32.megabytes
end
monitor_logger() click to toggle source

For internal use only

# File lib/qa_server/configuration.rb, line 266
def monitor_logger
  @monitor_logger ||= Logger.new(ENV['MONITOR_LOG_PATH'] || File.join("log", "monitor.log"))
end
navmenu_presenter() click to toggle source

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

performance_cache() click to toggle source

For internal use only

# File lib/qa_server/configuration.rb, line 236
def performance_cache
  @performance_cache ||= QaServer::PerformanceCache.new
end
performance_cache_logger() click to toggle source

For internal use only

# File lib/qa_server/configuration.rb, line 251
def performance_cache_logger
  @performance_cache_logger ||= Logger.new(ENV['PERFORMANCE_CACHE_LOG_PATH'] || File.join("log", "performance_cache.log"))
end
performance_datatable_default_time_period() click to toggle source

Performance datatable default time period for calculating stats. @return [Symbol] time period for calculating performance stats (i.e., one of :day, :month, :year, or :all)

# File lib/qa_server/configuration.rb, line 160
def performance_datatable_default_time_period
  @performance_datatable_default_time_period ||= :year
end
performance_datatable_default_time_period=(time_period) click to toggle source

Performance datatable default time period for calculating stats. @param time_period [Symbol] time period for calculating performance stats (i.e., one of :day, :month, :year, or :all) @raise [ArgumentError] if time_period is not one of :day, :month, :year, or :all

# File lib/qa_server/configuration.rb, line 153
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_datatable_max_threshold() click to toggle source
# File lib/qa_server/configuration.rb, line 167
def performance_datatable_max_threshold
  @performance_datatable_max_threshold ||= 1500
end
performance_datatable_warning_threshold() click to toggle source
# File lib/qa_server/configuration.rb, line 174
def performance_datatable_warning_threshold
  @performance_datatable_warning_threshold ||= 1000
end
performance_graph_default_time_period() click to toggle source

Performance graph default time period for all graphs. All authorities will show the graph for this time period on page load. @return [Symbol] time period for default display of performance graphs (i.e., one of :day, :month, or :year)

# File lib/qa_server/configuration.rb, line 138
def performance_graph_default_time_period
  @performance_graph_default_time_period ||= :month
end
performance_graph_default_time_period=(time_period) click to toggle source

Performance graph default time period for all graphs. All authorities will show the graph for this time period on page load. @param time_period [Symbol] time period for default display of performance graphs (i.e., one of :day, :month, or :year) @raise [ArgumentError] if time_period is not one of :day, :month, or :year

# File lib/qa_server/configuration.rb, line 131
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_graph_load_color() click to toggle source
# File lib/qa_server/configuration.rb, line 116
def performance_graph_load_color
  @performance_graph_load_color ||= '#E8DCD3'
end
performance_normalization_color() click to toggle source
# File lib/qa_server/configuration.rb, line 124
def performance_normalization_color
  @performance_normalization_color ||= '#CCBE9F'
end
performance_retrieve_color() click to toggle source
# File lib/qa_server/configuration.rb, line 108
def performance_retrieve_color
  @performance_retrieve_color ||= '#ABC3C9'
end
performance_tracker() click to toggle source
# File lib/qa_server/configuration.rb, line 196
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
performance_y_axis_max() click to toggle source
# File lib/qa_server/configuration.rb, line 100
def performance_y_axis_max
  @performance_y_axis_max ||= 4000
end
preferred_time_zone_name() click to toggle source
# 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_datails()
suppress_logging_performance_datails?()
suppress_logging_performance_details?() click to toggle source
# File lib/qa_server/configuration.rb, line 217
def suppress_logging_performance_details?
  return @suppress_logging_performance_details unless @suppress_logging_performance_details.nil?
  @suppress_logging_performance_details ||= false
end
suppress_performance_gathering()
suppress_performance_gathering?() click to toggle source
# File lib/qa_server/configuration.rb, line 206
def suppress_performance_gathering?
  return @suppress_performance_gathering unless @suppress_performance_gathering.nil?
  @suppress_performance_gathering ||= false
end
up_down_data_mostly_up_threshold() click to toggle source
# File lib/qa_server/configuration.rb, line 86
def up_down_data_mostly_up_threshold
  @up_down_data_mostly_up_threshold ||= 0.95
end
up_down_data_timeouts_max_threshold() click to toggle source
# File lib/qa_server/configuration.rb, line 79
def up_down_data_timeouts_max_threshold
  @up_down_data_timeouts_max_threshold ||= 0.3
end

Private Instance Methods

convert_size_to_bytes(size) click to toggle source
# File lib/qa_server/configuration.rb, line 272
def convert_size_to_bytes(size)
  return if size.nil?
  md = size.match(/^(?<num>\d+)\s?(?<unit>\w+)?$/)
  return md[:num].to_i if md[:unit].nil?
  md[:num].to_i *
    case md[:unit].upcase
    when 'KB'
      1024
    when 'MB'
      1024**2
    when 'GB'
      1024**3
    else
      1
    end
end