Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
gitlab-org
gitlab-exporter
Commits
b2a85958
Commit
b2a85958
authored
Apr 25, 2019
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project_remote_mirror_last_successful_update_time_seconds metric
parent
47d2d9f5
Pipeline
#182289
passed with stage
in 50 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
8 deletions
+14
-8
Gemfile.lock
Gemfile.lock
+1
-1
README.md
README.md
+1
-1
lib/gitlab_monitor/database/remote_mirrors.rb
lib/gitlab_monitor/database/remote_mirrors.rb
+11
-5
lib/gitlab_monitor/version.rb
lib/gitlab_monitor/version.rb
+1
-1
No files found.
Gemfile.lock
View file @
b2a85958
PATH
PATH
remote: .
remote: .
specs:
specs:
gitlab-monitor (3.
6
.0)
gitlab-monitor (3.
7
.0)
connection_pool (~> 2.2.1)
connection_pool (~> 2.2.1)
pg (~> 1.1)
pg (~> 1.1)
quantile (~> 0.2.0)
quantile (~> 0.2.0)
...
...
README.md
View file @
b2a85958
...
@@ -28,7 +28,7 @@ metrics.
...
@@ -28,7 +28,7 @@ metrics.
`gitlab_database_bloat_$type_$key`
with type
`btree`
(index bloat) or
`table`
`gitlab_database_bloat_$type_$key`
with type
`btree`
(index bloat) or
`table`
(table bloat) and keys
`bloat_ratio bloat_size extra_size real_size`
(see below)
(table bloat) and keys
`bloat_ratio bloat_size extra_size real_size`
(see below)
*
[
Remote mirrors
](
lib/gitlab_monitor/database/remote_mirrors.rb
)
--
*
[
Remote mirrors
](
lib/gitlab_monitor/database/remote_mirrors.rb
)
--
`project_remote_mirror_last_successful_update_time_seconds`
`project_remote_mirror_last_successful_update_time_seconds`
,
`project_remote_mirror_last_update_time_seconds`
1.
Git
1.
Git
*
[
git pull/push timings
](
lib/gitlab_monitor/git.rb
)
--
*
[
git pull/push timings
](
lib/gitlab_monitor/git.rb
)
--
`git_pull_time_milliseconds`
,
`git_push_time_milliseconds`
`git_pull_time_milliseconds`
,
`git_push_time_milliseconds`
...
...
lib/gitlab_monitor/database/remote_mirrors.rb
View file @
b2a85958
...
@@ -4,7 +4,9 @@ module GitLab
...
@@ -4,7 +4,9 @@ module GitLab
# A helper class to collect remote mirrors metrics.
# A helper class to collect remote mirrors metrics.
class
RemoteMirrorsCollector
<
Base
class
RemoteMirrorsCollector
<
Base
QUERY
=
<<~
SQL
.
freeze
QUERY
=
<<~
SQL
.
freeze
SELECT project_id, url, EXTRACT(EPOCH FROM last_successful_update_at) AS last_successful_update_at
SELECT project_id, url,
EXTRACT(EPOCH FROM last_successful_update_at) AS last_successful_update_at,
EXTRACT(EPOCH FROM last_update_at) AS last_update_at
FROM remote_mirrors WHERE project_id IN (%s) AND enabled = 't'
FROM remote_mirrors WHERE project_id IN (%s) AND enabled = 't'
SQL
SQL
...
@@ -41,14 +43,18 @@ module GitLab
...
@@ -41,14 +43,18 @@ module GitLab
)
)
end
end
def
probe_db
def
probe_db
# rubocop:disable Metrics/MethodLength
results
=
@collector
.
run
results
=
@collector
.
run
results
.
to_a
.
each
do
|
row
|
results
.
to_a
.
each
do
|
row
|
last_successful_update_at
=
row
.
delete
(
"last_successful_update_at"
).
to_i
@metrics
.
add
(
@metrics
.
add
(
"project_remote_mirror_last_successful_update_time_seconds"
,
"project_remote_mirror_last_successful_update_time_seconds"
,
last_successful_update_at
,
row
[
"last_successful_update_at"
].
to_i
,
project_id:
row
[
"project_id"
],
url:
row
[
"url"
]
)
@metrics
.
add
(
"project_remote_mirror_last_update_time_seconds"
,
row
[
"last_update_at"
].
to_i
,
project_id:
row
[
"project_id"
],
project_id:
row
[
"project_id"
],
url:
row
[
"url"
]
url:
row
[
"url"
]
)
)
...
...
lib/gitlab_monitor/version.rb
View file @
b2a85958
module
GitLab
module
GitLab
module
Monitor
module
Monitor
VERSION
=
"3.
6
.0"
.
freeze
VERSION
=
"3.
7
.0"
.
freeze
end
end
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