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
2a479268
Commit
2a479268
authored
Mar 21, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also log Prometheus metrics from the primary
Closes gitlab-org/gitlab-ee#5373.
parent
be832e63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
ee/app/services/geo/metrics_update_service.rb
ee/app/services/geo/metrics_update_service.rb
+2
-2
ee/changelogs/unreleased/tc-geo-primary-prometheus.yml
ee/changelogs/unreleased/tc-geo-primary-prometheus.yml
+5
-0
ee/spec/services/geo/metrics_update_service_spec.rb
ee/spec/services/geo/metrics_update_service_spec.rb
+23
-4
No files found.
ee/app/services/geo/metrics_update_service.rb
View file @
2a479268
...
@@ -7,9 +7,9 @@ module Geo
...
@@ -7,9 +7,9 @@ module Geo
if
Gitlab
::
Geo
.
primary?
if
Gitlab
::
Geo
.
primary?
fetch_secondary_geo_nodes_metrics
fetch_secondary_geo_nodes_metrics
else
fetch_current_geo_node_metrics
end
end
fetch_current_geo_node_metrics
end
end
private
private
...
...
ee/changelogs/unreleased/tc-geo-primary-prometheus.yml
0 → 100644
View file @
2a479268
---
title
:
Also log Geo Prometheus metrics from primary
merge_request
:
5058
author
:
type
:
added
ee/spec/services/geo/metrics_update_service_spec.rb
View file @
2a479268
...
@@ -49,6 +49,22 @@ describe Geo::MetricsUpdateService, :geo do
...
@@ -49,6 +49,22 @@ describe Geo::MetricsUpdateService, :geo do
}
}
end
end
let
(
:primary_data
)
do
{
success:
true
,
status_message:
nil
,
repositories_count:
10
,
wikis_count:
10
,
lfs_objects_count:
100
,
job_artifacts_count:
100
,
attachments_count:
30
,
last_event_id:
2
,
last_event_date:
event_date
,
event_log_count:
55
,
event_log_max_id:
555
}
end
before
do
before
do
allow
(
Gitlab
::
Metrics
).
to
receive
(
:prometheus_metrics_enabled?
).
and_return
(
true
)
allow
(
Gitlab
::
Metrics
).
to
receive
(
:prometheus_metrics_enabled?
).
and_return
(
true
)
end
end
...
@@ -77,16 +93,19 @@ describe Geo::MetricsUpdateService, :geo do
...
@@ -77,16 +93,19 @@ describe Geo::MetricsUpdateService, :geo do
end
end
it
'attempts to retrieve metrics from all nodes'
do
it
'attempts to retrieve metrics from all nodes'
do
allow
(
GeoNodeStatus
).
to
receive
(
:current_node_status
).
and_return
(
GeoNodeStatus
.
from_json
(
primary_data
.
as_json
))
subject
.
execute
subject
.
execute
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_db_replication_lag_seconds
).
values
.
count
).
to
eq
(
2
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_db_replication_lag_seconds
).
values
.
count
).
to
eq
(
2
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
values
.
count
).
to
eq
(
2
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
values
.
count
).
to
eq
(
3
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
get
({
url:
secondary
.
url
})).
to
eq
(
10
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
get
({
url:
secondary
.
url
})).
to
eq
(
10
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
get
({
url:
secondary
.
url
})).
to
eq
(
10
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
get
({
url:
another_secondary
.
url
})).
to
eq
(
10
)
expect
(
Gitlab
::
Metrics
.
registry
.
get
(
:geo_repositories
).
get
({
url:
primary
.
url
})).
to
eq
(
10
)
end
end
it
'updates the GeoNodeStatus entry'
do
it
'updates the GeoNodeStatus entry'
do
expect
{
subject
.
execute
}.
to
change
{
GeoNodeStatus
.
count
}.
by
(
2
)
expect
{
subject
.
execute
}.
to
change
{
GeoNodeStatus
.
count
}.
by
(
3
)
status
=
secondary
.
status
.
load_data_from_current_node
status
=
secondary
.
status
.
load_data_from_current_node
...
@@ -97,7 +116,7 @@ describe Geo::MetricsUpdateService, :geo do
...
@@ -97,7 +116,7 @@ describe Geo::MetricsUpdateService, :geo do
it
'updates only the active node'
do
it
'updates only the active node'
do
secondary
.
update_attributes
(
enabled:
false
)
secondary
.
update_attributes
(
enabled:
false
)
expect
{
subject
.
execute
}.
to
change
{
GeoNodeStatus
.
count
}.
by
(
1
)
expect
{
subject
.
execute
}.
to
change
{
GeoNodeStatus
.
count
}.
by
(
2
)
expect
(
another_secondary
.
status
).
not_to
be_nil
expect
(
another_secondary
.
status
).
not_to
be_nil
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