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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d4d06bde
Commit
d4d06bde
authored
Nov 27, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep track of storage check timings
parent
1eff1bd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
doc/administration/monitoring/prometheus/gitlab_metrics.md
doc/administration/monitoring/prometheus/gitlab_metrics.md
+2
-1
lib/gitlab/git/storage/checker.rb
lib/gitlab/git/storage/checker.rb
+23
-1
No files found.
doc/administration/monitoring/prometheus/gitlab_metrics.md
View file @
d4d06bde
...
@@ -45,8 +45,9 @@ In this experimental phase, only a few metrics are available:
...
@@ -45,8 +45,9 @@ In this experimental phase, only a few metrics are available:
| redis_ping_success | Gauge | 9.4 | Whether or not the last redis ping succeeded |
| redis_ping_success | Gauge | 9.4 | Whether or not the last redis ping succeeded |
| redis_ping_latency_seconds | Gauge | 9.4 | Round trip time of the redis ping |
| redis_ping_latency_seconds | Gauge | 9.4 | Round trip time of the redis ping |
| user_session_logins_total | Counter | 9.4 | Counter of how many users have logged in |
| user_session_logins_total | Counter | 9.4 | Counter of how many users have logged in |
| filesystem_circuitbreaker_latency_seconds |
Histogram | 9.5 | Latency of the stat check the circuitbreaker uses to probe a shard
|
| filesystem_circuitbreaker_latency_seconds |
Gauge | 9.5 | Time spent validating if a storage is accessible
|
| filesystem_circuitbreaker | Gauge | 9.5 | Wether or not the circuit for a certain shard is broken or not |
| filesystem_circuitbreaker | Gauge | 9.5 | Wether or not the circuit for a certain shard is broken or not |
| circuitbreaker_storage_check_duration_seconds | Histogram | 10.3 | Time a single storage probe took |
## Metrics shared directory
## Metrics shared directory
...
...
lib/gitlab/git/storage/checker.rb
View file @
d4d06bde
...
@@ -5,6 +5,8 @@ module Gitlab
...
@@ -5,6 +5,8 @@ module Gitlab
include
CircuitBreakerSettings
include
CircuitBreakerSettings
attr_reader
:storage_path
,
:storage
,
:hostname
,
:logger
attr_reader
:storage_path
,
:storage
,
:hostname
,
:logger
METRICS_MUTEX
=
Mutex
.
new
STORAGE_TIMING_BUCKETS
=
[
0.1
,
0.15
,
0.25
,
0.33
,
0.5
,
1
,
1.5
,
2.5
,
5
,
10
,
15
].
freeze
def
self
.
check_all
(
logger
=
Rails
.
logger
)
def
self
.
check_all
(
logger
=
Rails
.
logger
)
threads
=
Gitlab
.
config
.
repositories
.
storages
.
keys
.
map
do
|
storage_name
|
threads
=
Gitlab
.
config
.
repositories
.
storages
.
keys
.
map
do
|
storage_name
|
...
@@ -19,6 +21,17 @@ module Gitlab
...
@@ -19,6 +21,17 @@ module Gitlab
end
end
end
end
def
self
.
check_histogram
@check_histogram
||=
METRICS_MUTEX
.
synchronize
do
@check_histogram
||
Gitlab
::
Metrics
.
histogram
(
:circuitbreaker_storage_check_duration_seconds
,
'Storage check time in seconds'
,
{},
STORAGE_TIMING_BUCKETS
)
end
end
def
initialize
(
storage
,
logger
=
Rails
.
logger
)
def
initialize
(
storage
,
logger
=
Rails
.
logger
)
@storage
=
storage
@storage
=
storage
config
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
]
config
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
]
...
@@ -45,7 +58,7 @@ module Gitlab
...
@@ -45,7 +58,7 @@ module Gitlab
end
end
def
check
def
check
if
Gitlab
::
Git
::
Storage
::
ForkedStorageCheck
.
storage_available?
(
storage_path
,
storage_timeout
,
access_retries
)
if
perform_access_check
track_storage_accessible
track_storage_accessible
true
true
else
else
...
@@ -57,6 +70,15 @@ module Gitlab
...
@@ -57,6 +70,15 @@ module Gitlab
private
private
def
perform_access_check
start_time
=
Gitlab
::
Metrics
::
System
.
monotonic_time
Gitlab
::
Git
::
Storage
::
ForkedStorageCheck
.
storage_available?
(
storage_path
,
storage_timeout
,
access_retries
)
ensure
execution_time
=
Gitlab
::
Metrics
::
System
.
monotonic_time
-
start_time
self
.
class
.
check_histogram
.
observe
({
storage:
storage
},
execution_time
)
end
def
track_storage_inaccessible
def
track_storage_inaccessible
first_failure
=
current_failure_info
.
first_failure
||
Time
.
now
first_failure
=
current_failure_info
.
first_failure
||
Time
.
now
last_failure
=
Time
.
now
last_failure
=
Time
.
now
...
...
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