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
Jérome Perrin
gitlab-ce
Commits
5e2a748b
Commit
5e2a748b
authored
Oct 18, 2017
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gitaly data to the Peek performance bar
parent
220a5c37
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
0 deletions
+56
-0
app/views/peek/views/_gitaly.html.haml
app/views/peek/views/_gitaly.html.haml
+7
-0
changelogs/unreleased/zj-peek-gitaly.yml
changelogs/unreleased/zj-peek-gitaly.yml
+5
-0
config/initializers/peek.rb
config/initializers/peek.rb
+1
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+9
-0
lib/peek/views/gitaly.rb
lib/peek/views/gitaly.rb
+34
-0
No files found.
app/views/peek/views/_gitaly.html.haml
0 → 100644
View file @
5e2a748b
-
local_assigns
.
fetch
(
:view
)
%strong
%span
{
data:
{
defer_to:
"#{view.defer_key}-duration"
}
}
...
\/
%span
{
data:
{
defer_to:
"#{view.defer_key}-calls"
}
}
...
Gitaly
changelogs/unreleased/zj-peek-gitaly.yml
0 → 100644
View file @
5e2a748b
---
title
:
Add Gitaly metrics to the performance bar
merge_request
:
author
:
type
:
other
config/initializers/peek.rb
View file @
5e2a748b
...
...
@@ -16,6 +16,7 @@ Peek.into Peek::Views::Redis
Peek
.
into
Peek
::
Views
::
Sidekiq
Peek
.
into
Peek
::
Views
::
Rblineprof
Peek
.
into
Peek
::
Views
::
GC
Peek
.
into
Peek
::
Views
::
Gitaly
# rubocop:disable Style/ClassAndModuleCamelCase
class
PEEK_DB_CLIENT
...
...
lib/gitlab/gitaly_client.rb
View file @
5e2a748b
...
...
@@ -33,6 +33,12 @@ module Gitlab
MUTEX
=
Mutex
.
new
private_constant
:MUTEX
class
<<
self
attr_accessor
:query_time
end
self
.
query_time
=
0
def
self
.
stub
(
name
,
storage
)
MUTEX
.
synchronize
do
@stubs
||=
{}
...
...
@@ -83,11 +89,14 @@ module Gitlab
# end
#
def
self
.
call
(
storage
,
service
,
rpc
,
request
)
start
=
Process
.
clock_gettime
(
Process
::
CLOCK_MONOTONIC
)
enforce_gitaly_request_limits
(
:call
)
kwargs
=
request_kwargs
(
storage
)
kwargs
=
yield
(
kwargs
)
if
block_given?
stub
(
service
,
storage
).
__send__
(
rpc
,
request
,
kwargs
)
# rubocop:disable GitlabSecurity/PublicSend
ensure
self
.
query_time
+=
Process
.
clock_gettime
(
Process
::
CLOCK_MONOTONIC
)
-
start
end
def
self
.
request_kwargs
(
storage
)
...
...
lib/peek/views/gitaly.rb
0 → 100644
View file @
5e2a748b
module
Peek
module
Views
class
Gitaly
<
View
def
duration
::
Gitlab
::
GitalyClient
.
query_time
end
def
calls
::
Gitlab
::
GitalyClient
.
get_request_count
end
def
results
{
duration:
formatted_duration
,
calls:
calls
}
end
private
def
formatted_duration
ms
=
duration
*
1000
if
ms
>=
1000
"%.2fms"
%
ms
else
"%.0fms"
%
ms
end
end
def
setup_subscribers
subscribe
'start_processing.action_controller'
do
::
Gitlab
::
GitalyClient
.
query_time
=
0
end
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