lib/contrast/components/assess.rb in contrast-agent-7.3.0 vs lib/contrast/components/assess.rb in contrast-agent-7.3.1

- old
+ new

@@ -15,18 +15,30 @@ class Interface # rubocop:disable Metrics/ClassLength include Contrast::Components::ComponentBase # @return [Boolean, nil] attr_accessor :enable - # @return [Array, nil] - attr_writer :enable_scan_response, :enable_dynamic_sources, :sampling, :rules, :stacktraces, :tags + # @return [Boolean, nil] + attr_writer :enable_scan_response + # @return [Boolean, nil] + attr_writer :enable_dynamic_sources + # @return [Contrast::Components::Sampling::Interface] + attr_writer :sampling + # @return [Contrast::Components::AssessRules::Interface] + attr_writer :rules + # @return [String, nil] + attr_writer :stacktraces + # @return [Array<String>, nil] + attr_writer :tags # @return [String] attr_reader :canon_name - # @return [Array] + # @return [Array<String>] attr_reader :config_values # @return [Boolean] attr_writer :enable_original_object + # @return [Boolean] + attr_writer :enable_response_as_source # @return [Integer] attr_writer :max_context_source_events # @return [Integer] attr_writer :max_propagation_events # @return [Integer] @@ -44,10 +56,11 @@ enabled? tags enable_scan_response enable_original_object enable_dynamic_sources + enable_response_as_source stacktraces max_context_source_events max_propagation_events max_rule_reported time_limit_threshold @@ -61,31 +74,37 @@ @enable = hsh[:enable] @tags = hsh[:tags] @enable_scan_response = hsh[:enable_scan_response] @enable_dynamic_sources = hsh[:enable_dynamic_sources] @enable_original_object = hsh[:enable_original_object] + @enable_response_as_source = hsh[:enable_response_as_source] @sampling = Contrast::Components::Sampling::Interface.new(hsh[:sampling]) @rules = Contrast::Components::AssessRules::Interface.new(hsh[:rules]) @stacktraces = hsh[:stacktraces] assign_limits(hsh) end - # @return [Boolean, true] + # @return [Boolean] def enable_scan_response @enable_scan_response.nil? ? true : @enable_scan_response end - # @return [Boolean, true] + # @return [Boolean] def enable_dynamic_sources @enable_dynamic_sources.nil? ? true : @enable_dynamic_sources end - # @return [Boolean, true] + # @return [Boolean] def enable_original_object @enable_original_object.nil? ? true : @enable_original_object end + # @return [Boolean] + def enable_response_as_source + @enable_response_as_source.nil? ? false : @enable_response_as_source + end + # @return [Contrast::Components::Sampling::Interface] def sampling @sampling ||= Contrast::Components::Sampling::Interface.new end @@ -207,10 +226,17 @@ @_track_original_object = !false?(enable_original_object) if @_track_original_object.nil? @_track_original_object end + def track_response_as_source? + @track_response_as_source = !false?(enable_response_as_source) if + @track_response_as_source.nil? + + @track_response_as_source + end + # The id for this process, based on the session metadata or id provided by the user, as indicated in # application startup. def session_id ::Contrast::SETTINGS.assess_state.session_id end @@ -232,9 +258,10 @@ @_forcibly_enabled = true?(::Contrast::CONFIG.assess.enable) if @_forcibly_enabled.nil? @_forcibly_enabled end # Sets Event limits from configuration and converts string numbers to integers. + # @param hsh [Hash] the configuration hash def assign_limits hsh return unless hsh source_limit = hsh[:max_context_source_events]&.to_i propagation_limit = hsh[:max_propagation_events]&.to_i