Class: Skywalking::Tracing::Segment

Inherits:
Object
  • Object
show all
Defined in:
lib/skywalking/tracing/segment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSegment

Returns a new instance of Segment.



23
24
25
26
27
28
# File 'lib/skywalking/tracing/segment.rb', line 23

def initialize
  @segment_id = Utils::IDGen.new
  @spans = []
  @timestamp = (Process.clock_gettime(Process::CLOCK_REALTIME) * 1000).to_i
  @related_traces = [Utils::IDGen.new]
end

Instance Attribute Details

Returns the value of attribute related_traces.



21
22
23
# File 'lib/skywalking/tracing/segment.rb', line 21

def related_traces
  @related_traces
end

#segment_idObject

Returns the value of attribute segment_id.



21
22
23
# File 'lib/skywalking/tracing/segment.rb', line 21

def segment_id
  @segment_id
end

#spansObject

Returns the value of attribute spans.



21
22
23
# File 'lib/skywalking/tracing/segment.rb', line 21

def spans
  @spans
end

#timestampObject

Returns the value of attribute timestamp.



21
22
23
# File 'lib/skywalking/tracing/segment.rb', line 21

def timestamp
  @timestamp
end

Instance Method Details

#archive(span) ⇒ Object



30
31
32
# File 'lib/skywalking/tracing/segment.rb', line 30

def archive(span)
  @spans << span
end

#relate(trace_id) ⇒ Object



34
35
36
37
# File 'lib/skywalking/tracing/segment.rb', line 34

def relate(trace_id)
  @related_traces.pop if @related_traces[0].is_a?(Utils::IDGen)
  @related_traces << trace_id
end