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.43.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.42.1 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.42.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.41.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.40.3 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.40.2 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.40.1 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.40.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.39.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.38.1 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.38.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.37.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.36.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.35.2 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.35.1 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.35.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.34.1 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.34.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.33.0 lib/cc/analyzer/statsd_container_listener.rb
codeclimate-0.32.1 lib/cc/analyzer/statsd_container_listener.rb