Class: Trace::Annotation

Inherits:
Object
  • Object
show all
Defined in:
lib/zipkin-tracer/trace.rb

Overview

These classes all come from Finagle-thrift + some needed modifications (.to_h) Moved here as a first step, eventually move them out of the Trace module

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Annotation

Returns a new instance of Annotation.



55
56
57
58
# File 'lib/zipkin-tracer/trace.rb', line 55

def initialize(value)
  @timestamp = (Time.now.to_f * 1000 * 1000).to_i # micros
  @value = value
end

Instance Attribute Details

#timestampObject (readonly)

Returns the value of attribute timestamp.



53
54
55
# File 'lib/zipkin-tracer/trace.rb', line 53

def timestamp
  @timestamp
end

#valueObject (readonly)

Returns the value of attribute value.



53
54
55
# File 'lib/zipkin-tracer/trace.rb', line 53

def value
  @value
end

Instance Method Details

#to_hObject



60
61
62
63
64
65
# File 'lib/zipkin-tracer/trace.rb', line 60

def to_h
  {
    value: @value,
    timestamp: @timestamp
  }
end