Class: Datadog::Tracing::Contrib::GRPC::DatadogInterceptor::Server

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

Overview

The DatadogInterceptor::Server implements the tracing strategy for gRPC server-side endpoints. When the datadog fields have been added to the gRPC call metadata, this middleware component will extract any client-side tracing information, attempting to associate its tracing context with a parent client-side context

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb', line 19

def trace(keywords)
  method = keywords[:method]
  options = {
    span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
    service: service_name, # TODO: Remove server-side service name configuration
    resource: format_resource(method),
    on_error: error_handler
  }
   = keywords[:call].

  set_distributed_context!()

  Tracing.trace(Ext::SPAN_SERVICE, **options) do |span|
    span.set_tag(Contrib::Ext::RPC::TAG_SYSTEM, Ext::TAG_SYSTEM)
    span.set_tag(Contrib::Ext::RPC::TAG_SERVICE, method.owner.to_s)
    span.set_tag(Contrib::Ext::RPC::TAG_METHOD,  method.name)

    annotate!(span, )

    yield
  end
end