Module: Datadog::OpenTracer::SpanContextFactory

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

Overview

Creates new Datadog::OpenTracer::SpanContext

Class Method Summary collapse

Class Method Details

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



9
10
11
12
13
14
15
# File 'lib/datadog/opentracer/span_context_factory.rb', line 9

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

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



17
18
19
20
21
22
23
24
# File 'lib/datadog/opentracer/span_context_factory.rb', line 17

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