Class: Test::Propagation::TextMapCodec
- Inherits:
-
Object
- Object
- Test::Propagation::TextMapCodec
- Defined in:
- lib/test/propagation/text_map_codec.rb
Constant Summary collapse
- TRACE_ID =
"trace_id".freeze
- SPAN_ID =
"span_id".freeze
- PARENT_SPAN_ID =
"parent_span_id".freeze
Instance Method Summary collapse
Instance Method Details
#extract(carrier) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/test/propagation/text_map_codec.rb', line 14 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 |
#inject(span_context, carrier) ⇒ Object
8 9 10 11 12 |
# File 'lib/test/propagation/text_map_codec.rb', line 8 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 |