Sha256: 7f06dd073f89a6ae93503500febc18d1e9fe4ab6cd1452ffed7cf4667c4ea705

Contents?: true

Size: 501 Bytes

Versions: 4

Compression:

Stored size: 501 Bytes

Contents

module NewrelicSidekiqMetrics
  class Recorder
    attr_reader :stats, :metrics

    def initialize
      @stats = Sidekiq::Stats.new
      @metrics = NewrelicSidekiqMetrics.used_metrics
    end

    def call
      metrics.each { |m| record_metric(m) }
    end

    private

    def record_metric(name)
      NewRelic::Agent.record_metric(metric_full_name(name), stats.public_send(name))
    end

    def metric_full_name(name)
      File.join(METRIC_PREFIX, METRIC_MAP.fetch(name))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic-sidekiq-metrics-1.0.0 lib/newrelic_sidekiq_metrics/recorder.rb
newrelic-sidekiq-metrics-0.2.2 lib/newrelic_sidekiq_metrics/recorder.rb
newrelic-sidekiq-metrics-0.2.1 lib/newrelic_sidekiq_metrics/recorder.rb
newrelic-sidekiq-metrics-0.2.0 lib/newrelic_sidekiq_metrics/recorder.rb