Class: Gruf::Instrumentation::Statsd

Inherits:
Base
  • Object
show all
Defined in:
lib/gruf/instrumentation/statsd.rb

Overview

Adds increment and timing stats to gRPC routes, pushing data to StatsD

Instance Attribute Summary

Attributes inherited from Base

#service

Instance Method Summary collapse

Methods inherited from Base

#initialize, #method_key, #outer_around, #service_key, #setup, #success?

Methods included from Loggable

#logger

Constructor Details

This class inherits a constructor from Gruf::Instrumentation::Base

Instance Method Details

#call(rc) ⇒ Object

Push data to StatsD, only doing so if a client is set

Parameters:



28
29
30
31
32
33
34
35
36
37
# File 'lib/gruf/instrumentation/statsd.rb', line 28

def call(rc)
  if client
    rk = route_key(rc.call_signature)
    client.increment(rk)
    client.increment("#{rk}.#{postfix(rc.success?)}")
    client.timing(rk, rc.execution_time)
  else
    Gruf.logger.error 'Statsd module loaded, but no client configured!'
  end
end