Sha256: b73d877a3bc10fe1806204c319ebcb978909ab1acbcc8159d1ffc3f340512a0b
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
module Zipkin # SpanContext holds the data for a span that gets inherited to child spans class SpanContext def self.create_parent_context trace_id = TraceId.generate new(trace_id: trace_id, span_id: trace_id, sampled: true) end def self.create_from_parent_context(span_context) new( span_id: TraceId.generate, parent_id: span_context.span_id, trace_id: span_context.trace_id, sampled: span_context.sampled? ) end attr_reader :span_id, :parent_id, :trace_id, :baggage def initialize(span_id:, parent_id: nil, trace_id:, sampled:, baggage: {}) @span_id = span_id @parent_id = parent_id @trace_id = trace_id @sampled = sampled @baggage = baggage end def sampled? @sampled end # NOTE: This method is not defined in OpenTracing Ruby spec. Use with # caution. def to_h { span_id: @span_id, parent_id: @parent_id, trace_id: @trace_id, sampled: @sampled } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zipkin-1.3.0 | lib/zipkin/span_context.rb |