Class: Datadog::GRPCPropagator::Carrier
Overview
opentracing.io compliant carrier object
Constant Summary
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, Ext::DistributedTracing::PROPAGATION_INJECT_STYLE_ENV, Ext::DistributedTracing::PROPAGATION_STYLE_B3, Ext::DistributedTracing::PROPAGATION_STYLE_B3_SINGLE_HEADER, Ext::DistributedTracing::PROPAGATION_STYLE_DATADOG, Ext::DistributedTracing::SAMPLING_PRIORITY_KEY
Instance Method Summary
collapse
Constructor Details
#initialize(metadata = {}) ⇒ Carrier
Returns a new instance of Carrier.
32
33
34
|
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 32
def initialize(metadata = {})
@metadata = metadata || {}
end
|
Instance Method Details
#origin ⇒ Object
55
56
57
58
|
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 55
def origin
value = @metadata[GRPC_METADATA_ORIGIN]
value if value != ''
end
|
#parent_id ⇒ Object
45
46
47
48
|
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 45
def parent_id
value = @metadata[GRPC_METADATA_PARENT_ID].to_i
value if (1..Span::MAX_ID).cover? value
end
|
#sampling_priority ⇒ Object
50
51
52
53
|
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 50
def sampling_priority
value = @metadata[GRPC_METADATA_SAMPLING_PRIORITY]
value && value.to_i
end
|
#trace_id ⇒ Object
40
41
42
43
|
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 40
def trace_id
value = @metadata[GRPC_METADATA_TRACE_ID].to_i
value if (1..Span::MAX_ID).cover? value
end
|
#valid? ⇒ Boolean
36
37
38
|
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 36
def valid?
trace_id && parent_id
end
|