Class: Buildkite::TestCollector::Tracer::Span

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/test_collector/tracer.rb

Defined Under Namespace

Classes: IncompleteSpan

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section, start_at, end_at, detail) ⇒ Span

Returns a new instance of Span.



30
31
32
33
34
35
36
# File 'lib/buildkite/test_collector/tracer.rb', line 30

def initialize(section, start_at, end_at, detail)
  @section = section
  @start_at = start_at
  @end_at = end_at
  @detail = detail
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



28
29
30
# File 'lib/buildkite/test_collector/tracer.rb', line 28

def children
  @children
end

#detailObject

Returns the value of attribute detail.



28
29
30
# File 'lib/buildkite/test_collector/tracer.rb', line 28

def detail
  @detail
end

#end_atObject

Returns the value of attribute end_at.



28
29
30
# File 'lib/buildkite/test_collector/tracer.rb', line 28

def end_at
  @end_at
end

#sectionObject

Returns the value of attribute section.



28
29
30
# File 'lib/buildkite/test_collector/tracer.rb', line 28

def section
  @section
end

#start_atObject

Returns the value of attribute start_at.



28
29
30
# File 'lib/buildkite/test_collector/tracer.rb', line 28

def start_at
  @start_at
end

Instance Method Details

#as_hashObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/buildkite/test_collector/tracer.rb', line 44

def as_hash
  {
    section: section,
    start_at: start_at,
    end_at: end_at,
    duration: duration,
    detail: detail,
    children: children.map(&:as_hash),
  }
end

#durationObject

Raises:



38
39
40
41
42
# File 'lib/buildkite/test_collector/tracer.rb', line 38

def duration
  raise IncompleteSpan if end_at.nil?

  end_at - start_at
end