Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8194c7d2
Commit
8194c7d2
authored
Dec 07, 2017
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toon Claes: Add `health_status` to `/admin/geo_nodes/:id/status.json`
parent
3c0c5d4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
app/models/geo_node_status.rb
app/models/geo_node_status.rb
+7
-2
No files found.
app/models/geo_node_status.rb
View file @
8194c7d2
...
@@ -3,6 +3,7 @@ class GeoNodeStatus < ActiveRecord::Base
...
@@ -3,6 +3,7 @@ class GeoNodeStatus < ActiveRecord::Base
# Whether we were successful in reaching this node
# Whether we were successful in reaching this node
attr_accessor
:success
attr_accessor
:success
attr_accessor
:health_status
# Be sure to keep this consistent with Prometheus naming conventions
# Be sure to keep this consistent with Prometheus naming conventions
PROMETHEUS_METRICS
=
{
PROMETHEUS_METRICS
=
{
...
@@ -47,8 +48,8 @@ class GeoNodeStatus < ActiveRecord::Base
...
@@ -47,8 +48,8 @@ class GeoNodeStatus < ActiveRecord::Base
end
end
def
self
.
allowed_params
def
self
.
allowed_params
excluded_params
=
%w(id
last_successful_status_check_at
created_at updated_at)
.
freeze
excluded_params
=
%w(id created_at updated_at)
.
freeze
extra_params
=
%w(success health last_event_timestamp cursor_last_event_timestamp)
.
freeze
extra_params
=
%w(success health
health_status
last_event_timestamp cursor_last_event_timestamp)
.
freeze
self
.
column_names
-
excluded_params
+
extra_params
self
.
column_names
-
excluded_params
+
extra_params
end
end
...
@@ -89,6 +90,10 @@ class GeoNodeStatus < ActiveRecord::Base
...
@@ -89,6 +90,10 @@ class GeoNodeStatus < ActiveRecord::Base
status_message
.
blank?
||
status_message
==
'Healthy'
.
freeze
status_message
.
blank?
||
status_message
==
'Healthy'
.
freeze
end
end
def
health_status
@health_status
||
(
healthy?
?
'Healthy'
:
'Unhealthy'
)
end
def
last_successful_status_check_timestamp
def
last_successful_status_check_timestamp
self
.
last_successful_status_check_at
.
to_i
self
.
last_successful_status_check_at
.
to_i
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment