Module: GRPC::ActiveCallWithTrace
- Defined in:
 - lib/google/cloud/trace/patches/active_call_with_trace.rb
 
Overview
Stackdriver Trace instrumentation of GRPC by patching GRPC::ActiveCall class. Intercept each GRPC request and create a Trace span with basic request information.
Constant Summary collapse
- SPAN_NAME =
 "gRPC request".freeze
Instance Method Summary collapse
- 
  
    
      #request_response(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Override GRPC::ActiveCall#request_response method.
 
Instance Method Details
#request_response(*args) ⇒ Object
Override GRPC::ActiveCall#request_response method. Wrap the original method with a trace span that will get submitted with the overall request trace span tree.
      30 31 32 33 34 35 36 37 38 39 40  | 
    
      # File 'lib/google/cloud/trace/patches/active_call_with_trace.rb', line 30 def request_response *args Google::Cloud::Trace.in_span SPAN_NAME do |span| if span && !args.empty? grpc_request = args[0] label_key = Google::Cloud::Trace::LabelKey::RPC_REQUEST_TYPE span.labels[label_key] = grpc_request.class.name.gsub(/^.*::/, "") end super end end  |