class Grpcx::Server::Interceptors::Instrumentation

Constants

METRIC_NAME

Public Instance Methods

bidi_streamer(opts = {}, &block) click to toggle source
# File lib/grpcx/server/interceptors/instrumentation.rb, line 21
def bidi_streamer(opts = {}, &block)
  instrument(opts[:method], &block)
end
client_streamer(opts = {}, &block) click to toggle source
# File lib/grpcx/server/interceptors/instrumentation.rb, line 13
def client_streamer(opts = {}, &block)
  instrument(opts[:method], &block)
end
request_response(opts = {}, &block) click to toggle source
# File lib/grpcx/server/interceptors/instrumentation.rb, line 9
def request_response(opts = {}, &block)
  instrument(opts[:method], &block)
end
server_streamer(opts = {}, &block) click to toggle source
# File lib/grpcx/server/interceptors/instrumentation.rb, line 17
def server_streamer(opts = {}, &block)
  instrument(opts[:method], &block)
end

Private Instance Methods

instrument(method, &block) click to toggle source
# File lib/grpcx/server/interceptors/instrumentation.rb, line 27
def instrument(method, &block)
  service = method.owner.service_name # method is just a standard ruby Method class, so `owner` is a service impl
  action = method.name # does not match real proto service name; it's a GRPC::GenericService.underscore-d version
  ActiveSupport::Notifications.instrument(METRIC_NAME, service: service, action: action, &block)
end