Class: Appsignal::Rack::ApplyRackRequest Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, options = {}) ⇒ ApplyRackRequest

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ApplyRackRequest.



44
45
46
47
48
# File 'lib/appsignal/rack.rb', line 44

def initialize(request, options = {})
  @request = request
  @options = options
  @params_method = options.fetch(:params_method, :params)
end

Instance Attribute Details

#optionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/appsignal/rack.rb', line 42

def options
  @options
end

#requestObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/appsignal/rack.rb', line 42

def request
  @request
end

Instance Method Details

#apply_to(transaction) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/appsignal/rack.rb', line 50

def apply_to(transaction)
  request_path = request.path
  transaction.("request_path", request_path)
  # TODO: Remove in next major/minor version
  transaction.("path", request_path)

  request_method = request_method_for(request)
  if request_method
    transaction.("request_method", request_method)
    # TODO: Remove in next major/minor version
    transaction.("method", request_method)
  end

  transaction.add_params { params_for(request) }
  transaction.add_session_data { session_data_for(request) }
  transaction.add_headers do
    request.env if request.respond_to?(:env)
  end

  queue_start = Appsignal::Rack::Utils.queue_start_from(request.env)
  transaction.set_queue_start(queue_start) if queue_start
end