Class: Atatus::OpenTracing::SpanContext Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/atatus/opentracing.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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_context:, baggage: nil) ⇒ SpanContext

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 SpanContext.



115
116
117
118
119
120
121
122
123
# File 'lib/atatus/opentracing.rb', line 115

def initialize(trace_context:, baggage: nil)
  if baggage
    Atatus.agent.config.logger.warn(
      'Baggage is not supported by Atatus'
    )
  end

  @trace_context = trace_context
end

Instance Attribute Details

#trace_contextObject

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.



125
126
127
# File 'lib/atatus/opentracing.rb', line 125

def trace_context
  @trace_context
end

Class Method Details

.from_header(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.



128
129
130
131
132
133
134
135
136
137
138
# File 'lib/atatus/opentracing.rb', line 128

def self.from_header(header)
  return unless header

  trace_context = Atatus::TraceContext.parse(header)
  return unless trace_context

  trace_context.traceparent.id = trace_context.parent_id
  trace_context.traceparent.parent_id = nil

  from_trace_context(trace_context)
end

.from_trace_context(trace_context) ⇒ 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.



140
141
142
# File 'lib/atatus/opentracing.rb', line 140

def self.from_trace_context(trace_context)
  new(trace_context: trace_context)
end

Instance Method Details

#childObject

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.



144
145
146
# File 'lib/atatus/opentracing.rb', line 144

def child
  self.class.from_trace_context(trace_context.child)
end