lib/grpc_opencensus_interceptor/client_interceptor.rb
##
# Intercept a unary request response call
#
# @param [Object] request
# @param [GRPC::ActiveCall] call
# @param [String] method
# @param [Hash] metadata
#
Intercept a unary request response call
Intercept a unary request response call
def request_response(request:, call:, method:, metadata:)
      span_context = @span_context
      if span_context == OpenCensus::Trace && !span_context.span_context
        return yield
      end
      span_name = method
      span = span_context.start_span span_name, sampler: @sampler
      start_request span, method, metadata
      begin
        grpc_ex = GRPC::Ok.new
        yield
      rescue StandardError => e
        grpc_ex = Util.to_grpc_ex(e)
        raise e
      ensure
        finish_request span, grpc_ex
        span_context.end_span span
      end
    end
def request_response ( request : , call : , method : , metadata : ) span_context = @span_context if span_context == OpenCensus :: Trace && ! span_context . span_context return yield end span_name = method span = span_context . start_span span_name , sampler : @sampler start_request span , method , metadata begin grpc_ex = GRPC :: Ok . new yield rescue StandardError => e grpc_ex = Util . to_grpc_ex ( e ) raise e ensure finish_request span , grpc_ex span_context . end_span span end end
Intercept a unary request response call
Intercept a unary request response call
# NOTE: Use method as span name
request
call
method
metadata
None