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
6ff9f028
Commit
6ff9f028
authored
Jan 18, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate and reduce the buckets of Gitaly metrics
/cc @bjk-gitlab /cc @zj
parent
67fcd061
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
25 deletions
+12
-25
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+9
-24
lib/gitlab/metrics/concern/metric_options.rb
lib/gitlab/metrics/concern/metric_options.rb
+3
-1
No files found.
lib/gitlab/gitaly_client.rb
View file @
6ff9f028
...
...
@@ -6,6 +6,7 @@ require 'grpc/health/v1/health_services_pb'
module
Gitlab
module
GitalyClient
include
Gitlab
::
Metrics
::
Concern
module
MigrationStatus
DISABLED
=
1
OPT_IN
=
2
...
...
@@ -33,8 +34,6 @@ module Gitlab
CLIENT_NAME
=
(
Sidekiq
.
server?
?
'gitlab-sidekiq'
:
'gitlab-web'
).
freeze
MUTEX
=
Mutex
.
new
METRICS_MUTEX
=
Mutex
.
new
private_constant
:MUTEX
,
:METRICS_MUTEX
class
<<
self
attr_accessor
:query_time
...
...
@@ -42,28 +41,14 @@ module Gitlab
self
.
query_time
=
0
def
self
.
migrate_histogram
@migrate_histogram
||=
METRICS_MUTEX
.
synchronize
do
# If a thread was blocked on the mutex, the value was set already
return
@migrate_histogram
if
@migrate_histogram
Gitlab
::
Metrics
.
histogram
(
:gitaly_migrate_call_duration_seconds
,
"Gitaly migration call execution timings"
,
gitaly_enabled:
nil
,
feature:
nil
)
end
define_histogram
:gitaly_migrate_call_duration_seconds
do
docstring
"Gitaly migration call execution timings"
base_labels
gitaly_enabled:
nil
,
feature:
nil
end
def
self
.
gitaly_call_histogram
@gitaly_call_histogram
||=
METRICS_MUTEX
.
synchronize
do
# If a thread was blocked on the mutex, the value was set already
return
@gitaly_call_histogram
if
@gitaly_call_histogram
Gitlab
::
Metrics
.
histogram
(
:gitaly_controller_action_duration_seconds
,
"Gitaly endpoint histogram by controller and action combination"
,
Gitlab
::
Metrics
::
Transaction
::
BASE_LABELS
.
merge
(
gitaly_service:
nil
,
rpc:
nil
))
end
define_histogram
:gitaly_controller_action_duration_seconds
do
docstring
"Gitaly endpoint histogram by controller and action combination"
base_labels
Gitlab
::
Metrics
::
Transaction
::
BASE_LABELS
.
merge
(
gitaly_service:
nil
,
rpc:
nil
)
end
def
self
.
stub
(
name
,
storage
)
...
...
@@ -145,7 +130,7 @@ module Gitlab
# Keep track, seperately, for the performance bar
self
.
query_time
+=
duration
gitaly_c
all_histogram
.
observe
(
gitaly_c
ontroller_action_duration_seconds
.
observe
(
current_transaction_labels
.
merge
(
gitaly_service:
service
.
to_s
,
rpc:
rpc
.
to_s
),
duration
)
end
...
...
@@ -247,7 +232,7 @@ module Gitlab
yield
is_enabled
ensure
total_time
=
Gitlab
::
Metrics
::
System
.
monotonic_time
-
start
migrate_histogram
.
observe
({
gitaly_enabled:
is_enabled
,
feature:
feature
},
total_time
)
gitaly_migrate_call_duration_seconds
.
observe
({
gitaly_enabled:
is_enabled
,
feature:
feature
},
total_time
)
feature_stack
.
shift
Thread
.
current
[
:gitaly_feature_stack
]
=
nil
if
feature_stack
.
empty?
end
...
...
lib/gitlab/metrics/concern/metric_options.rb
View file @
6ff9f028
...
...
@@ -2,9 +2,11 @@ module Gitlab
module
Metrics
module
Concern
class
MetricOptions
SMALL_NETWORK_BUCKETS
=
[
0.005
,
0.01
,
0.1
,
1
,
10
].
freeze
def
initialize
(
options
=
{})
@multiprocess_mode
=
options
[
:multiprocess_mode
]
||
:all
@buckets
=
options
[
:buckets
]
||
::
Prometheus
::
Client
::
Histogram
::
DEFAULT
_BUCKETS
@buckets
=
options
[
:buckets
]
||
SMALL_NETWORK
_BUCKETS
@base_labels
=
options
[
:base_labels
]
||
{}
@docstring
=
options
[
:docstring
]
@with_feature
=
options
[
:with_feature
]
...
...
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