Sha256: ba07cf41b427a40fbbd9a860f1e0f8610452d32f60b25ef5d29860e3ae4e8809

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

class OpenTracingTestTracer
  # 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)
    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
      )
    end

    attr_reader :span_id, :parent_id, :trace_id, :baggage

    def initialize(span_id:, parent_id: nil, trace_id:, baggage: {})
      @span_id = span_id
      @parent_id = parent_id
      @trace_id = trace_id
      @baggage = baggage
    end

    def to_s
      "SpanContext(trace_id=#{@trace_id}, " \
        "span_id=#{@span_id}, " \
        "parent_id=#{@parent_id}, " \
        "baggage=#{@baggage})"
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
signalfx_test_tracer-0.1.3 lib/signalfx_test_tracer/span_context.rb
signalfx_test_tracer-0.1.2 lib/signalfx_test_tracer/span_context.rb
signalfx_test_tracer-0.1.1 lib/signalfx_test_tracer/span_context.rb
signalfx_test_tracer-0.1.0 lib/signalfx_test_tracer/span_context.rb
opentracing_test_tracer-0.1.1 lib/opentracing_test_tracer/span_context.rb
opentracing_test_tracer-0.1.0 lib/opentracing_test_tracer/span_context.rb