Class: Gruf::Prometheus::Server::Interceptor

Inherits:
Interceptors::ServerInterceptor
  • Object
show all
Defined in:
lib/gruf/prometheus/server/interceptor.rb

Overview

Server interceptor for measuring counter/timers for gRPC inbound requests

Instance Method Summary collapse

Instance Method Details

#call(&block) ⇒ Object

Intercept the call and send metrics



28
29
30
31
32
33
34
35
36
# File 'lib/gruf/prometheus/server/interceptor.rb', line 28

def call(&block)
  result = ::Gruf::Interceptors::Timer.time(&block)

  send_metrics(result)

  raise result.message unless result.successful?

  result.message
end