lib/contrast/config/sampling_configuration.rb in contrast-agent-5.3.0 vs lib/contrast/config/sampling_configuration.rb in contrast-agent-6.0.0
- old
+ new
@@ -19,70 +19,14 @@
@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)
- @configuration_map = {}
- build_configuration_map
end
# @return [Boolean, false]
def enable
- @enable.nil? ? false : @enable
- end
-
- def enable= value
- self['enable'] = value
- end
-
- def baseline= value
- self['baseline'] = value
- end
-
- def request_frequency= value
- self['request_frequency'] = value
- end
-
- def response_frequency= value
- self['response_frequency'] = value
- end
-
- def window_ms= value
- self['window_ms'] = value
- end
-
- # TODO: RUBY-1493 MOVE TO BASE CONFIG
-
- def []= key, value
- instance_variable_set("@#{ key }".to_sym, value)
- @configuration_map[key] = value
- end
-
- def [] key
- send(key.to_sym)
- end
-
- # Traverse the given entity to build out the configuration graph.
- #
- # The values will be either a hash, indicating internal nodes to
- # traverse, or a value to set or the EMPTY_VALUE symbol, indicating a
- # leaf node.
- #
- # The spec_key are the Contrast defined keys based on the instance variables of
- # a given configuration.
- def traverse_config values, spec_key
- internal_nodes = values.cs__respond_to?(:has_key?)
- val = internal_nodes ? value_from_key_config(spec_key, values) : nil
- val == EMPTY_VALUE ? nil : val
- end
-
- def build_configuration_map
- instance_variables.each do |key|
- str_key = key.to_s.tr('@', '')
- next if str_key == 'configuration_map'
-
- @configuration_map[str_key] = send(str_key.to_sym)
- end
+ !!@enable
end
end
end
end