Class: LogBrew::DeliveryHealth

Inherits:
Object
  • Object
show all
Defined in:
lib/logbrew/automatic_delivery.rb

Constant Summary collapse

FIELDS =
%i[
  state queued_events queued_bytes dropped_events in_flight last_outcome
  consecutive_failures pause_reason successful_flushes failed_flushes retry_delay_ms
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**values) ⇒ DeliveryHealth

Returns a new instance of DeliveryHealth.



12
13
14
15
# File 'lib/logbrew/automatic_delivery.rb', line 12

def initialize(**values)
  FIELDS.each { |field| instance_variable_set("@#{field}", values.fetch(field)) }
  freeze
end

Instance Method Details

#to_hObject



17
18
19
20
21
# File 'lib/logbrew/automatic_delivery.rb', line 17

def to_h
  FIELDS.each_with_object({}) do |field, result|
    result[field.to_s] = public_send(field)
  end
end