Sha256: 6be66d6e0a063a394f21aebba20232283e54821f910863b92fb1afbae5b39584

Contents?: true

Size: 1.68 KB

Versions: 6

Compression:

Stored size: 1.68 KB

Contents

# 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 Heap Dump collection functionality of the
    # Agent.
    class HeapDumpConfiguration
      include Contrast::Config::BaseConfiguration

      DEFAULT_PATH = 'contrast_heap_dumps' # saved
      DEFAULT_MS = 10_000
      DEFAULT_COUNT = 5

      attr_writer :enable, :path, :delay_ms, :window_ms, :count, :clean

      def initialize hsh = {}
        return unless hsh

        @enable = hsh[:enable]
        @path = hsh[:path]
        @delay_ms = hsh[:delay_ms]
        @window_ms = hsh[:window_ms]
        @count = hsh[:count]
        @clean = hsh[:clean]
      end

      # @return [Boolean, Contrast::Utils::ObjectShare::FALSE] should dumps be taken
      def enable
        @enable.nil? ? Contrast::Utils::ObjectShare::FALSE : @enable
      end

      # @return [String, DEFAULT_PATH] dir to which dumps should be
      def path
        @path ||= DEFAULT_PATH
      end

      # @return [Integer, DEFAULT_MS] time, in ms, after initialization
      def delay_ms
        @delay_ms ||= DEFAULT_MS
      end

      # @return [Integer, DEFAULT_MS] ms between each dump
      def window_ms
        @window_ms ||= DEFAULT_MS
      end

      # @return [Integer, DEFAULT_MS] number of dumps to take
      def count
        @count ||= DEFAULT_COUNT
      end

      # @return [Boolean, Contrast::Utils::ObjectShare::FALSE] remove temporary objects or not
      def clean
        @clean.nil? ? Contrast::Utils::ObjectShare::FALSE : @clean
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
contrast-agent-6.4.0 lib/contrast/config/heap_dump_configuration.rb
contrast-agent-6.3.0 lib/contrast/config/heap_dump_configuration.rb
contrast-agent-6.2.0 lib/contrast/config/heap_dump_configuration.rb
contrast-agent-6.1.2 lib/contrast/config/heap_dump_configuration.rb
contrast-agent-6.1.1 lib/contrast/config/heap_dump_configuration.rb
contrast-agent-6.1.0 lib/contrast/config/heap_dump_configuration.rb