lib/contrast/components/heap_dump.rb in contrast-agent-3.10.2 vs lib/contrast/components/heap_dump.rb in contrast-agent-3.11.0
- old
+ new
@@ -14,20 +14,24 @@
include Contrast::Components::Interface
access_component :config
def heap_dump_enabled?
- state.heap_dump_enabled?
+ heap_dump_control[:enabled]
end
def heap_dump_control
- {
- path: File.absolute_path(CONFIG.root.agent.heap_dump.path),
- count: CONFIG.root.agent.heap_dump.count.to_i,
- window: CONFIG.root.agent.heap_dump.window_ms.to_f / 1000,
- delay: CONFIG.root.agent.heap_dump.delay_ms.to_f / 1000,
- clean: true?(CONFIG.root.agent.heap_dump.clean)
- }
+ @_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