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
582447d9
Commit
582447d9
authored
Mar 08, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Capture Gitaly calls that don't go through `migrate`
parent
5bfa93e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+19
-10
lib/peek/views/gitaly.rb
lib/peek/views/gitaly.rb
+4
-3
No files found.
lib/gitlab/gitaly_client.rb
View file @
582447d9
...
...
@@ -119,7 +119,8 @@ module Gitlab
#
def
self
.
call
(
storage
,
service
,
rpc
,
request
,
remote_storage:
nil
,
timeout:
nil
)
start
=
Gitlab
::
Metrics
::
System
.
monotonic_time
@last_request
=
request
.
is_a?
(
Google
::
Protobuf
::
MessageExts
)
?
request
.
to_h
:
nil
request_hash
=
request
.
is_a?
(
Google
::
Protobuf
::
MessageExts
)
?
request
.
to_h
:
{}
@current_call_id
||=
SecureRandom
.
uuid
enforce_gitaly_request_limits
(
:call
)
...
...
@@ -137,6 +138,10 @@ module Gitlab
gitaly_controller_action_duration_seconds
.
observe
(
current_transaction_labels
.
merge
(
gitaly_service:
service
.
to_s
,
rpc:
rpc
.
to_s
),
duration
)
add_call_details
(
id:
@current_call_id
,
feature:
service
,
duration:
duration
,
request:
request_hash
)
@current_call_id
=
nil
end
def
self
.
handle_grpc_unavailable!
(
ex
)
...
...
@@ -254,15 +259,16 @@ module Gitlab
feature_stack
.
unshift
(
feature
)
begin
start
=
Gitlab
::
Metrics
::
System
.
monotonic_time
@current_call_id
=
SecureRandom
.
uuid
call_details
=
{
id:
@current_call_id
}
yield
is_enabled
ensure
total_time
=
Gitlab
::
Metrics
::
System
.
monotonic_time
-
start
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?
add_call_details
(
feature:
feature
,
duration:
total_time
,
request:
is_enabled
?
@last_request
:
{})
add_call_details
(
call_details
.
merge
(
feature:
feature
,
duration:
total_time
))
end
end
end
...
...
@@ -350,16 +356,19 @@ module Gitlab
end
def
self
.
add_call_details
(
details
)
return
unless
RequestStore
.
active?
&&
RequestStore
.
store
[
:peek_enabled
]
id
=
details
.
delete
(
:id
)
return
unless
id
&&
RequestStore
.
active?
&&
RequestStore
.
store
[
:peek_enabled
]
RequestStore
.
store
[
'gitaly_call_details'
]
||=
[]
RequestStore
.
store
[
'gitaly_call_details'
]
<<
details
RequestStore
.
store
[
'gitaly_call_details'
]
||=
{}
RequestStore
.
store
[
'gitaly_call_details'
][
id
]
||=
{}
RequestStore
.
store
[
'gitaly_call_details'
][
id
].
merge!
(
details
)
end
def
self
.
call_details
return
[]
unless
RequestStore
.
active?
&&
RequestStore
.
store
[
:peek_enabled
]
def
self
.
list_
call_details
return
{}
unless
RequestStore
.
active?
&&
RequestStore
.
store
[
:peek_enabled
]
RequestStore
.
store
[
'gitaly_call_details'
]
||
[]
RequestStore
.
store
[
'gitaly_call_details'
]
||
{}
end
def
self
.
expected_server_version
...
...
lib/peek/views/gitaly.rb
View file @
582447d9
...
...
@@ -20,16 +20,17 @@ module Peek
private
def
details
::
Gitlab
::
GitalyClient
.
call_details
::
Gitlab
::
GitalyClient
.
list_call_details
.
values
.
sort
{
|
a
,
b
|
b
[
:duration
]
<=>
a
[
:duration
]
}
.
map
(
&
method
(
:format_call_details
))
end
def
format_call_details
(
call
)
pretty_request
=
call
[
:request
].
reject
{
|
k
,
v
|
v
.
blank?
}.
to_h
.
pretty_inspect
pretty_request
=
call
[
:request
]
&
.
reject
{
|
k
,
v
|
v
.
blank?
}.
to_h
.
pretty_inspect
call
.
merge
(
duration:
(
call
[
:duration
]
*
1000
).
round
(
3
),
request:
pretty_request
)
request:
pretty_request
||
{}
)
end
def
formatted_duration
...
...
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