Sha256: 353980862dddea6812d8ccea8e6b14107490e42bf344f251e4cb7158e948023b
Contents?: true
Size: 1.19 KB
Versions: 17
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: false require_relative '../../../distributed/fetcher' module Datadog module Tracing module Contrib module HTTP module Distributed # Retrieves HTTP headers from carrier. # Headers will also match if Rack-formatted: # 'my-header' will match 'my-header' and 'HTTP_MY_HEADER'. # # In case both variants are present, the verbatim match will be used. class Fetcher < Tracing::Distributed::Fetcher # DEV: Should we try to parse both verbatim an Rack-formatted headers, # DEV: given Rack-formatted is the most common format in Ruby? def [](name) # Try to fetch with the plain key value = super(name) return value if value && !value.empty? # If not found, try the Rack-formatted key rack_header = "HTTP-#{name}" rack_header.upcase! rack_header.tr!('-'.freeze, '_'.freeze) hdr = super(rack_header) # Only return the value if it is not an empty string hdr if hdr != '' end end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems