Module: Datadog::GRPCPropagator
- Includes:
- Ext::DistributedTracing
- Defined in:
- lib/ddtrace/propagation/grpc_propagator.rb
Overview
opentracing.io compliant methods for distributing trace context between two or more distributed services. Note this is very close to the HTTPPropagator; the key difference is the way gRPC handles header information (called "metadata") as it operates over HTTP2
Defined Under Namespace
Classes: Carrier
Constant Summary
Constants included from Ext::DistributedTracing
Ext::DistributedTracing::B3_HEADER_SAMPLED, Ext::DistributedTracing::B3_HEADER_SINGLE, Ext::DistributedTracing::B3_HEADER_SPAN_ID, Ext::DistributedTracing::B3_HEADER_TRACE_ID, Ext::DistributedTracing::GRPC_METADATA_ORIGIN, Ext::DistributedTracing::GRPC_METADATA_PARENT_ID, Ext::DistributedTracing::GRPC_METADATA_SAMPLING_PRIORITY, Ext::DistributedTracing::GRPC_METADATA_TRACE_ID, Ext::DistributedTracing::HTTP_HEADER_ORIGIN, Ext::DistributedTracing::HTTP_HEADER_PARENT_ID, Ext::DistributedTracing::HTTP_HEADER_SAMPLING_PRIORITY, Ext::DistributedTracing::HTTP_HEADER_TRACE_ID, Ext::DistributedTracing::ORIGIN_KEY, Ext::DistributedTracing::PROPAGATION_EXTRACT_STYLE_ENV_OLD, Ext::DistributedTracing::PROPAGATION_INJECT_STYLE_ENV_OLD, Ext::DistributedTracing::PROPAGATION_STYLE_B3, Ext::DistributedTracing::PROPAGATION_STYLE_B3_SINGLE_HEADER, Ext::DistributedTracing::PROPAGATION_STYLE_DATADOG, Ext::DistributedTracing::PROPAGATION_STYLE_EXTRACT_ENV, Ext::DistributedTracing::PROPAGATION_STYLE_INJECT_ENV, Ext::DistributedTracing::SAMPLING_PRIORITY_KEY
Class Method Summary collapse
Class Method Details
.extract(metadata) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 20 def self.extract() = Carrier.new() return Datadog::Context.new unless .valid? Datadog::Context.new(trace_id: .trace_id, span_id: .parent_id, sampling_priority: .sampling_priority, origin: .origin) end |
.inject!(context, metadata) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 13 def self.inject!(context, ) [GRPC_METADATA_TRACE_ID] = context.trace_id.to_s [GRPC_METADATA_PARENT_ID] = context.span_id.to_s [GRPC_METADATA_SAMPLING_PRIORITY] = context.sampling_priority.to_s if context.sampling_priority [GRPC_METADATA_ORIGIN] = context.origin.to_s if context.origin end |