Class: Datadog::GRPCPropagator::Carrier

Inherits:
Object
  • Object
show all
Includes:
Ext::DistributedTracing
Defined in:
lib/ddtrace/propagation/grpc_propagator.rb

Overview

opentracing.io compliant carrier object

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

Instance Method Summary collapse

Constructor Details

#initialize(metadata = {}) ⇒ Carrier

Returns a new instance of Carrier.



34
35
36
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 34

def initialize( = {})
  @metadata =  || {}
end

Instance Method Details

#originObject



57
58
59
60
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 57

def origin
  value = (GRPC_METADATA_ORIGIN)
  value if value != ''
end

#parent_idObject



47
48
49
50
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 47

def parent_id
  value = (GRPC_METADATA_PARENT_ID).to_i
  value if (1..Span::EXTERNAL_MAX_ID).cover? value
end

#sampling_priorityObject



52
53
54
55
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 52

def sampling_priority
  value = (GRPC_METADATA_SAMPLING_PRIORITY)
  value && value.to_i
end

#trace_idObject



42
43
44
45
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 42

def trace_id
  value = (GRPC_METADATA_TRACE_ID).to_i
  value if (1..Span::EXTERNAL_MAX_ID).cover? value
end

#valid?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/ddtrace/propagation/grpc_propagator.rb', line 38

def valid?
  trace_id && parent_id
end