Class: Trace::TraceId
- Inherits:
-
Object
- Object
- Trace::TraceId
- Defined in:
- lib/finagle-thrift/trace.rb
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#sampled ⇒ Object
readonly
Returns the value of attribute sampled.
-
#span_id ⇒ Object
readonly
Returns the value of attribute span_id.
-
#trace_id ⇒ Object
readonly
Returns the value of attribute trace_id.
Instance Method Summary collapse
-
#debug? ⇒ Boolean
the debug flag is used to ensure the trace passes ALL samplers.
-
#initialize(trace_id, parent_id, span_id, sampled, flags) ⇒ TraceId
constructor
A new instance of TraceId.
- #next_id ⇒ Object
- #sampled? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(trace_id, parent_id, span_id, sampled, flags) ⇒ TraceId
Returns a new instance of TraceId.
64 65 66 67 68 69 70 |
# File 'lib/finagle-thrift/trace.rb', line 64 def initialize(trace_id, parent_id, span_id, sampled, flags) @trace_id = SpanId.from_value(trace_id) @parent_id = parent_id.nil? ? nil : SpanId.from_value(parent_id) @span_id = SpanId.from_value(span_id) @sampled = !!sampled @flags = flags end |
Instance Attribute Details
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
62 63 64 |
# File 'lib/finagle-thrift/trace.rb', line 62 def flags @flags end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
62 63 64 |
# File 'lib/finagle-thrift/trace.rb', line 62 def parent_id @parent_id end |
#sampled ⇒ Object (readonly)
Returns the value of attribute sampled.
62 63 64 |
# File 'lib/finagle-thrift/trace.rb', line 62 def sampled @sampled end |
#span_id ⇒ Object (readonly)
Returns the value of attribute span_id.
62 63 64 |
# File 'lib/finagle-thrift/trace.rb', line 62 def span_id @span_id end |
#trace_id ⇒ Object (readonly)
Returns the value of attribute trace_id.
62 63 64 |
# File 'lib/finagle-thrift/trace.rb', line 62 def trace_id @trace_id end |
Instance Method Details
#debug? ⇒ Boolean
the debug flag is used to ensure the trace passes ALL samplers
77 78 79 |
# File 'lib/finagle-thrift/trace.rb', line 77 def debug? @flags & Flags::DEBUG == Flags::DEBUG end |
#next_id ⇒ Object
72 73 74 |
# File 'lib/finagle-thrift/trace.rb', line 72 def next_id TraceId.new(@trace_id, @span_id, Trace.generate_id, @sampled, @flags) end |
#sampled? ⇒ Boolean
81 82 83 |
# File 'lib/finagle-thrift/trace.rb', line 81 def sampled? debug? || @sampled end |
#to_s ⇒ Object
85 86 87 |
# File 'lib/finagle-thrift/trace.rb', line 85 def to_s "TraceId(trace_id = #{@trace_id.to_s}, parent_id = #{@parent_id.to_s}, span_id = #{@span_id.to_s}, sampled = #{@sampled.to_s}, flags = #{@flags.to_s})" end |