Class: Freno::Client::Requests::CheckRead

Inherits:
Freno::Client::Request show all
Defined in:
lib/freno/client/requests/check_read.rb

Constant Summary

Constants included from Preconditions

Preconditions::PreconditionNotMet

Instance Attribute Summary

Attributes inherited from Freno::Client::Request

#args, #faraday, #options, #raise_on_timeout

Instance Method Summary collapse

Methods inherited from Freno::Client::Request

perform, #perform

Methods included from Preconditions

check

Constructor Details

#initialize(**kwargs) ⇒ CheckRead

Returns a new instance of CheckRead.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/freno/client/requests/check_read.rb', line 9

def initialize(**kwargs)
  super

  app        = kwargs.fetch(:app)
  store_type = kwargs.fetch(:store_type)
  store_name = kwargs.fetch(:store_name)
  threshold  = kwargs.fetch(:threshold)

  check do
    present app: app, store_type: store_type, store_name: store_name, threshold: threshold
  end

  # A low priority check is handled slightly differently by Freno. If
  # the p=low GET parameter is passed, the check will fail for any app
  # with failed checks within the last second. This failure is returned
  # quickly, without checking the underlying metric.
  params[:p] = "low" if options[:low_priority]

  @path = "check-read/#{app}/#{store_type}/#{store_name}/#{threshold.to_f.round(3)}"
end