module GRPC::ActiveCallWithTrace
Stackdriver Trace instrumentation of GRPC
by patching GRPC::ActiveCall class. Intercept each GRPC
request and create a Trace span with basic request information.
Constants
- SPAN_NAME
Public Instance Methods
request_response(*args, **kwargs)
click to toggle source
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.
Calls superclass method
# File lib/google/cloud/trace/patches/active_call_with_trace.rb, line 30 def request_response *args, **kwargs 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