Commit 8194c7d2 authored by Kushal Pandya's avatar Kushal Pandya

Toon Claes: Add `health_status` to `/admin/geo_nodes/:id/status.json`

parent 3c0c5d4a
......@@ -3,6 +3,7 @@ class GeoNodeStatus < ActiveRecord::Base
# Whether we were successful in reaching this node
attr_accessor :success
attr_accessor :health_status
# Be sure to keep this consistent with Prometheus naming conventions
PROMETHEUS_METRICS = {
......@@ -47,8 +48,8 @@ class GeoNodeStatus < ActiveRecord::Base
end
def self.allowed_params
excluded_params = %w(id last_successful_status_check_at created_at updated_at).freeze
extra_params = %w(success health last_event_timestamp cursor_last_event_timestamp).freeze
excluded_params = %w(id created_at updated_at).freeze
extra_params = %w(success health health_status last_event_timestamp cursor_last_event_timestamp).freeze
self.column_names - excluded_params + extra_params
end
......@@ -89,6 +90,10 @@ class GeoNodeStatus < ActiveRecord::Base
status_message.blank? || status_message == 'Healthy'.freeze
end
def health_status
@health_status || (healthy? ? 'Healthy' : 'Unhealthy')
end
def last_successful_status_check_timestamp
self.last_successful_status_check_at.to_i
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment