Sha256: 0e9f86827557fefbcfa6ad67a25de21696f5aed1845e53ac6b2fea5654a26e1f

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

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

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
        include Contrast::Components::Interface

        access_component :config

        def heap_dump_enabled?
          heap_dump_control[:enabled]
        end

        def heap_dump_control
          @_heap_dump_control ||= begin
            config = 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
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contrast-agent-4.4.1 lib/contrast/components/heap_dump.rb
contrast-agent-4.4.0 lib/contrast/components/heap_dump.rb
contrast-agent-4.3.2 lib/contrast/components/heap_dump.rb
contrast-agent-4.3.1 lib/contrast/components/heap_dump.rb
contrast-agent-4.3.0 lib/contrast/components/heap_dump.rb
contrast-agent-4.2.0 lib/contrast/components/heap_dump.rb
contrast-agent-4.1.0 lib/contrast/components/heap_dump.rb
contrast-agent-4.0.0 lib/contrast/components/heap_dump.rb
contrast-agent-3.16.0 lib/contrast/components/heap_dump.rb
contrast-agent-3.15.0 lib/contrast/components/heap_dump.rb
contrast-agent-3.14.0 lib/contrast/components/heap_dump.rb
contrast-agent-3.13.2 lib/contrast/components/heap_dump.rb
contrast-agent-3.13.1 lib/contrast/components/heap_dump.rb
contrast-agent-3.13.0 lib/contrast/components/heap_dump.rb
contrast-agent-3.12.2 lib/contrast/components/heap_dump.rb
contrast-agent-3.12.1 lib/contrast/components/heap_dump.rb
contrast-agent-3.12.0 lib/contrast/components/heap_dump.rb
contrast-agent-3.11.0 lib/contrast/components/heap_dump.rb