Class: AceMQ::AMQP::Health::Report

Inherits:
Struct
  • Object
show all
Defined in:
lib/acemq/amqp/health.rb

Overview

What a check found.

parts is whatever the check can say about itself — how many consumers there are, how long the broker took to answer, what a nested check reported — and it is the half somebody reads when the status alone does not tell them what to do.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#checked_at ⇒ Object

Returns the value of attribute checked_at

Returns:

  • (Object) —

    the current value of checked_at



64
65
66
# File 'lib/acemq/amqp/health.rb', line 64

def checked_at
  @checked_at
end

#detail ⇒ Object

Returns the value of attribute detail

Returns:

  • (Object) —

    the current value of detail



64
65
66
# File 'lib/acemq/amqp/health.rb', line 64

def detail
  @detail
end

#parts ⇒ Object

Returns the value of attribute parts

Returns:

  • (Object) —

    the current value of parts



64
65
66
# File 'lib/acemq/amqp/health.rb', line 64

def parts
  @parts
end

#status ⇒ Object

Returns the value of attribute status

Returns:

  • (Object) —

    the current value of status



64
65
66
# File 'lib/acemq/amqp/health.rb', line 64

def status
  @status
end

Instance Method Details

#degraded? ⇒ Boolean

Returns:

  • (Boolean)


67
# File 'lib/acemq/amqp/health.rb', line 67

def degraded? = status == DEGRADED

#down? ⇒ Boolean

Returns:

  • (Boolean)


66
# File 'lib/acemq/amqp/health.rb', line 66

def down? = status == DOWN

#to_h ⇒ Object

The shape every AceMQ library renders at /acemq-health.



70
71
72
73
74
75
# File 'lib/acemq/amqp/health.rb', line 70

def to_h
  rendered = { "status" => status.to_s, "checked" => checked_at.utc.iso8601 }
  rendered["detail"] = detail unless detail.nil? || detail.empty?
  rendered["parts"] = parts.transform_values { |v| v.is_a?(Report) ? v.to_h : v }
  rendered
end

#to_s ⇒ Object



77
# File 'lib/acemq/amqp/health.rb', line 77

def to_s = detail.to_s.empty? ? status.to_s : "#{status}: #{detail}"

#up? ⇒ Boolean

Returns:

  • (Boolean)


65
# File 'lib/acemq/amqp/health.rb', line 65

def up? = status == UP