|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require_relative '../../../distributed/fetcher' |
| 4 | +require_relative '../../../distributed/propagation' |
| 5 | +require_relative '../../../distributed/b3_multi' |
| 6 | +require_relative '../../../distributed/b3_single' |
| 7 | +require_relative '../../../distributed/datadog' |
| 8 | +require_relative '../../../distributed/none' |
| 9 | +require_relative '../../../distributed/trace_context' |
| 10 | +require_relative '../../../configuration/ext' |
| 11 | + |
| 12 | +module Datadog |
| 13 | + module Tracing |
| 14 | + module Contrib |
| 15 | + module Karafka |
| 16 | + module Distributed |
| 17 | + # Extracts and injects propagation through Kafka message headers. |
| 18 | + class Propagation < Tracing::Distributed::Propagation |
| 19 | + def initialize( |
| 20 | + propagation_style_inject:, |
| 21 | + propagation_style_extract:, |
| 22 | + propagation_extract_first: |
| 23 | + ) |
| 24 | + super( |
| 25 | + propagation_styles: { |
| 26 | + Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER => |
| 27 | + Tracing::Distributed::B3Multi.new(fetcher: Tracing::Distributed::Fetcher), |
| 28 | + Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER => |
| 29 | + Tracing::Distributed::B3Single.new(fetcher: Tracing::Distributed::Fetcher), |
| 30 | + Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG => |
| 31 | + Tracing::Distributed::Datadog.new(fetcher: Tracing::Distributed::Fetcher), |
| 32 | + Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT => |
| 33 | + Tracing::Distributed::TraceContext.new(fetcher: Tracing::Distributed::Fetcher), |
| 34 | + Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_NONE => Tracing::Distributed::None.new |
| 35 | + }, |
| 36 | + propagation_style_inject: propagation_style_inject, |
| 37 | + propagation_style_extract: propagation_style_extract, |
| 38 | + propagation_extract_first: propagation_extract_first |
| 39 | + ) |
| 40 | + end |
| 41 | + end |
| 42 | + end |
| 43 | + end |
| 44 | + end |
| 45 | + end |
| 46 | +end |
| 47 | + |
0 commit comments