class Rack::SkylightEndpoint

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/rack/skylight_endpoint.rb, line 3
def initialize(app, options = {})
  @app = app
  @options = {
    path:     '/health_check',
    endpoint: 'health_check',
  }.merge(options)
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/skylight_endpoint.rb, line 11
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