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
Kazuhiko Shiozaki
gitlab-ce
Commits
bcd2a09d
Commit
bcd2a09d
authored
Jan 06, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'metrics-milliseconds' into 'master'
See merge request !2316
parents
fc386b65
7549102b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
+14
-6
lib/gitlab/metrics/subscribers/action_view.rb
lib/gitlab/metrics/subscribers/action_view.rb
+6
-2
lib/gitlab/metrics/subscribers/active_record.rb
lib/gitlab/metrics/subscribers/active_record.rb
+5
-1
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
+2
-2
spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
+1
-1
No files found.
lib/gitlab/metrics/subscribers/action_view.rb
View file @
bcd2a09d
...
...
@@ -19,7 +19,7 @@ module Gitlab
values
=
values_for
(
event
)
tags
=
tags_for
(
event
)
current_transaction
.
increment
(
:view_duration
,
event
.
duration
)
current_transaction
.
increment
(
:view_duration
,
duration
(
event
)
)
current_transaction
.
add_metric
(
SERIES
,
values
,
tags
)
end
...
...
@@ -28,7 +28,7 @@ module Gitlab
end
def
values_for
(
event
)
{
duration:
event
.
duration
}
{
duration:
duration
(
event
)
}
end
def
tags_for
(
event
)
...
...
@@ -48,6 +48,10 @@ module Gitlab
def
current_transaction
Transaction
.
current
end
def
duration
(
event
)
event
.
duration
*
1000.0
end
end
end
end
...
...
lib/gitlab/metrics/subscribers/active_record.rb
View file @
bcd2a09d
...
...
@@ -8,7 +8,7 @@ module Gitlab
def
sql
(
event
)
return
unless
current_transaction
current_transaction
.
increment
(
:sql_duration
,
event
.
duration
)
current_transaction
.
increment
(
:sql_duration
,
duration
(
event
)
)
end
private
...
...
@@ -16,6 +16,10 @@ module Gitlab
def
current_transaction
Transaction
.
current
end
def
duration
(
event
)
event
.
duration
*
1000.0
end
end
end
end
...
...
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
View file @
bcd2a09d
...
...
@@ -21,7 +21,7 @@ describe Gitlab::Metrics::Subscribers::ActionView do
describe
'#render_template'
do
it
'tracks rendering of a template'
do
values
=
{
duration:
2
.1
}
values
=
{
duration:
2
100
}
tags
=
{
view:
'app/views/x.html.haml'
,
file:
'app/views/x.html.haml'
,
...
...
@@ -29,7 +29,7 @@ describe Gitlab::Metrics::Subscribers::ActionView do
}
expect
(
transaction
).
to
receive
(
:increment
).
with
(
:view_duration
,
2
.1
)
with
(
:view_duration
,
2
100
)
expect
(
transaction
).
to
receive
(
:add_metric
).
with
(
described_class
::
SERIES
,
values
,
tags
)
...
...
spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
View file @
bcd2a09d
...
...
@@ -26,7 +26,7 @@ describe Gitlab::Metrics::Subscribers::ActiveRecord do
and_return
(
transaction
)
expect
(
transaction
).
to
receive
(
:increment
).
with
(
:sql_duration
,
0.2
)
with
(
:sql_duration
,
200
)
subscriber
.
sql
(
event
)
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