class Hawkei::Message
Hawkei
Message¶ ↑
Return the base message for an event
Public Class Methods
base()
click to toggle source
# File lib/hawkei/message.rb, line 9 def base Util.deep_compact( message_id: SecureRandom.uuid, timestamp: Time.now.utc.iso8601(3), session_tracker_id: session_tracker_id, auto_id: Hawkei::Store.get(:auto_id), ) end
extended()
click to toggle source
# File lib/hawkei/message.rb, line 18 def extended Util.deep_compact( library: library, server: server, request: Hawkei::Store.get(:request), worker: Hawkei::Store.get(:worker), environment: Hawkei::Store.get(:environment) || Hawkei.configurations.environment_name, metadata: metadata ).merge(base) end
Private Class Methods
library()
click to toggle source
# File lib/hawkei/message.rb, line 37 def library { name: Hawkei::LIBRARY_NAME, language: 'ruby', version: Hawkei::VERSION, } end
metadata()
click to toggle source
# File lib/hawkei/message.rb, line 61 def metadata return nil if Hawkei.configurations.metadata.nil? Hawkei.configurations.metadata.each_with_object({}) do |(key, value), hash| if value.is_a?(Proc) begin hash[key] = value.call rescue StandardError => _e nil end next end hash[key] = value end end
program_name()
click to toggle source
# File lib/hawkei/message.rb, line 53 def program_name name = $PROGRAM_NAME name.split('/').last rescue StandardError => _e name end
server()
click to toggle source
# File lib/hawkei/message.rb, line 45 def server { host: Socket.gethostname, pid: Process.pid, software: Hawkei::Store.get(:server_software) || program_name, } end
session_tracker_id()
click to toggle source
# File lib/hawkei/message.rb, line 31 def session_tracker_id return Hawkei::Store.get(:session_tracker_id) if Hawkei::Store.exist?(:session_tracker_id) Hawkei::Store.set(:session_tracker_id, SecureRandom.uuid) end