Class: Legion::Extensions::Node::Transport::Messages::Beat
- Inherits:
-
Transport::Message
- Object
- Transport::Message
- Legion::Extensions::Node::Transport::Messages::Beat
- Defined in:
- lib/legion/extensions/node/transport/messages/beat.rb
Constant Summary collapse
- BOOT_TIME =
::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
Instance Method Summary collapse
- #encrypt? ⇒ Boolean
- #expiration ⇒ Object
- #message ⇒ Object
- #routing_key ⇒ Object
- #type ⇒ Object
- #validate ⇒ Object
Instance Method Details
#encrypt? ⇒ Boolean
22 23 24 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 22 def encrypt? false end |
#expiration ⇒ Object
18 19 20 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 18 def expiration 5000 end |
#message ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 26 def hash = { name: Legion::Settings[:client][:name], pid: ::Process.pid, timestamp: Time.now, status: @options[:status].nil? ? 'healthy' : @options[:status] } hash[:version] = Legion::VERSION if defined?(Legion::VERSION) hash[:metrics] = collect_metrics hash[:hosted_worker_ids] = collect_worker_ids hash[:rabbitmq_cluster] = collect_rabbitmq_cluster hash end |
#routing_key ⇒ Object
10 11 12 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 10 def routing_key 'status' end |
#type ⇒ Object
14 15 16 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 14 def type 'heartbeat' end |
#validate ⇒ Object
40 41 42 43 44 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 40 def validate raise 'status should be a string' unless @options[:status].is_a?(String) || @options[:status].nil? @valid = true end |