class Rack::Perf::SendDataToPerf

this method sends up the single timing request up to Perf TODO: queue this up in a batch

Constants

DESTINATION_URL

Public Instance Methods

perform!() click to toggle source
# File lib/rack/perf.rb, line 143
def perform!
  Unirest.post(DESTINATION_URL, headers: headers, parameters: params_json)
end

Private Instance Methods

headers() click to toggle source
# File lib/rack/perf.rb, line 149
def headers
  { "Content-Type"          => "application/json",
    "X-Perf-Public-API-Key" => api_key }
end
params() click to toggle source
# File lib/rack/perf.rb, line 154
def params
  { "ip_addr"        => ip_addr,
    "request_method" => request_method,
    "request_url"    => request_url,
    "normalized_uri" => normalized_uri,
    "status_code"    => status_code,
    "time_in_millis" => time_in_millis }
end
params_json() click to toggle source
# File lib/rack/perf.rb, line 163
def params_json
  [params].to_json do
    # TODO: handle the incoming response
  end
end