Sha256: 3ec7e96d551a027b998261ef837a24e3e6449c840fe838d5e96b058adf365478

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module YgreneIstioTracing
  module Tracing
    class RackMiddleware

      def initialize(app)
        puts 'Tracing Loaded'
        @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 do |k, _v|
          header = k.upcase.gsub(/^HTTP_/, '').tr('_', '-')
          PROPAGATION_HEADERS.include?(header)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ygrene_istio_tracing-1.0.11 lib/ygrene_istio_tracing/tracing/rack.rb