Class: MissionControl::Servers::Request

Inherits:
ApplicationRecord show all
Defined in:
app/models/mission_control/servers/request.rb

Class Method Summary collapse

Class Method Details

.recent_requests(project, hostname) ⇒ Object



11
12
13
14
15
16
# File 'app/models/mission_control/servers/request.rb', line 11

def recent_requests(project, hostname)
  where(
    hostname: [service_setting(project, hostname), hostname].compact.uniq,
    created_at: 1.minute.ago..
  )
end

.recent_totals(project, hostname) ⇒ Object



7
8
9
# File 'app/models/mission_control/servers/request.rb', line 7

def recent_totals(project, hostname)
  recent_requests(project, hostname)
end

.service_setting(project, hostname) ⇒ Object



18
19
20
# File 'app/models/mission_control/servers/request.rb', line 18

def service_setting(project, hostname)
  project.service_settings.find_by(hostname: hostname)&.request_hostname
end