Class: OpenTelemetry::Trace::Propagation::TraceContext::ResponseTextMapPropagator
- Inherits:
-
Object
- Object
- OpenTelemetry::Trace::Propagation::TraceContext::ResponseTextMapPropagator
- Defined in:
- lib/opentelemetry/sdk/trace/propagation/trace_context/response_text_map_propagator.rb
Overview
Propagates trace response using the W3C Trace Context format w3c.github.io/trace-context/#traceresponse-header
Instance Method Summary collapse
-
#extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter) ⇒ Context
Extract trace context from the supplied carrier.
-
#fields ⇒ Array<String>
Returns the predefined propagation fields.
-
#inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter) ⇒ Object
Inject trace context into the supplied carrier.
Instance Method Details
#extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter) ⇒ Context
Extract trace context from the supplied carrier. This is a no-op for this propagator, and will return the provided context.
46 47 48 |
# File 'lib/opentelemetry/sdk/trace/propagation/trace_context/response_text_map_propagator.rb', line 46 def extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter) context end |
#fields ⇒ Array<String>
Returns the predefined propagation fields. If your carrier is reused, you should delete the fields returned by this method before calling inject
.
54 55 56 |
# File 'lib/opentelemetry/sdk/trace/propagation/trace_context/response_text_map_propagator.rb', line 54 def fields FIELDS end |
#inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter) ⇒ Object
Inject trace context into the supplied carrier.
27 28 29 30 31 32 33 |
# File 'lib/opentelemetry/sdk/trace/propagation/trace_context/response_text_map_propagator.rb', line 27 def inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter) span_context = Trace.current_span(context).context return unless span_context.valid? setter.set(carrier, TRACERESPONSE_KEY, TraceParent.from_span_context(span_context).to_s) nil end |