Class: Datadog::OpenTracer::DistributedHeaders
- Inherits:
-
Object
- Object
- Datadog::OpenTracer::DistributedHeaders
show all
- Includes:
- Ext::DistributedTracing
- Defined in:
- lib/ddtrace/opentracer/distributed_headers.rb
Overview
DistributedHeaders provides easy access and validation to headers
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_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
Returns a new instance of DistributedHeaders.
11
12
13
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 11
def initialize(carrier)
@carrier = carrier
end
|
Instance Method Details
#origin ⇒ Object
40
41
42
43
44
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 40
def origin
hdr = @carrier[HTTP_HEADER_ORIGIN]
hdr if hdr != ''
end
|
#parent_id ⇒ Object
24
25
26
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 24
def parent_id
id HTTP_HEADER_PARENT_ID
end
|
#sampling_priority ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 28
def sampling_priority
hdr = @carrier[HTTP_HEADER_SAMPLING_PRIORITY]
return unless hdr
value = hdr.to_i
return if value < 0
value
end
|
#trace_id ⇒ Object
20
21
22
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 20
def trace_id
id HTTP_HEADER_TRACE_ID
end
|
#valid? ⇒ Boolean
15
16
17
18
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 15
def valid?
!trace_id.nil? && !parent_id.nil?
end
|