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
83ad5fa5
Commit
83ad5fa5
authored
Jan 12, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove-application-frames-from-views' into 'master'
See merge request !2392
parents
8f1c46d1
355c341f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
40 deletions
+2
-40
lib/gitlab/metrics.rb
lib/gitlab/metrics.rb
+0
-14
lib/gitlab/metrics/subscribers/action_view.rb
lib/gitlab/metrics/subscribers/action_view.rb
+1
-9
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
+1
-8
spec/lib/gitlab/metrics_spec.rb
spec/lib/gitlab/metrics_spec.rb
+0
-9
No files found.
lib/gitlab/metrics.rb
View file @
83ad5fa5
...
@@ -36,20 +36,6 @@ module Gitlab
...
@@ -36,20 +36,6 @@ module Gitlab
@pool
@pool
end
end
# Returns a relative path and line number based on the last application call
# frame.
def
self
.
last_relative_application_frame
frame
=
caller_locations
.
find
do
|
l
|
l
.
path
.
start_with?
(
RAILS_ROOT
)
&&
!
l
.
path
.
start_with?
(
METRICS_ROOT
)
end
if
frame
return
frame
.
path
.
sub
(
PATH_REGEX
,
''
),
frame
.
lineno
else
return
nil
,
nil
end
end
def
self
.
submit_metrics
(
metrics
)
def
self
.
submit_metrics
(
metrics
)
prepared
=
prepare_metrics
(
metrics
)
prepared
=
prepare_metrics
(
metrics
)
...
...
lib/gitlab/metrics/subscribers/action_view.rb
View file @
83ad5fa5
...
@@ -33,16 +33,8 @@ module Gitlab
...
@@ -33,16 +33,8 @@ module Gitlab
def
tags_for
(
event
)
def
tags_for
(
event
)
path
=
relative_path
(
event
.
payload
[
:identifier
])
path
=
relative_path
(
event
.
payload
[
:identifier
])
tags
=
{
view:
path
}
file
,
line
=
Metrics
.
last_relative_application_frame
{
view:
path
}
if
file
and
line
tags
[
:file
]
=
file
tags
[
:line
]
=
line
end
tags
end
end
def
current_transaction
def
current_transaction
...
...
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
View file @
83ad5fa5
...
@@ -14,19 +14,12 @@ describe Gitlab::Metrics::Subscribers::ActionView do
...
@@ -14,19 +14,12 @@ describe Gitlab::Metrics::Subscribers::ActionView do
before
do
before
do
allow
(
subscriber
).
to
receive
(
:current_transaction
).
and_return
(
transaction
)
allow
(
subscriber
).
to
receive
(
:current_transaction
).
and_return
(
transaction
)
allow
(
Gitlab
::
Metrics
).
to
receive
(
:last_relative_application_frame
).
and_return
([
'app/views/x.html.haml'
,
4
])
end
end
describe
'#render_template'
do
describe
'#render_template'
do
it
'tracks rendering of a template'
do
it
'tracks rendering of a template'
do
values
=
{
duration:
2.1
}
values
=
{
duration:
2.1
}
tags
=
{
tags
=
{
view:
'app/views/x.html.haml'
}
view:
'app/views/x.html.haml'
,
file:
'app/views/x.html.haml'
,
line:
4
}
expect
(
transaction
).
to
receive
(
:increment
).
expect
(
transaction
).
to
receive
(
:increment
).
with
(
:view_duration
,
2.1
)
with
(
:view_duration
,
2.1
)
...
...
spec/lib/gitlab/metrics_spec.rb
View file @
83ad5fa5
...
@@ -13,15 +13,6 @@ describe Gitlab::Metrics do
...
@@ -13,15 +13,6 @@ describe Gitlab::Metrics do
end
end
end
end
describe
'.last_relative_application_frame'
do
it
'returns an Array containing a file path and line number'
do
file
,
line
=
described_class
.
last_relative_application_frame
expect
(
line
).
to
eq
(
__LINE__
-
2
)
expect
(
file
).
to
eq
(
'spec/lib/gitlab/metrics_spec.rb'
)
end
end
describe
'#submit_metrics'
do
describe
'#submit_metrics'
do
it
'prepares and writes the metrics to InfluxDB'
do
it
'prepares and writes the metrics to InfluxDB'
do
connection
=
double
(
:connection
)
connection
=
double
(
:connection
)
...
...
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