Sha256: 1622e781ecf38e19dacc9ea3f4c33ef7d8ec915bbea8fbf1b526b5bf0e525fb7

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

# frozen_string_literal: true

module Istio
  module Tracing
    class RackMiddleware

      def initialize(app)
        @app = app
      end

      def call(env)
        Context.build_current(extract_http_headers(env))
        @app.call(env)
      ensure
        Context.remove_current
      end

      def extract_http_headers(env)
        env.select { |k, _v| PROPAGATION_HEADERS.include?(k.downcase) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ygrene_istio_tracing-1.0.1 lib/istio/tracing/rack.rb
ygrene_istio_tracing-1.0.0 lib/istio/tracing/rack.rb