Class: Gruf::Interceptors::Instrumentation::OutputMetadataTimer
- Inherits:
-
ServerInterceptor
- Object
- Base
- ServerInterceptor
- Gruf::Interceptors::Instrumentation::OutputMetadataTimer
- Defined in:
- lib/gruf/interceptors/instrumentation/output_metadata_timer.rb
Overview
Appends the timer metadata to the active call output metadata
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call(&block) ⇒ Object
Handle the instrumented response.
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
Handle the instrumented response. Note: this will only instrument timings of successful responses.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gruf/interceptors/instrumentation/output_metadata_timer.rb', line 30 def call(&block) return unless active_call.respond_to?(:output_metadata) result = Gruf::Interceptors::Timer.time(&block) .update( => result.elapsed.to_s) raise result. unless result.successful? result. end |