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
eb880edb
Commit
eb880edb
authored
Dec 07, 2017
by
Douglas Barbosa Alexandre
Committed by
Kushal Pandya
Dec 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose GitLab revision in Geo status API
parent
bf3df4b1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
20 deletions
+22
-20
app/models/geo_node_status.rb
app/models/geo_node_status.rb
+2
-4
app/serializers/geo_node_status_entity.rb
app/serializers/geo_node_status_entity.rb
+11
-0
db/migrate/20171206225142_add_version_to_geo_node_statuses.rb
...igrate/20171206225142_add_version_to_geo_node_statuses.rb
+0
-9
db/schema.rb
db/schema.rb
+1
-2
doc/api/geo_nodes.md
doc/api/geo_nodes.md
+4
-2
spec/factories/geo_node_statuses.rb
spec/factories/geo_node_statuses.rb
+0
-1
spec/fixtures/api/schemas/geo_node_status.json
spec/fixtures/api/schemas/geo_node_status.json
+4
-2
No files found.
app/models/geo_node_status.rb
View file @
eb880edb
...
...
@@ -2,8 +2,7 @@ class GeoNodeStatus < ActiveRecord::Base
belongs_to
:geo_node
# Whether we were successful in reaching this node
attr_accessor
:success
attr_accessor
:health_status
attr_accessor
:success
,
:health_status
,
:version
,
:revision
# Be sure to keep this consistent with Prometheus naming conventions
PROMETHEUS_METRICS
=
{
...
...
@@ -48,7 +47,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)
.
freeze
extra_params
=
%w(success health health_status last_event_timestamp cursor_last_event_timestamp
version revision
)
.
freeze
self
.
column_names
-
excluded_params
+
extra_params
end
...
...
@@ -67,7 +66,6 @@ class GeoNodeStatus < ActiveRecord::Base
self
.
lfs_objects_count
=
geo_node
.
lfs_objects
.
count
self
.
attachments_count
=
geo_node
.
uploads
.
count
self
.
last_successful_status_check_at
=
Time
.
now
self
.
version
=
Gitlab
::
VERSION
if
Gitlab
::
Geo
.
secondary?
self
.
db_replication_lag_seconds
=
Gitlab
::
Geo
::
HealthCheck
.
db_replication_lag_seconds
...
...
app/serializers/geo_node_status_entity.rb
View file @
eb880edb
...
...
@@ -40,10 +40,21 @@ class GeoNodeStatusEntity < Grape::Entity
expose
:last_successful_status_check_timestamp
expose
:version
expose
:revision
expose
:namespaces
,
using:
NamespaceEntity
private
def
namespaces
object
.
geo_node
.
namespaces
end
def
version
Gitlab
::
VERSION
end
def
revision
Gitlab
::
REVISION
end
end
db/migrate/20171206225142_add_version_to_geo_node_statuses.rb
deleted
100644 → 0
View file @
bf3df4b1
class
AddVersionToGeoNodeStatuses
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:geo_node_statuses
,
:version
,
:string
end
end
db/schema.rb
View file @
eb880edb
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2017120
6225142
)
do
ActiveRecord
::
Schema
.
define
(
version:
2017120
5190711
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -971,7 +971,6 @@ ActiveRecord::Schema.define(version: 20171206225142) do
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"last_successful_status_check_at"
t
.
string
"status_message"
t
.
string
"version"
end
add_index
"geo_node_statuses"
,
[
"geo_node_id"
],
name:
"index_geo_node_statuses_on_geo_node_id"
,
unique:
true
,
using: :btree
...
...
doc/api/geo_nodes.md
View file @
eb880edb
...
...
@@ -98,7 +98,8 @@ Example response:
"cursor_last_event_id"
:
23
,
"cursor_last_event_timestamp"
:
1509681166
,
"last_successful_status_check_timestamp"
:
1510125024
,
"version"
:
"10.3.0"
"version"
:
"10.3.0"
,
"revision"
:
"33d33a096a"
}
]
```
...
...
@@ -138,7 +139,8 @@ Example response:
"cursor_last_event_id"
:
23
,
"cursor_last_event_timestamp"
:
1509681166
,
"last_successful_status_check_timestamp"
:
1510125268
,
"version"
:
"10.3.0"
"version"
:
"10.3.0"
,
"revision"
:
"33d33a096a"
}
```
...
...
spec/factories/geo_node_statuses.rb
View file @
eb880edb
...
...
@@ -2,7 +2,6 @@ FactoryGirl.define do
factory
:geo_node_status
do
sequence
(
:id
)
geo_node
version
{
Gitlab
::
VERSION
}
trait
:healthy
do
health
nil
...
...
spec/fixtures/api/schemas/geo_node_status.json
View file @
eb880edb
...
...
@@ -20,7 +20,8 @@
"cursor_last_event_id"
,
"cursor_last_event_timestamp"
,
"namespaces"
,
"version"
"version"
,
"revision"
],
"properties"
:
{
"geo_node_id"
:
{
"type"
:
"integer"
},
...
...
@@ -46,7 +47,8 @@
"cursor_last_event_timestamp"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"last_successful_status_check_timestamp"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"namespaces"
:
{
"type"
:
"array"
},
"version"
:
{
"type"
:
[
"string"
]
}
"version"
:
{
"type"
:
[
"string"
]
},
"revision"
:
{
"type"
:
[
"string"
]
}
},
"additionalProperties"
:
false
}
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