Module: OpenTelemetry::Propagator::B3
- Extended by:
- B3
- Included in:
- B3
- Defined in:
- lib/opentelemetry/propagator/b3/multi.rb,
lib/opentelemetry/propagator/b3/single.rb,
lib/opentelemetry/propagator/b3/version.rb,
lib/opentelemetry/propagator/b3/multi/text_map_injector.rb,
lib/opentelemetry/propagator/b3/multi/text_map_extractor.rb,
lib/opentelemetry/propagator/b3/single/text_map_injector.rb,
lib/opentelemetry/propagator/b3/single/text_map_extractor.rb,
lib/opentelemetry/propagator/b3.rb
Overview
Namespace for OpenTelemetry B3 propagation
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.16.0'
Instance Method Summary collapse
-
#context_with_debug(context) ⇒ Object
private
Returns a new context with the b3 debug flag enabled.
-
#debug?(context) ⇒ Boolean
private
Read the B3 debug flag from the provided context.
-
#to_span_id(hex_id) ⇒ Object
private
Convert an id from a hex encoded string to byte array.
-
#to_trace_id(hex_id) ⇒ Object
private
Convert an id from a hex encoded string to byte array, optionally left padding to the correct length.
Instance Method Details
#context_with_debug(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new context with the b3 debug flag enabled
25 26 27 |
# File 'lib/opentelemetry/propagator/b3.rb', line 25 def context_with_debug(context) context.set_value(DEBUG_CONTEXT_KEY, true) end |
#debug?(context) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Read the B3 debug flag from the provided context
31 32 33 |
# File 'lib/opentelemetry/propagator/b3.rb', line 31 def debug?(context) context.value(DEBUG_CONTEXT_KEY) end |
#to_span_id(hex_id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert an id from a hex encoded string to byte array.
49 50 51 |
# File 'lib/opentelemetry/propagator/b3.rb', line 49 def to_span_id(hex_id) Array(hex_id).pack('H*') end |
#to_trace_id(hex_id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert an id from a hex encoded string to byte array, optionally left padding to the correct length. Assumes the input id has already been validated to be 16 or 32 characters in length.
39 40 41 42 43 44 45 |
# File 'lib/opentelemetry/propagator/b3.rb', line 39 def to_trace_id(hex_id) if hex_id.length == 32 Array(hex_id).pack('H*') else [0, hex_id].pack('qH*') end end |