Class: Contrast::Components::Sampling::Interface
- Extended by:
- ClassMethods
- Defined in:
- lib/contrast/components/sampling.rb
Overview
:nodoc:
Constant Summary collapse
- CANON_NAME =
'assess.sampling'
- CONFIG_VALUES =
%w[enable baseline request_frequency response_frequency window_ms].cs__freeze
Constants included from Constants
Constants::DEFAULT_SAMPLING_BASELINE, Constants::DEFAULT_SAMPLING_ENABLED, Constants::DEFAULT_SAMPLING_REQUEST_FREQUENCY, Constants::DEFAULT_SAMPLING_RESPONSE_FREQUENCY, Constants::DEFAULT_SAMPLING_WINDOW_MS
Constants included from ComponentBase
Constants included from Contrast::Config::Diagnostics::Tools
Contrast::Config::Diagnostics::Tools::CHECK
Constants included from Contrast::Config::Diagnostics::SingletonTools
Contrast::Config::Diagnostics::SingletonTools::API_CREDENTIALS, Contrast::Config::Diagnostics::SingletonTools::CONTRAST_MARK
Constants included from Contrast::Config::BaseConfiguration
Contrast::Config::BaseConfiguration::AT_UNDERSCORE
Instance Attribute Summary collapse
- #baseline ⇒ Integer?
- #canon_name ⇒ String
- #enable ⇒ Boolean?
- #request_frequency ⇒ Integer?
- #response_frequency ⇒ Integer?
- #window_ms ⇒ Integer?
Instance Method Summary collapse
-
#initialize(hsh = {}) ⇒ Interface
constructor
A new instance of Interface.
-
#to_effective_config(effective_config) ⇒ Object
Converts current configuration to effective config values class and appends them to EffectiveConfig class.
Methods included from ClassMethods
reset_sampling_control, sampling_control, sampling_enabled?
Methods included from ComponentBase
#config_values, #false?, #file_exists?, #stringify_array, #true?, #valid_cert?
Methods included from Contrast::Config::Diagnostics::Tools
#add_effective_config_values, #add_single_effective_value
Methods included from Contrast::Config::Diagnostics::SingletonTools
#flatten_settings, #to_config_values, #update_config, #value_to_s
Methods included from Contrast::Config::BaseConfiguration
Constructor Details
#initialize(hsh = {}) ⇒ Interface
Returns a new instance of Interface.
129 130 131 132 133 134 135 136 137 138 |
# File 'lib/contrast/components/sampling.rb', line 129 def initialize hsh = {} @canon_name = CANON_NAME return unless hsh @enable = hsh[:enable] @baseline = hsh[:baseline] @request_frequency = hsh[:request_frequency] @response_frequency = hsh[:response_frequency] @window_ms = hsh[:window_ms] end |
Instance Attribute Details
#baseline ⇒ Integer?
119 120 121 |
# File 'lib/contrast/components/sampling.rb', line 119 def baseline @baseline end |
#canon_name ⇒ String
127 128 129 |
# File 'lib/contrast/components/sampling.rb', line 127 def canon_name @canon_name end |
#enable ⇒ Boolean?
117 118 119 |
# File 'lib/contrast/components/sampling.rb', line 117 def enable @enable end |
#request_frequency ⇒ Integer?
121 122 123 |
# File 'lib/contrast/components/sampling.rb', line 121 def request_frequency @request_frequency end |
#response_frequency ⇒ Integer?
123 124 125 |
# File 'lib/contrast/components/sampling.rb', line 123 def response_frequency @response_frequency end |
#window_ms ⇒ Integer?
125 126 127 |
# File 'lib/contrast/components/sampling.rb', line 125 def window_ms @window_ms end |
Instance Method Details
#to_effective_config(effective_config) ⇒ Object
Converts current configuration to effective config values class and appends them to EffectiveConfig class.
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/contrast/components/sampling.rb', line 144 def to_effective_config effective_config confirm_sources add_single_effective_value(effective_config, 'enable', sampling_control[:enabled], canon_name) add_single_effective_value(effective_config, 'baseline', sampling_control[:baseline], canon_name) add_single_effective_value(effective_config, 'window_ms', sampling_control[:window], canon_name) add_single_effective_value(effective_config, 'request_frequency', sampling_control[:request_frequency], canon_name) add_single_effective_value(effective_config, 'response_frequency', sampling_control[:response_frequency], canon_name) end |