# frozen_string_literal: true # Custom patch to temporarily maintain 2.7.x support module OpenTelemetry module Common module Propagation # The RackEnvGetter class provides a common methods for reading # keys from a rack environment. It abstracts away the rack-normalization # process so that keys can be looked up without having to transform them # first. With this class you can get +traceparent+ instead of # +HTTP_TRACEPARENT+ class RackEnvGetter private def to_rack_key(key) ret = "HTTP_#{key}" ret = ret.tr('-', '_') ret = ret.upcase ret end def from_rack_key(key) start = key.start_with?('HTTP_') ? 5 : 0 ret = key[start..] ret = ret.tr('_', '-') ret = ret.downcase! ret end end end end end