lib/contrast/config/sampling_configuration.rb in contrast-agent-6.0.0 vs lib/contrast/config/sampling_configuration.rb in contrast-agent-6.1.0
- old
+ new
@@ -1,27 +1,30 @@
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true
module Contrast
module Config
- # Common Configuration settings. Those in this section pertain to the
- # sampling functionality of the Agent.
- class SamplingConfiguration < BaseConfiguration
+ # Common Configuration settings. Those in this section pertain to the sampling functionality of the Agent.
+ class SamplingConfiguration
+ include Contrast::Config::BaseConfiguration
+
# @return [Integer, nil]
attr_reader :baseline
# @return [Integer, nil]
attr_reader :request_frequency
# @return [Integer, nil]
attr_reader :response_frequency
# @return [Integer, nil]
attr_reader :window_ms
def initialize hsh = {}
- @enable = traverse_config(hsh, :enable)
- @baseline = traverse_config(hsh, :baseline)
- @request_frequency = traverse_config(hsh, :request_frequency)
- @response_frequency = traverse_config(hsh, :response_frequency)
- @window_ms = traverse_config(hsh, :window_ms)
+ 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
# @return [Boolean, false]
def enable
!!@enable