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

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

Overview

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

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::Tracing::Contrib::GRPC::DatadogInterceptor::Base

Instance Method Details

#trace(keywords) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb', line 18

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

  options = {
    span_type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
    service: service_name, # Maintain client-side service name configuration
    resource: format_resource(keywords[:method])
  }

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

    yield
  end
end