Class: Buildkite::Trace::Span

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/trace/span.rb

Overview

A value object to hold the data we will submit to datadog

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_id:, span_id:, parent_id:, name:, resource:, service:, type:, start:, duration:, metrics:, meta:) ⇒ Span

Returns a new instance of Span.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/buildkite/trace/span.rb', line 8

def initialize(trace_id:, span_id:, parent_id:, name:, resource:, service:, type:, start:, duration:, metrics:, meta:)
  @trace_id = trace_id
  @span_id = span_id
  @parent_id = parent_id
  @name = name
  @resource = resource
  @service = service
  @type = type
  @start = start
  @duration = duration
  @metrics = metrics
  @meta = meta
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



6
7
8
# File 'lib/buildkite/trace/span.rb', line 6

def duration
  @duration
end

#metaObject (readonly)

Returns the value of attribute meta.



6
7
8
# File 'lib/buildkite/trace/span.rb', line 6

def meta
  @meta
end

#metricsObject (readonly)

Returns the value of attribute metrics.



6
7
8
# File 'lib/buildkite/trace/span.rb', line 6

def metrics
  @metrics
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/buildkite/trace/span.rb', line 5

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



5
6
7
# File 'lib/buildkite/trace/span.rb', line 5

def parent_id
  @parent_id
end

#resourceObject (readonly)

Returns the value of attribute resource.



5
6
7
# File 'lib/buildkite/trace/span.rb', line 5

def resource
  @resource
end

#serviceObject (readonly)

Returns the value of attribute service.



6
7
8
# File 'lib/buildkite/trace/span.rb', line 6

def service
  @service
end

#span_idObject (readonly)

Returns the value of attribute span_id.



5
6
7
# File 'lib/buildkite/trace/span.rb', line 5

def span_id
  @span_id
end

#startObject (readonly)

Returns the value of attribute start.



6
7
8
# File 'lib/buildkite/trace/span.rb', line 6

def start
  @start
end

#trace_idObject (readonly)

Returns the value of attribute trace_id.



5
6
7
# File 'lib/buildkite/trace/span.rb', line 5

def trace_id
  @trace_id
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/buildkite/trace/span.rb', line 6

def type
  @type
end

Instance Method Details

#to_hashObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/buildkite/trace/span.rb', line 22

def to_hash
  {
    trace_id: trace_id,
    span_id: span_id,
    parent_id: parent_id,
    name: name,
    resource: resource,
    service: service,
    type: @type,
    start: start,
    duration: duration,
    metrics: metrics,
    meta: meta,
  }
end