Class: RequestTracer::Trace::SpanId
- Inherits:
-
Object
- Object
- RequestTracer::Trace::SpanId
- Defined in:
- lib/request_tracer/trace.rb
Overview
A span represents one specific method call
Constant Summary collapse
- HEX_REGEX =
/^[a-f0-9]{16}$/i
- MAX_SIGNED_I64 =
9223372036854775807
- MASK =
(2 ** 64) - 1
Instance Attribute Summary collapse
-
#i64 ⇒ Object
readonly
Returns the value of attribute i64.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other_span) ⇒ Object
-
#initialize(value) ⇒ SpanId
constructor
A new instance of SpanId.
- #to_i ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ SpanId
Returns a new instance of SpanId.
32 33 34 35 36 37 38 39 |
# File 'lib/request_tracer/trace.rb', line 32 def initialize(value) @value = value @i64 = if @value > MAX_SIGNED_I64 -1 * ((@value ^ MASK) + 1) else @value end end |
Instance Attribute Details
#i64 ⇒ Object (readonly)
Returns the value of attribute i64.
31 32 33 |
# File 'lib/request_tracer/trace.rb', line 31 def i64 @i64 end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
31 32 33 |
# File 'lib/request_tracer/trace.rb', line 31 def value @value end |
Class Method Details
Instance Method Details
#==(other_span) ⇒ Object
41 42 43 |
# File 'lib/request_tracer/trace.rb', line 41 def ==(other_span) other_span && (other_span.value == @value) end |
#to_i ⇒ Object
45 |
# File 'lib/request_tracer/trace.rb', line 45 def to_i; @i64; end |
#to_s ⇒ Object
44 |
# File 'lib/request_tracer/trace.rb', line 44 def to_s; "%016x" % @value; end |