Sha256: 48c954690020b6589599783a7dee03de8712d361c825a603a993e0a26bf7d785

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

module Rack
  class SkylightEndpoint
    def initialize(app, options = {})
      @app = app
      @options = {
        path:     '/health_check',
        endpoint: 'health_check',
      }.merge(options)
    end

    def call(env)
      if env['PATH_INFO'] == @options[:path]
        status, headers, body = @app.call(env)
        trace = Skylight::Instrumenter.instance.try(:current_trace)
        trace.endpoint = @options[:endpoint] if trace
        [status, headers, body]
      else
        @app.call(env)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-skylight-endpoint-1.0.1 lib/rack/skylight_endpoint.rb
rack-skylight-endpoint-1.0.0 lib/rack/skylight_endpoint.rb