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

Inherits:
Base
  • Object
show all
Defined in:
lib/ddtrace/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 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



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb', line 17

def trace(keywords)
  options = {
    span_type: Datadog::Ext::HTTP::TYPE_INBOUND,
    service: service_name,
    resource: format_resource(keywords[:method]),
    on_error: error_handler
  }
   = keywords[:call].

  set_distributed_context!(tracer, )

  tracer.trace(Ext::SPAN_SERVICE, options) do |span|
    annotate!(span, )

    yield
  end
end