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 ⇒ 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 ⇒ Object
Push data to StatsD, only doing so if a client is set
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gruf/interceptors/instrumentation/statsd.rb', line 26 def call unless client Gruf.logger.error 'Statsd module loaded, but no client configured!' return yield end client.increment(route_key) result = Gruf::Interceptors::Timer.time do yield end client.increment("#{route_key}.#{postfix(result.successful?)}") client.timing(route_key, result.elapsed) raise result. unless result.successful? result. end |