Sha256: bc2d41b406c3f0d701ba50b134ef7e826645ad653542db19792a1660b67af5bf

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

module SemanticLogger
  module Metrics
    class NewRelic
      def call(log)
        metric = log.metric
        # Add 'Custom/' prefix for NewRelic
        metric = "Custom/#{metric}" unless metric.start_with?('Custom')

        if duration = log.duration
          # Convert duration to seconds
          ::NewRelic::Agent.record_metric(metric, duration / 1000.0)
        else
          ::NewRelic::Agent.increment_metric(metric, log.metric_amount || 1)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
semantic_logger-3.1.0 lib/semantic_logger/metrics/new_relic.rb