Sha256: e9fc7522d51bf21419684e4d30099edca7e21ece21ae44d1c4b9e70b5c865d11

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

module Skylight
  module Probes
    module Rack
      module Builder
        module Instrumentation
          def use(middleware, *args, &block)
            if @map
              mapping = @map
              @map = nil
              @use << proc { |app| generate_map(app, mapping) }
            end
            @use << proc do |app|
              middleware
                .new(app, *args, &block)
                .tap do |middleware_instance|
                  Skylight::Probes::Middleware::Instrumentation.sk_instrument_middleware(middleware_instance)
                end
            end
          end
          ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)
        end

        class Probe
          def install
            if defined?(::Rack.release) && Gem::Version.new(::Rack.release) >= ::Gem::Version.new("1.4") &&
                 defined?(::Rack::Builder)
              require "skylight/probes/middleware"
              ::Rack::Builder.prepend(Instrumentation)
            end
          end
        end
      end
    end

    register(:rack_builder, "Rack::Builder", "rack/builder", Skylight::Probes::Rack::Builder::Probe.new)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
skylight-6.1.0.beta lib/skylight/probes/rack_builder.rb
skylight-6.0.4 lib/skylight/probes/rack_builder.rb
skylight-6.0.3 lib/skylight/probes/rack_builder.rb
skylight-5.3.5 lib/skylight/probes/rack_builder.rb
skylight-6.0.2 lib/skylight/probes/rack_builder.rb
skylight-6.0.1 lib/skylight/probes/rack_builder.rb
skylight-6.0.0 lib/skylight/probes/rack_builder.rb
skylight-6.0.0.beta2 lib/skylight/probes/rack_builder.rb
skylight-6.0.0.beta lib/skylight/probes/rack_builder.rb
skylight-5.3.4 lib/skylight/probes/rack_builder.rb
skylight-5.3.3 lib/skylight/probes/rack_builder.rb
skylight-5.3.2 lib/skylight/probes/rack_builder.rb
skylight-5.3.1 lib/skylight/probes/rack_builder.rb
skylight-5.3.0 lib/skylight/probes/rack_builder.rb
skylight-5.2.0 lib/skylight/probes/rack_builder.rb
skylight-5.2.0.beta2 lib/skylight/probes/rack_builder.rb
skylight-5.2.0.beta lib/skylight/probes/rack_builder.rb