Sha256: 404440181fa140b1794f067a211f7bcd2f7d35edec2ff47a61b387ef78a765ed

Contents?: true

Size: 692 Bytes

Versions: 8

Compression:

Stored size: 692 Bytes

Contents

module Sneakers
  module Metrics
    class NewrelicMetrics

      def self.eagent(eagent = nil)
        @eagent = eagent || @eagent
      end

      def initialize()
        #@connection = conn
      end

      def increment(metric)
        record_stat metric, 1
      end

      def record_stat(metric, num)
        metric_name = "Custom/#{metric.gsub("\.", "\/")}"
        NewrelicMetrics.eagent::Agent.record_metric(metric_name, num)
      rescue Exception => e
        puts "NewrelicMetrics#record_stat: #{e}"
      end

      def timing(metric, &block)
        start = Time.now
        block.call
        record_stat(metric, ((Time.now - start)*1000).floor)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
kicks-3.1.1 lib/sneakers/metrics/newrelic_metrics.rb
kicks-3.1.0 lib/sneakers/metrics/newrelic_metrics.rb
kicks-3.0.0 lib/sneakers/metrics/newrelic_metrics.rb
kicks-3.0.0.pre lib/sneakers/metrics/newrelic_metrics.rb
sneakers-2.12.0 lib/sneakers/metrics/newrelic_metrics.rb
sneakers-2.12.0.rc1 lib/sneakers/metrics/newrelic_metrics.rb
sneakers-2.11.0 lib/sneakers/metrics/newrelic_metrics.rb
sneakers-2.7.0 lib/sneakers/metrics/newrelic_metrics.rb