Class: Gruf::Interceptors::Instrumentation::Statsd
- Inherits:
-
ServerInterceptor
- Object
- Base
- ServerInterceptor
- Gruf::Interceptors::Instrumentation::Statsd
- Defined in:
- lib/gruf/interceptors/instrumentation/statsd.rb
Overview
Adds increment and timing stats to gRPC routes, pushing data to StatsD
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call(&block) ⇒ Object
Push data to StatsD, only doing so if a client is set.
Methods included from Errors::Helpers
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gruf::Interceptors::Base
Instance Method Details
#call(&block) ⇒ Object
Push data to StatsD, only doing so if a client is set
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gruf/interceptors/instrumentation/statsd.rb', line 28 def call(&block) unless client Gruf.logger.error 'Statsd module loaded, but no client configured!' return yield end client.increment(route_key) result = Gruf::Interceptors::Timer.time(&block) client.increment("#{route_key}.#{postfix(result.successful?)}") client.timing(route_key, result.elapsed) raise result. unless result.successful? result. end |