Class: Trace::Annotation
- Inherits:
-
Object
- Object
- Trace::Annotation
- Defined in:
- lib/finagle-thrift/tracer.rb
Constant Summary collapse
- CLIENT_SEND =
"cs"
- CLIENT_RECV =
"cr"
- SERVER_SEND =
"ss"
- SERVER_RECV =
"sr"
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, host) ⇒ Annotation
constructor
A new instance of Annotation.
- #to_s ⇒ Object
- #to_thrift ⇒ Object
Constructor Details
#initialize(value, host) ⇒ Annotation
Returns a new instance of Annotation.
151 152 153 154 155 |
# File 'lib/finagle-thrift/tracer.rb', line 151 def initialize(value, host) @timestamp = (Time.now.to_f * 1000 * 1000).to_i # micros @value = value @host = host end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
150 151 152 |
# File 'lib/finagle-thrift/tracer.rb', line 150 def host @host end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
150 151 152 |
# File 'lib/finagle-thrift/tracer.rb', line 150 def @timestamp end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
150 151 152 |
# File 'lib/finagle-thrift/tracer.rb', line 150 def value @value end |
Instance Method Details
#to_s ⇒ Object
166 167 168 |
# File 'lib/finagle-thrift/tracer.rb', line 166 def to_s "#{@value} at #{@timestamp} for (#{@host.to_s})" end |
#to_thrift ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/finagle-thrift/tracer.rb', line 157 def to_thrift thrift_host = host ? host.to_thrift : nil FinagleThrift::Annotation.new( :value => @value, :host => thrift_host, :timestamp => @timestamp ) end |