Sha256: dbf9931a9003ea4b849a8df4dfc5bd8812f1fffcc33da55a5cca707b66aa2ff2

Contents?: true

Size: 812 Bytes

Versions: 12

Compression:

Stored size: 812 Bytes

Contents

module Honeybadger
  class RegistryExecution
    def initialize(registry, config, options)
      @registry = registry
      @config = config
      @options = options
      @interval = config[:'insights.registry_flush_interval'] || options.fetch(:interval, 60)
      @end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) + @interval
    end

    def tick
      @end_time - ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
    end

    def reset
      @end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) + @interval
      @registry.flush
    end

    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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
honeybadger-5.26.2 lib/honeybadger/registry_execution.rb
honeybadger-5.26.1 lib/honeybadger/registry_execution.rb
honeybadger-5.26.0 lib/honeybadger/registry_execution.rb
honeybadger-5.25.0 lib/honeybadger/registry_execution.rb
honeybadger-5.24.0 lib/honeybadger/registry_execution.rb
honeybadger-5.23.0 lib/honeybadger/registry_execution.rb
honeybadger-5.22.0 lib/honeybadger/registry_execution.rb
honeybadger-5.21.0 lib/honeybadger/registry_execution.rb
honeybadger-5.20.1 lib/honeybadger/registry_execution.rb
honeybadger-5.20.0 lib/honeybadger/registry_execution.rb
honeybadger-5.19.2 lib/honeybadger/registry_execution.rb
honeybadger-5.19.1 lib/honeybadger/registry_execution.rb