Class: Atatus::TraceContext Private
- Inherits:
-
Object
- Object
- Atatus::TraceContext
- Extended by:
- Forwardable
- Defined in:
- lib/atatus/trace_context.rb,
lib/atatus/trace_context/tracestate.rb,
lib/atatus/trace_context/traceparent.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: InvalidTraceparentHeader, Traceparent, Tracestate
Instance Attribute Summary collapse
- #traceparent ⇒ Object private
- #tracestate ⇒ Object private
Class Method Summary collapse
Instance Method Summary collapse
- #apply_headers {|'Traceparent', traceparent.to_header| ... } ⇒ Object private
- #child ⇒ Object private
-
#initialize(traceparent: nil, tracestate: nil) ⇒ TraceContext
constructor
private
A new instance of TraceContext.
Constructor Details
#initialize(traceparent: nil, tracestate: nil) ⇒ TraceContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TraceContext.
30 31 32 33 34 35 36 |
# File 'lib/atatus/trace_context.rb', line 30 def initialize( traceparent: nil, tracestate: nil ) @traceparent = traceparent || Traceparent.new @tracestate = tracestate || Tracestate.new end |
Instance Attribute Details
#traceparent ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/atatus/trace_context.rb', line 38 def traceparent @traceparent end |
#tracestate ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/atatus/trace_context.rb', line 38 def tracestate @tracestate end |
Class Method Details
.parse(env: nil, metadata: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/atatus/trace_context.rb', line 44 def parse(env: nil, metadata: nil) unless env || raise ArgumentError, 'TraceContext expects env:, metadata: ' \ 'or single argument header string' end if env trace_context_from_env(env) elsif () end end |
Instance Method Details
#apply_headers {|'Traceparent', traceparent.to_header| ... } ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/atatus/trace_context.rb', line 96 def apply_headers yield 'Traceparent', traceparent.to_header if tracestate && !tracestate.to_header.empty? yield 'Tracestate', tracestate.to_header end return unless Atatus.agent.config.use_atatus_traceparent_header yield 'Atatus-Traceparent', traceparent.to_header end |
#child ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
90 91 92 93 94 |
# File 'lib/atatus/trace_context.rb', line 90 def child dup.tap do |tc| tc.traceparent = tc.traceparent.child end end |