Class: Honeybadger::RegistryExecution
- Inherits:
-
Object
- Object
- Honeybadger::RegistryExecution
- Defined in:
- lib/honeybadger/registry_execution.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(registry, config, options) ⇒ RegistryExecution
constructor
A new instance of RegistryExecution.
- #reset ⇒ Object
- #tick ⇒ Object
Constructor Details
#initialize(registry, config, options) ⇒ RegistryExecution
Returns a new instance of RegistryExecution.
3 4 5 6 7 8 9 |
# File 'lib/honeybadger/registry_execution.rb', line 3 def initialize(registry, config, ) @registry = registry @config = config @options = @interval = config[:'insights.registry_flush_interval'] || .fetch(:interval, 60) @end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) + @interval end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/honeybadger/registry_execution.rb', line 20 def call @registry.metrics.each do |metric| next if metric.samples == 0 metric.event_payloads.each do |payload| Honeybadger.event(payload.merge(interval: @interval)) end end end |
#reset ⇒ Object
15 16 17 18 |
# File 'lib/honeybadger/registry_execution.rb', line 15 def reset @end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) + @interval @registry.flush end |
#tick ⇒ Object
11 12 13 |
# File 'lib/honeybadger/registry_execution.rb', line 11 def tick @end_time - ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) end |