Sha256: 19ea85c10893e71a47d6539b4e3d20d627242e2d666375fa36d946b290f4e3ed

Contents?: true

Size: 751 Bytes

Versions: 7

Compression:

Stored size: 751 Bytes

Contents

module Test
  module Propagation
    class TextMapCodec
      TRACE_ID = "trace_id".freeze
      SPAN_ID = "span_id".freeze
      PARENT_SPAN_ID = "parent_span_id".freeze

      def inject(span_context, carrier)
        carrier[TRACE_ID] = span_context.trace_id
        carrier[SPAN_ID] = span_context.span_id
        carrier[PARENT_SPAN_ID] = span_context.parent_span_id
      end

      def extract(carrier)
        trace_id = carrier[TRACE_ID]
        span_id = carrier[SPAN_ID]
        parent_span_id = carrier[PARENT_SPAN_ID]

        if trace_id && span_id
          SpanContext.new(trace_id: trace_id,
                          span_id: span_id,
                          parent_span_id: parent_span_id)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
test-tracer-1.2.1 lib/test/propagation/text_map_codec.rb
test-tracer-1.2.0 lib/test/propagation/text_map_codec.rb
test-tracer-1.1.4 lib/test/propagation/text_map_codec.rb
test-tracer-1.1.3 lib/test/propagation/text_map_codec.rb
test-tracer-1.1.2 lib/test/propagation/text_map_codec.rb
test-tracer-1.1.1 lib/test/propagation/text_map_codec.rb
test-tracer-1.1.0 lib/test/propagation/text_map_codec.rb