module Protobuf::Opentracing::Extensions::Client

Public Instance Methods

operation_name() click to toggle source
# File lib/protobuf/rpc/extensions/client.rb, line 17
def operation_name
  @operation_name ||= "RPC #{options[:service]}##{options[:method]}"
end
send_request() click to toggle source
Calls superclass method
# File lib/protobuf/rpc/extensions/client.rb, line 5
def send_request
  scope, span = start_span
  options[:tracing_span] = span
  super
ensure
  if scope
    scope.close
  else
    span.finish
  end
end
start_span() click to toggle source
# File lib/protobuf/rpc/extensions/client.rb, line 21
def start_span
  tags = {
    "span.kind" => "client",
    "component" => "Protobuf",
  }
  if ::OpenTracing.active_span
    [nil, ::OpenTracing.start_span(operation_name, :tags => tags)]
  else
    scope = ::OpenTracing.start_active_span(operation_name, :tags => tags)
    [scope, scope.span]
  end
end