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
493221ef
Commit
493221ef
authored
Jul 31, 2019
by
Valery Sizov
Committed by
Douglas Barbosa Alexandre
Aug 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo Node status for container repositories
We need to show the status of container sync
parent
82d5bb43
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
208 additions
and
12 deletions
+208
-12
db/migrate/20190612111201_add_geo_container_repository_counters.rb
...e/20190612111201_add_geo_container_repository_counters.rb
+14
-0
db/schema.rb
db/schema.rb
+4
-0
doc/api/geo_nodes.md
doc/api/geo_nodes.md
+12
-0
ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_sync.vue
...onents/node_detail_sections/node_details_section_sync.vue
+5
-0
ee/app/assets/javascripts/geo_nodes/store/geo_nodes_store.js
ee/app/assets/javascripts/geo_nodes/store/geo_nodes_store.js
+5
-0
ee/app/models/geo_node_status.rb
ee/app/models/geo_node_status.rb
+42
-12
ee/changelogs/unreleased/docker_image_replication_node_status.yml
...elogs/unreleased/docker_image_replication_node_status.yml
+5
-0
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+7
-0
ee/lib/tasks/geo.rake
ee/lib/tasks/geo.rake
+7
-0
ee/spec/factories/geo_node_statuses.rb
ee/spec/factories/geo_node_statuses.rb
+3
-0
ee/spec/fixtures/api/schemas/public_api/v4/geo_node_status.json
...c/fixtures/api/schemas/public_api/v4/geo_node_status.json
+7
-0
ee/spec/javascripts/geo_nodes/mock_data.js
ee/spec/javascripts/geo_nodes/mock_data.js
+9
-0
ee/spec/lib/ee/api/entities/geo_node_status_spec.rb
ee/spec/lib/ee/api/entities/geo_node_status_spec.rb
+12
-0
ee/spec/models/geo_node_status_spec.rb
ee/spec/models/geo_node_status_spec.rb
+66
-0
ee/spec/requests/api/geo_spec.rb
ee/spec/requests/api/geo_spec.rb
+3
-0
ee/spec/services/geo/metrics_update_service_spec.rb
ee/spec/services/geo/metrics_update_service_spec.rb
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
db/migrate/20190612111201_add_geo_container_repository_counters.rb
0 → 100644
View file @
493221ef
# frozen_string_literal: true
class
AddGeoContainerRepositoryCounters
<
ActiveRecord
::
Migration
[
5.1
]
DOWNTIME
=
false
def
change
change_table
:geo_node_statuses
do
|
t
|
t
.
column
:container_repositories_count
,
:integer
t
.
column
:container_repositories_synced_count
,
:integer
t
.
column
:container_repositories_failed_count
,
:integer
t
.
column
:container_repositories_registry_count
,
:integer
end
end
end
db/schema.rb
View file @
493221ef
...
...
@@ -1429,6 +1429,10 @@ ActiveRecord::Schema.define(version: 2019_08_02_235445) do
t
.
integer
"repositories_retrying_verification_count"
t
.
integer
"wikis_retrying_verification_count"
t
.
integer
"projects_count"
t
.
integer
"container_repositories_count"
t
.
integer
"container_repositories_synced_count"
t
.
integer
"container_repositories_failed_count"
t
.
integer
"container_repositories_registry_count"
t
.
index
[
"geo_node_id"
],
name:
"index_geo_node_statuses_on_geo_node_id"
,
unique:
true
end
...
...
doc/api/geo_nodes.md
View file @
493221ef
...
...
@@ -192,6 +192,10 @@ Example response:
"job_artifacts_failed_count"
:
nil
,
"job_artifacts_synced_missing_on_primary_count"
:
0
,
"job_artifacts_synced_in_percentage"
:
"0.00%"
,
"container_repositories_count"
:
3
,
"container_repositories_synced_count"
:
nil
,
"container_repositories_failed_count"
:
nil
,
"container_repositories_synced_in_percentage"
:
"0.00%"
,
"projects_count"
:
41
,
"repositories_failed_count"
:
nil
,
"repositories_synced_count"
:
nil
,
...
...
@@ -255,6 +259,10 @@ Example response:
"job_artifacts_failed_count"
:
1
,
"job_artifacts_synced_missing_on_primary_count"
:
0
,
"job_artifacts_synced_in_percentage"
:
"50.00%"
,
"container_repositories_count"
:
3
,
"container_repositories_synced_count"
:
nil
,
"container_repositories_failed_count"
:
nil
,
"container_repositories_synced_in_percentage"
:
"0.00%"
,
"projects_count"
:
41
,
"repositories_failed_count"
:
1
,
"repositories_synced_count"
:
40
,
...
...
@@ -334,6 +342,10 @@ Example response:
"job_artifacts_failed_count"
:
1
,
"job_artifacts_synced_missing_on_primary_count"
:
0
,
"job_artifacts_synced_in_percentage"
:
"50.00%"
,
"container_repositories_count"
:
3
,
"container_repositories_synced_count"
:
nil
,
"container_repositories_failed_count"
:
nil
,
"container_repositories_synced_in_percentage"
:
"0.00%"
,
"projects_count"
:
41
,
"repositories_failed_count"
:
1
,
"repositories_synced_count"
:
40
,
...
...
ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_sync.vue
View file @
493221ef
...
...
@@ -56,6 +56,11 @@ export default {
itemValue
:
this
.
nodeDetails
.
jobArtifacts
,
itemValueType
:
VALUE_TYPE
.
GRAPH
,
},
{
itemTitle
:
s__
(
'
GeoNodes|Local container repositories
'
),
itemValue
:
this
.
nodeDetails
.
containerRepositories
,
itemValueType
:
VALUE_TYPE
.
GRAPH
,
},
{
itemTitle
:
s__
(
'
GeoNodes|Data replication lag
'
),
itemValue
:
this
.
dbReplicationLag
(),
...
...
ee/app/assets/javascripts/geo_nodes/store/geo_nodes_store.js
View file @
493221ef
...
...
@@ -119,6 +119,11 @@ export default class GeoNodesStore {
successCount
:
rawNodeDetails
.
job_artifacts_synced_count
||
0
,
failureCount
:
rawNodeDetails
.
job_artifacts_failed_count
||
0
,
},
containerRepositories
:
{
totalCount
:
rawNodeDetails
.
container_repositories_count
||
0
,
successCount
:
rawNodeDetails
.
container_repositories_synced_count
||
0
,
failureCount
:
rawNodeDetails
.
container_repositories_failed_count
||
0
,
},
attachments
:
{
totalCount
:
rawNodeDetails
.
attachments_count
||
0
,
successCount
:
rawNodeDetails
.
attachments_synced_count
||
0
,
...
...
ee/app/models/geo_node_status.rb
View file @
493221ef
...
...
@@ -87,7 +87,11 @@ class GeoNodeStatus < ApplicationRecord
repositories_checked_count:
'Number of repositories checked'
,
repositories_checked_failed_count:
'Number of failed repositories checked'
,
repositories_retrying_verification_count:
'Number of repositories verification failures that Geo is actively trying to correct on secondary'
,
wikis_retrying_verification_count:
'Number of wikis verification failures that Geo is actively trying to correct on secondary'
wikis_retrying_verification_count:
'Number of wikis verification failures that Geo is actively trying to correct on secondary'
,
container_repositories_count:
'Total number of syncable container repositories available on primary'
,
container_repositories_synced_count:
'Number of syncable container repositories synced on secondary'
,
container_repositories_failed_count:
'Number of syncable container repositories failed to sync on secondary'
,
container_repositories_registry_count:
'Number of container repositories in the registry'
}.
freeze
EXPIRATION_IN_MINUTES
=
5
...
...
@@ -224,17 +228,18 @@ class GeoNodeStatus < ApplicationRecord
end
end
attr_in_percentage
:repositories_synced
,
:repositories_synced_count
,
:repositories_count
attr_in_percentage
:repositories_checksummed
,
:repositories_checksummed_count
,
:repositories_count
attr_in_percentage
:repositories_verified
,
:repositories_verified_count
,
:repositories_count
attr_in_percentage
:repositories_checked
,
:repositories_checked_count
,
:repositories_count
attr_in_percentage
:wikis_synced
,
:wikis_synced_count
,
:wikis_count
attr_in_percentage
:wikis_checksummed
,
:wikis_checksummed_count
,
:wikis_count
attr_in_percentage
:wikis_verified
,
:wikis_verified_count
,
:wikis_count
attr_in_percentage
:lfs_objects_synced
,
:lfs_objects_synced_count
,
:lfs_objects_count
attr_in_percentage
:job_artifacts_synced
,
:job_artifacts_synced_count
,
:job_artifacts_count
attr_in_percentage
:attachments_synced
,
:attachments_synced_count
,
:attachments_count
attr_in_percentage
:replication_slots_used
,
:replication_slots_used_count
,
:replication_slots_count
attr_in_percentage
:repositories_synced
,
:repositories_synced_count
,
:repositories_count
attr_in_percentage
:repositories_checksummed
,
:repositories_checksummed_count
,
:repositories_count
attr_in_percentage
:repositories_verified
,
:repositories_verified_count
,
:repositories_count
attr_in_percentage
:repositories_checked
,
:repositories_checked_count
,
:repositories_count
attr_in_percentage
:wikis_synced
,
:wikis_synced_count
,
:wikis_count
attr_in_percentage
:wikis_checksummed
,
:wikis_checksummed_count
,
:wikis_count
attr_in_percentage
:wikis_verified
,
:wikis_verified_count
,
:wikis_count
attr_in_percentage
:lfs_objects_synced
,
:lfs_objects_synced_count
,
:lfs_objects_count
attr_in_percentage
:job_artifacts_synced
,
:job_artifacts_synced_count
,
:job_artifacts_count
attr_in_percentage
:attachments_synced
,
:attachments_synced_count
,
:attachments_count
attr_in_percentage
:replication_slots_used
,
:replication_slots_used_count
,
:replication_slots_count
attr_in_percentage
:container_repositories_synced
,
:container_repositories_synced_count
,
:container_repositories_count
def
storage_shards_match?
return
true
if
geo_node
.
primary?
...
...
@@ -293,16 +298,30 @@ class GeoNodeStatus < ApplicationRecord
self
.
repositories_failed_count
=
registries_for_failed_projects
(
:repository
).
count
self
.
wikis_synced_count
=
registries_for_synced_projects
(
:wiki
).
count
self
.
wikis_failed_count
=
registries_for_failed_projects
(
:wiki
).
count
load_lfs_objects_data
load_job_artifacts_data
load_attachments_data
load_container_registry_data
end
def
load_lfs_objects_data
self
.
lfs_objects_count
=
lfs_objects_finder
.
count_syncable
self
.
lfs_objects_synced_count
=
lfs_objects_finder
.
count_synced
self
.
lfs_objects_failed_count
=
lfs_objects_finder
.
count_failed
self
.
lfs_objects_registry_count
=
lfs_objects_finder
.
count_registry
self
.
lfs_objects_synced_missing_on_primary_count
=
lfs_objects_finder
.
count_synced_missing_on_primary
end
def
load_job_artifacts_data
self
.
job_artifacts_count
=
job_artifacts_finder
.
count_syncable
self
.
job_artifacts_synced_count
=
job_artifacts_finder
.
count_synced
self
.
job_artifacts_failed_count
=
job_artifacts_finder
.
count_failed
self
.
job_artifacts_registry_count
=
job_artifacts_finder
.
count_registry
self
.
job_artifacts_synced_missing_on_primary_count
=
job_artifacts_finder
.
count_synced_missing_on_primary
end
def
load_attachments_data
self
.
attachments_count
=
attachments_finder
.
count_syncable
self
.
attachments_synced_count
=
attachments_finder
.
count_synced
self
.
attachments_failed_count
=
attachments_finder
.
count_failed
...
...
@@ -310,6 +329,13 @@ class GeoNodeStatus < ApplicationRecord
self
.
attachments_synced_missing_on_primary_count
=
attachments_finder
.
count_synced_missing_on_primary
end
def
load_container_registry_data
self
.
container_repositories_count
=
container_repository_finder
.
count_syncable
self
.
container_repositories_synced_count
=
container_repository_finder
.
count_synced
self
.
container_repositories_failed_count
=
container_repository_finder
.
count_failed
self
.
container_repositories_registry_count
=
container_repository_finder
.
count_registry
end
def
load_repository_check_data
if
Gitlab
::
Geo
.
primary?
self
.
repositories_checked_count
=
Project
.
where
.
not
(
last_repository_check_at:
nil
).
count
...
...
@@ -356,6 +382,10 @@ class GeoNodeStatus < ApplicationRecord
@job_artifacts_finder
||=
Geo
::
JobArtifactRegistryFinder
.
new
(
current_node_id:
geo_node
.
id
)
end
def
container_repository_finder
@container_repository_finder
||=
Geo
::
ContainerRepositoryRegistryFinder
.
new
(
current_node_id:
geo_node
.
id
)
end
def
registries_for_synced_projects
(
type
)
Geo
::
ProjectRegistrySyncedFinder
.
new
(
current_node:
geo_node
,
type:
type
)
...
...
ee/changelogs/unreleased/docker_image_replication_node_status.yml
0 → 100644
View file @
493221ef
---
title
:
Add counter columns to geo_node_statuses database table
merge_request
:
14943
author
:
type
:
other
ee/lib/ee/api/entities.rb
View file @
493221ef
...
...
@@ -564,6 +564,13 @@ module EE
number_to_percentage
(
node
.
job_artifacts_synced_in_percentage
,
precision:
2
)
end
expose
:container_repositories_count
expose
:container_repositories_synced_count
expose
:container_repositories_failed_count
expose
:container_repositories_synced_in_percentage
do
|
node
|
number_to_percentage
(
node
.
container_repositories_synced_in_percentage
,
precision:
2
)
end
expose
:projects_count
expose
:repositories_failed_count
...
...
ee/lib/tasks/geo.rake
View file @
493221ef
...
...
@@ -292,6 +292,13 @@ namespace :geo do
print
"
#{
current_node_status
.
job_artifacts_synced_count
}
/
#{
current_node_status
.
job_artifacts_count
}
"
puts
using_percentage
(
current_node_status
.
job_artifacts_synced_in_percentage
)
if
Gitlab
.
config
.
geo
.
registry_replication
.
enabled
print
'Container repositories: '
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
show_failed_value
(
current_node_status
.
container_repositories_failed_count
)
print
"
#{
current_node_status
.
container_repositories_synced_count
||
0
}
/
#{
current_node_status
.
container_repositories_count
||
0
}
"
puts
using_percentage
(
current_node_status
.
container_repositories_synced_in_percentage
)
end
if
Gitlab
::
CurrentSettings
.
repository_checks_enabled
print
'Repositories Checked: '
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
show_failed_value
(
current_node_status
.
repositories_checked_failed_count
)
...
...
ee/spec/factories/geo_node_statuses.rb
View file @
493221ef
...
...
@@ -17,6 +17,9 @@ FactoryBot.define do
job_artifacts_failed_count
3
job_artifacts_synced_count
577
job_artifacts_synced_missing_on_primary_count
91
container_repositories_count
400
container_repositories_failed_count
3
container_repositories_synced_count
200
projects_count
10
repositories_synced_count
5
repositories_failed_count
0
...
...
ee/spec/fixtures/api/schemas/public_api/v4/geo_node_status.json
View file @
493221ef
...
...
@@ -19,6 +19,9 @@
"job_artifacts_synced_count"
,
"job_artifacts_synced_missing_on_primary_count"
,
"db_replication_lag_seconds"
,
"container_repositories_count"
,
"container_repositories_failed_count"
,
"container_repositories_synced_count"
,
"projects_count"
,
"repositories_failed_count"
,
"repositories_synced_count"
,
...
...
@@ -81,6 +84,10 @@
"job_artifacts_synced_count"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"job_artifacts_synced_missing_on_primary_count"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"job_artifacts_synced_in_percentage"
:
{
"type"
:
"string"
},
"container_repositories_count"
:
{
"type"
:
"integer"
},
"container_repositories_failed_count"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"container_repositories_synced_count"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"container_repositories_synced_in_percentage"
:
{
"type"
:
"string"
},
"projects_count"
:
{
"type"
:
"integer"
},
"repositories_failed_count"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"repository_verification_enabled"
:
{
"type"
:
"boolean"
},
...
...
ee/spec/javascripts/geo_nodes/mock_data.js
View file @
493221ef
...
...
@@ -74,6 +74,10 @@ export const rawMockNodeDetails = {
job_artifacts_synced_count
:
0
,
job_artifacts_failed_count
:
0
,
job_artifacts_synced_in_percentage
:
'
0.00%
'
,
container_repositories_count
:
0
,
container_repositories_synced_count
:
0
,
container_repositories_failed_count
:
0
,
container_repositories_synced_in_percentage
:
'
0.00%
'
,
repositories_failed_count
:
0
,
repositories_synced_count
:
12
,
repositories_synced_in_percentage
:
'
100.00%
'
,
...
...
@@ -179,6 +183,11 @@ export const mockNodeDetails = {
successCount
:
0
,
failureCount
:
0
,
},
containerRepositories
:
{
totalCount
:
0
,
successCount
:
0
,
failureCount
:
0
,
},
attachments
:
{
totalCount
:
0
,
successCount
:
0
,
...
...
ee/spec/lib/ee/api/entities/geo_node_status_spec.rb
View file @
493221ef
...
...
@@ -83,6 +83,18 @@ describe EE::API::Entities::GeoNodeStatus do
end
end
describe
'#container_repositories_synced_in_percentage'
do
it
'formats as percentage'
do
geo_node_status
.
assign_attributes
(
container_repositories_count:
256
,
container_repositories_failed_count:
12
,
container_repositories_synced_count:
123
)
expect
(
subject
[
:container_repositories_synced_in_percentage
]).
to
eq
'48.05%'
end
end
describe
'#repositories_synced_in_percentage'
do
it
'formats as percentage'
do
geo_node_status
.
assign_attributes
(
projects_count:
10
,
...
...
ee/spec/models/geo_node_status_spec.rb
View file @
493221ef
...
...
@@ -637,6 +637,72 @@ describe GeoNodeStatus, :geo, :geo_fdw do
end
end
describe
'#container_repositories_count'
do
it
'counts all the repositories'
do
create
(
:container_repository
)
create
(
:container_repository
)
expect
(
subject
.
container_repositories_count
).
to
eq
(
2
)
end
end
describe
'#container_repositories_synced_count'
do
it
'counts synced repositories'
do
create
(
:container_repository_registry
,
:synced
)
create
(
:container_repository_registry
,
:synced
)
create
(
:container_repository_registry
,
:sync_failed
)
expect
(
subject
.
container_repositories_synced_count
).
to
eq
(
2
)
end
end
describe
'#container_repositories_failed_count'
do
it
'counts failed to sync repositories'
do
create
(
:container_repository_registry
,
:synced
)
create
(
:container_repository_registry
,
:sync_failed
)
create
(
:container_repository_registry
,
:sync_failed
)
expect
(
subject
.
container_repositories_failed_count
).
to
eq
(
2
)
end
end
describe
'#container_repositories_registry_count'
do
it
'counts number of registries for repositories'
do
create
(
:container_repository_registry
,
:synced
)
create
(
:container_repository_registry
,
:sync_failed
)
create
(
:container_repository_registry
,
:sync_failed
)
create
(
:container_repository
)
expect
(
subject
.
container_repositories_registry_count
).
to
eq
(
3
)
end
end
describe
'#container_repositories_synced_in_percentage'
do
let
(
:container_repository
)
{
create
(
:container_repository
,
project:
project_1
)
}
before
do
create
(
:container_repository
,
project:
project_1
)
create_list
(
:container_repository
,
2
,
project:
project_3
)
end
it
'returns 0 when no objects are available'
do
expect
(
subject
.
container_repositories_synced_in_percentage
).
to
eq
(
0
)
end
it
'returns the right percentage with no group restrictions'
do
create
(
:container_repository_registry
,
:synced
,
container_repository:
container_repository
)
expect
(
subject
.
container_repositories_synced_in_percentage
).
to
be_within
(
0.0001
).
of
(
25
)
end
it
'returns the right percentage with group restrictions'
do
secondary
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
group
])
create
(
:container_repository_registry
,
:synced
,
container_repository:
container_repository
)
expect
(
subject
.
container_repositories_synced_in_percentage
).
to
be_within
(
0.0001
).
of
(
50
)
end
end
describe
'#repositories_verified_count'
do
before
do
stub_current_geo_node
(
secondary
)
...
...
ee/spec/requests/api/geo_spec.rb
View file @
493221ef
...
...
@@ -265,6 +265,9 @@ describe API::Geo do
job_artifacts_synced_count:
50
,
job_artifacts_failed_count:
12
,
job_artifacts_synced_missing_on_primary_count:
5
,
container_repositories_count:
100
,
container_repositories_synced_count:
50
,
container_repositories_failed_count:
12
,
attachments_count:
30
,
attachments_synced_count:
30
,
attachments_failed_count:
25
,
...
...
ee/spec/services/geo/metrics_update_service_spec.rb
View file @
493221ef
...
...
@@ -28,6 +28,9 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
job_artifacts_synced_count:
50
,
job_artifacts_failed_count:
12
,
job_artifacts_synced_missing_on_primary_count:
5
,
container_repositories_count:
100
,
container_repositories_synced_count:
50
,
container_repositories_failed_count:
12
,
attachments_count:
30
,
attachments_synced_count:
30
,
attachments_failed_count:
25
,
...
...
@@ -56,6 +59,7 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
lfs_objects_count:
100
,
job_artifacts_count:
100
,
attachments_count:
30
,
container_repositories_count:
100
,
last_event_id:
2
,
last_event_date:
event_date
,
event_log_max_id:
555
...
...
locale/gitlab.pot
View file @
493221ef
...
...
@@ -6604,6 +6604,9 @@ msgstr ""
msgid "GeoNodes|Local attachments"
msgstr ""
msgid "GeoNodes|Local container repositories"
msgstr ""
msgid "GeoNodes|Local job artifacts"
msgstr ""
...
...
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