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, 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
Returns a new instance of DistributedHeaders.
10
11
12
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 10
def initialize(carrier)
@carrier = carrier
end
|
Instance Method Details
#origin ⇒ Object
37
38
39
40
41
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 37
def origin
hdr = @carrier[HTTP_HEADER_ORIGIN]
hdr if hdr != ''
end
|
#parent_id ⇒ Object
23
24
25
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 23
def parent_id
id HTTP_HEADER_PARENT_ID
end
|
#sampling_priority ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 27
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
19
20
21
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 19
def trace_id
id HTTP_HEADER_TRACE_ID
end
|
#valid? ⇒ Boolean
14
15
16
17
|
# File 'lib/ddtrace/opentracer/distributed_headers.rb', line 14
def valid?
!trace_id.nil? && !parent_id.nil?
end
|