Class: Aws::Xray::Rack

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/xray/rack.rb

Constant Summary collapse

TRACE_ENV =
'HTTP_X_AMZN_TRACE_ID'.freeze
ORIGINAL_TRACE_ENV =
'HTTP_X_AMZN_TRACE_ID_ORIGINAL'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(app, excluded_paths: []) ⇒ Rack

Returns a new instance of Rack.

Parameters:

  • excluded_paths (Array<String,Regexp>) (defaults to: [])

    for health-check endpoints etc…



8
9
10
11
12
# File 'lib/aws/xray/rack.rb', line 8

def initialize(app, excluded_paths: [])
  @app = app
  @name = Aws::Xray.config.name || raise(MissingNameError)
  @excluded_paths = excluded_paths + Aws::Xray.config.excluded_paths
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/aws/xray/rack.rb', line 14

def call(env)
  if excluded_path?(env['PATH_INFO'])
    @app.call(env)
  else
    call_with_tracing(env)
  end
end