Class: Instana::SpanContext

Inherits:
Object
  • Object
show all
Defined in:
lib/instana/tracing/span_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tid, sid, level = 1, baggage = {}) ⇒ SpanContext

Create a new SpanContext

Parameters:

  • tid (Integer)

    the trace ID

  • sid (Integer)

    the span ID

  • level (Integer) (defaults to: 1)

    default 1

  • baggage (Hash) (defaults to: {})

    baggage applied to this trace



14
15
16
17
18
19
# File 'lib/instana/tracing/span_context.rb', line 14

def initialize(tid, sid, level = 1, baggage = {})
  @trace_id = tid
  @span_id = sid
  @level = level
  @baggage = baggage
end

Instance Attribute Details

#baggageObject

Returns the value of attribute baggage.



5
6
7
# File 'lib/instana/tracing/span_context.rb', line 5

def baggage
  @baggage
end

#span_idObject

Returns the value of attribute span_id.



4
5
6
# File 'lib/instana/tracing/span_context.rb', line 4

def span_id
  @span_id
end

#trace_idObject

Returns the value of attribute trace_id.



3
4
5
# File 'lib/instana/tracing/span_context.rb', line 3

def trace_id
  @trace_id
end

Instance Method Details

#span_id_headerObject



25
26
27
# File 'lib/instana/tracing/span_context.rb', line 25

def span_id_header
  ::Instana::Util.id_to_header(@span_id)
end

#to_hashObject



29
30
31
# File 'lib/instana/tracing/span_context.rb', line 29

def to_hash
  { :trace_id => @trace_id, :span_id => @span_id }
end

#trace_id_headerObject



21
22
23
# File 'lib/instana/tracing/span_context.rb', line 21

def trace_id_header
  ::Instana::Util.id_to_header(@trace_id)
end