Sha256: 9ea97a0f95ba978a93c3787cbf0e0ac88a5c2a597b1ea59897b19b61a3898017

Contents?: true

Size: 1 KB

Versions: 152

Compression:

Stored size: 1 KB

Contents

module CC
  module Analyzer
    class StatsdContainerListener < ContainerListener
      def initialize(engine_name, statsd)
        @engine_name = engine_name
        @statsd = statsd
      end

      def started(_data)
        increment("started")
      end

      def timed_out(data)
        timing("time", data.duration)
        increment("result.error")
        increment("result.error.timeout")
      end

      def finished(data)
        timing("time", data.duration)
        increment("finished")

        if data.status.success?
          increment("result.success")
        else
          increment("result.error")
        end
      end

      private

      attr_reader :engine_name, :statsd

      def increment(metric)
        statsd.increment("engines.#{metric}")
        statsd.increment("engines.names.#{engine_name}.#{metric}")
      end

      def timing(metric, ms)
        statsd.timing("engines.#{metric}", ms)
        statsd.timing("engines.names.#{engine_name}.#{metric}", ms)
      end
    end
  end
end

Version data entries

152 entries across 152 versions & 1 rubygems

Version Path
codeclimate-0.59.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.58.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.57.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.56.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.55.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.54.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.53.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.52.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.51.3 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.51.2 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.51.1 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.51.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.50.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.49.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.48.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.47.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.46.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.45.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.44.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.43.1 lib/cc/analyzer/statsd_container_listener.rb