Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
83ad5fa5
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
83ad5fa5
编写于
1月 12, 2016
作者:
Y
Yorick Peterse
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'remove-application-frames-from-views' into 'master'
See merge request !2392
上级
8f1c46d1
355c341f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
2 addition
and
40 deletion
+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
未找到文件。
lib/gitlab/metrics.rb
浏览文件 @
83ad5fa5
...
...
@@ -36,20 +36,6 @@ module Gitlab
@pool
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
)
prepared
=
prepare_metrics
(
metrics
)
...
...
lib/gitlab/metrics/subscribers/action_view.rb
浏览文件 @
83ad5fa5
...
...
@@ -33,16 +33,8 @@ module Gitlab
def
tags_for
(
event
)
path
=
relative_path
(
event
.
payload
[
:identifier
])
tags
=
{
view:
path
}
file
,
line
=
Metrics
.
last_relative_application_frame
if
file
and
line
tags
[
:file
]
=
file
tags
[
:line
]
=
line
end
tags
{
view:
path
}
end
def
current_transaction
...
...
spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
浏览文件 @
83ad5fa5
...
...
@@ -14,19 +14,12 @@ describe Gitlab::Metrics::Subscribers::ActionView do
before
do
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
describe
'#render_template'
do
it
'tracks rendering of a template'
do
values
=
{
duration:
2.1
}
tags
=
{
view:
'app/views/x.html.haml'
,
file:
'app/views/x.html.haml'
,
line:
4
}
tags
=
{
view:
'app/views/x.html.haml'
}
expect
(
transaction
).
to
receive
(
:increment
).
with
(
:view_duration
,
2.1
)
...
...
spec/lib/gitlab/metrics_spec.rb
浏览文件 @
83ad5fa5
...
...
@@ -13,15 +13,6 @@ describe Gitlab::Metrics do
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
it
'prepares and writes the metrics to InfluxDB'
do
connection
=
double
(
:connection
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录