Class: Datadog::Contrib::GRPC::DatadogInterceptor::Client

Inherits:
Base
  • Object
show all
Defined in:
lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb

Overview

The DatadogInterceptor::Client implements the tracing strategy for gRPC client-side endpoitns. This middleware compoent will inject trace context information into gRPC metadata prior to sending the request to the server.

Instance Attribute Summary

Attributes inherited from Base

#datadog_pin

Instance Method Summary collapse

Methods inherited from Base

#bidi_streamer, #client_streamer, #initialize, #request_response, #server_streamer

Constructor Details

This class inherits a constructor from Datadog::Contrib::GRPC::DatadogInterceptor::Base

Instance Method Details

#trace(keywords) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb', line 14

def trace(keywords)
  keywords[:metadata] ||= {}

  options = {
    span_type: Datadog::Ext::HTTP::TYPE_OUTBOUND,
    service: service_name,
    resource: format_resource(keywords[:method])
  }

  tracer.trace(Ext::SPAN_CLIENT, options) do |span|
    annotate!(span, keywords[:metadata])

    yield
  end
end