Commit 09d16a36 authored by Stan Hu's avatar Stan Hu

Merge branch '3256-improve-replication-status' into 'master'

Geo: Improve status report

See merge request gitlab-org/gitlab-ee!4164
parents 05d497e1 b6208bc1
---
title: 'Geo - Improve node status report by adding one more indicator of health: last
time when primary pulled the status of the secondary'
merge_request:
author:
type: added
......@@ -58,7 +58,7 @@ class GeoNodeStatus < ActiveRecord::Base
def self.allowed_params
excluded_params = %w(id created_at updated_at).freeze
extra_params = %w(success health health_status last_event_timestamp cursor_last_event_timestamp version revision storage_shards).freeze
extra_params = %w(success health health_status last_event_timestamp cursor_last_event_timestamp version revision storage_shards updated_at).freeze
self.column_names - excluded_params + extra_params
end
......
......@@ -1227,6 +1227,8 @@ module API
expose :namespaces, using: NamespaceBasic
expose :updated_at
# We load GeoNodeStatus data in two ways:
#
# 1. Directly by asking a Geo node via an API call
......
......@@ -211,7 +211,7 @@ namespace :geo do
task status: :environment do
abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows?
COLUMN_WIDTH = 35
COLUMN_WIDTH = 40
current_node_status = GeoNodeStatus.current_node_status
geo_node = current_node_status.geo_node
......@@ -265,5 +265,15 @@ namespace :geo do
print cursor_last_event_id
puts "(#{time_ago_in_words(Geo::EventLog.find_by(id: cursor_last_event_id)&.created_at)} ago)"
end
print 'Last status was pulled by primary node: '.rjust(COLUMN_WIDTH)
if current_node_status.updated_at
puts "#{time_ago_in_words(current_node_status.updated_at)} ago"
else
# Only primary node can create a status record in the database so if it does not exist
# we get unsaved record where updated_at is nil
puts "Never"
end
end
end
......@@ -33,7 +33,8 @@
"namespaces",
"version",
"revision",
"_links"
"_links",
"updated_at"
],
"properties" : {
"geo_node_id": { "type": "integer" },
......@@ -84,7 +85,8 @@
"node": { "type": "string" }
},
"additionalProperties": false
}
},
"updated_at": { "type": ["string", "null"] }
},
"additionalProperties": false
}
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