Class: Trace::Span

Inherits:
Object
  • Object
show all
Defined in:
lib/finagle-thrift/tracer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, span_id) ⇒ Span

Returns a new instance of Span.



125
126
127
128
129
130
131
# File 'lib/finagle-thrift/tracer.rb', line 125

def initialize(name, span_id)
  @name = name
  @span_id = span_id
  @annotations = []
  @binary_annotations = []
  @debug = span_id.debug?
end

Instance Attribute Details

#annotationsObject

Returns the value of attribute annotations.



124
125
126
# File 'lib/finagle-thrift/tracer.rb', line 124

def annotations
  @annotations
end

#binary_annotationsObject

Returns the value of attribute binary_annotations.



124
125
126
# File 'lib/finagle-thrift/tracer.rb', line 124

def binary_annotations
  @binary_annotations
end

#debugObject

Returns the value of attribute debug.



124
125
126
# File 'lib/finagle-thrift/tracer.rb', line 124

def debug
  @debug
end

#nameObject

Returns the value of attribute name.



124
125
126
# File 'lib/finagle-thrift/tracer.rb', line 124

def name
  @name
end

Instance Method Details

#to_thriftObject



133
134
135
136
137
138
139
140
141
142
143
# File 'lib/finagle-thrift/tracer.rb', line 133

def to_thrift
  FinagleThrift::Span.new(
    :name => @name,
    :trace_id => @span_id.trace_id.to_i,
    :id => @span_id.span_id.to_i,
    :parent_id => @span_id.parent_id.nil? ? nil : @span_id.parent_id.to_i,
    :annotations => @annotations.map { |a| a.to_thrift },
    :binary_annotations => @binary_annotations.map { |a| a.to_thrift },
    :debug => @debug
  )
end