class QaServer::Configuration
Attributes
Displays a datatable of historical test data when true @param [Boolean] display history datatable when true
Displays a graph of historical test data when true @param [Boolean] display history graph when true
Displays a datatable of performance test data when true @param [Boolean] display performance datatable when true
Displays a graph of performance test data when true @param [Boolean] display performance graph when true
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
Performance datatable targeted maximum full request time. @param [Integer] targeted maximum full request time in ms
Performance datatable targeted warning full request time. @param [Integer] targeted warning full request time in ms
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.
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.
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.
Max time in milliseconds for y-axis in the performance graphs.
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
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)
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)
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)
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
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 logging of performance cache
# File lib/qa_server/configuration.rb, line 261 def disable_monitor_status_logging monitor_logger.level = Logger::INFO end
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
# 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
# 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
# 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
# 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 logging of monitoring process
# File lib/qa_server/configuration.rb, line 256 def enable_monitor_status_logging monitor_logger.level = Logger::DEBUG end
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. @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. @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
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
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
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.
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
# 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
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
For internal use only
# File lib/qa_server/configuration.rb, line 236 def performance_cache @performance_cache ||= QaServer::PerformanceCache.new end
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 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 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
# File lib/qa_server/configuration.rb, line 167 def performance_datatable_max_threshold @performance_datatable_max_threshold ||= 1500 end
# File lib/qa_server/configuration.rb, line 174 def performance_datatable_warning_threshold @performance_datatable_warning_threshold ||= 1000 end
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 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
# File lib/qa_server/configuration.rb, line 116 def performance_graph_load_color @performance_graph_load_color ||= '#E8DCD3' end
# File lib/qa_server/configuration.rb, line 124 def performance_normalization_color @performance_normalization_color ||= '#CCBE9F' end
# File lib/qa_server/configuration.rb, line 108 def performance_retrieve_color @performance_retrieve_color ||= '#ABC3C9' end
# 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
# File lib/qa_server/configuration.rb, line 100 def performance_y_axis_max @performance_y_axis_max ||= 4000 end
# File lib/qa_server/configuration.rb, line 8 def preferred_time_zone_name @preferred_time_zone_name ||= 'Eastern Time (US & Canada)' end
# 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
# 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
# File lib/qa_server/configuration.rb, line 86 def up_down_data_mostly_up_threshold @up_down_data_mostly_up_threshold ||= 0.95 end
# 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
# 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