Sha256: 0d643569ef2a6f5007982dc72dd8103e67e6a418a7a51bc6236ea3844934757d

Contents?: true

Size: 943 Bytes

Versions: 5

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

require "honeycomb/propagation/honeycomb_modern"
require "honeycomb/propagation/w3c"

module Honeycomb
  # Default behavior for handling trace propagation
  module DefaultModernPropagation
    # Parse incoming trace headers.
    #
    # Checks for and parses Honeycomb's trace header or, if not found,
    # then checks for and parses W3C trace parent header.
    module UnmarshalTraceContext
      def parse_rack_env(env)
        if env["HTTP_X_HONEYCOMB_TRACE"]
          HoneycombModernPropagation::UnmarshalTraceContext.parse_rack_env env
        elsif env["HTTP_TRACEPARENT"]
          W3CPropagation::UnmarshalTraceContext.parse_rack_env env
        else
          [nil, nil, nil, nil]
        end
      end
      # rubocop:disable Style/AccessModifierDeclarations
      module_function :parse_rack_env
      public :parse_rack_env
      # rubocop:enable Style/AccessModifierDeclarations
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
honeycomb-beeline-3.0.0 lib/honeycomb/propagation/default_modern.rb
honeycomb-beeline-2.11.1.pre.dev lib/honeycomb/propagation/default_modern.rb
honeycomb-beeline-2.11.0 lib/honeycomb/propagation/default_modern.rb
honeycomb-beeline-2.10.0 lib/honeycomb/propagation/default_modern.rb
honeycomb-beeline-2.9.0 lib/honeycomb/propagation/default_modern.rb