Sha256: 8f0c5da0455f870ad70bc7e3f43abcee0ebef5ab1d67d02c372b040b56eb1bce

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/components/base'
require 'contrast/components/heap_dump'

module Contrast
  module Components
    module HeapDump
      # A wrapper build around the Common Agent Configuration project to allow
      # for access of the values contained in its
      # parent_configuration_spec.yaml.
      # Specifically, this allows for querying the state of the Heap Dump
      # utility.
      module ClassMethods
        include Contrast::Components::ComponentBase

        def heap_dump_enabled?
          heap_dump_control[:enabled]
        end

        def heap_dump_control
          @_heap_dump_control ||= begin
            config = ::Contrast::CONFIG.root&.agent&.heap_dump
            {
                enabled: true?(config&.enable),
                path: File.absolute_path(config&.path),
                count: config&.count.to_i || 0,
                window: (config&.window_ms.to_f || 0) / 1000,
                delay: (config&.delay_ms.to_f || 0) / 1000,
                clean: true?(config&.clean)
            }
          end
        end
      end
      InstanceMethods = ClassMethods
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
contrast-agent-6.4.0 lib/contrast/components/heap_dump.rb
contrast-agent-6.3.0 lib/contrast/components/heap_dump.rb
contrast-agent-6.2.0 lib/contrast/components/heap_dump.rb
contrast-agent-6.1.2 lib/contrast/components/heap_dump.rb
contrast-agent-6.1.1 lib/contrast/components/heap_dump.rb
contrast-agent-6.1.0 lib/contrast/components/heap_dump.rb
contrast-agent-6.0.0 lib/contrast/components/heap_dump.rb
contrast-agent-5.3.0 lib/contrast/components/heap_dump.rb
contrast-agent-5.2.0 lib/contrast/components/heap_dump.rb
contrast-agent-5.1.0 lib/contrast/components/heap_dump.rb
contrast-agent-5.0.0 lib/contrast/components/heap_dump.rb