Sha256: b288630d6fea9b25d964a06867b8ff6c181eb59c082377836669532c27f70fdc
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true cs__scoped_require 'contrast/components/interface' module Contrast module Agent # This module adds an at_exit hook for us to send messages that may be lost at process exit module AtExitHook include Contrast::Components::Interface access_component :logging def self.exit_hook @_exit_hook ||= begin at_exit do on_exit end true end end # Actions to take when a process exits. Typically called from our # exit_hook, but exposed here for other process terminations, like those # in Kernel#exec def self.on_exit logger.debug('at_exit invoked, host application terminating', p_id: @pid, pp_id: @ppid, process_pid: Process.pid, process_pp_id: Process.ppid) context = Contrast::Agent::REQUEST_TRACKER.current Contrast::Utils::ServiceSenderUtil.send_event_immediately(context.activity) if context end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-3.12.2 | lib/contrast/agent/at_exit_hook.rb |
contrast-agent-3.12.1 | lib/contrast/agent/at_exit_hook.rb |
contrast-agent-3.12.0 | lib/contrast/agent/at_exit_hook.rb |