Module: Datadog::OpenTracer::SpanContextFactory

Defined in:
lib/ddtrace/opentracer/span_context_factory.rb

Overview

Creates new Datadog::OpenTracer::SpanContext

Class Method Summary collapse

Class Method Details

.build(datadog_context:, baggage: {}) ⇒ Object



7
8
9
10
11
12
# File 'lib/ddtrace/opentracer/span_context_factory.rb', line 7

def build(datadog_context:, baggage: {})
  SpanContext.new(
    datadog_context: datadog_context,
    baggage: baggage.dup
  )
end

.clone(span_context:, baggage: {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ddtrace/opentracer/span_context_factory.rb', line 14

def clone(span_context:, baggage: {})
  SpanContext.new(
    datadog_context: span_context.datadog_context,
    # Merge baggage from previous SpanContext
    baggage: span_context.baggage.merge(baggage)
  )
end