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
write access for tests.
-
#timestamp ⇒ Object
write access for tests.
-
#value ⇒ Object
write access for tests.
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.
154 155 156 157 158 |
# File 'lib/finagle-thrift/tracer.rb', line 154 def initialize(value, host) @timestamp = (Time.now.to_f * 1000 * 1000).to_i # micros @value = value @host = host end |
Instance Attribute Details
#host ⇒ Object
write access for tests
153 154 155 |
# File 'lib/finagle-thrift/tracer.rb', line 153 def host @host end |
#timestamp ⇒ Object
write access for tests
153 154 155 |
# File 'lib/finagle-thrift/tracer.rb', line 153 def @timestamp end |
#value ⇒ Object
write access for tests
153 154 155 |
# File 'lib/finagle-thrift/tracer.rb', line 153 def value @value end |
Instance Method Details
#to_s ⇒ Object
169 170 171 |
# File 'lib/finagle-thrift/tracer.rb', line 169 def to_s "#{@value} at #{@timestamp} for (#{@host.to_s})" end |
#to_thrift ⇒ Object
160 161 162 163 164 165 166 167 |
# File 'lib/finagle-thrift/tracer.rb', line 160 def to_thrift thrift_host = host ? host.to_thrift : nil FinagleThrift::Annotation.new( :value => @value, :host => thrift_host, :timestamp => @timestamp ) end |