Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
29a1ad16
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,发现更多精彩内容 >>
提交
29a1ad16
编写于
9月 06, 2017
作者:
P
Pawel Chojnacki
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tune bucket sizes an action labels
上级
aa25586a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
19 deletion
+19
-19
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+4
-4
lib/gitlab/metrics/rack_middleware.rb
lib/gitlab/metrics/rack_middleware.rb
+8
-8
lib/gitlab/metrics/subscribers/rails_cache.rb
lib/gitlab/metrics/subscribers/rails_cache.rb
+1
-1
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+6
-6
未找到文件。
lib/gitlab/metrics/method_call.rb
浏览文件 @
29a1ad16
...
...
@@ -9,7 +9,7 @@ module Gitlab
:gitlab_method_call_real_duration_seconds
,
'Method calls real duration'
,
{
action:
nil
,
call_name:
nil
},
[
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
,
100000
0
]
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
1
0
]
)
end
...
...
@@ -18,7 +18,7 @@ module Gitlab
:gitlab_method_call_cpu_duration_seconds
,
'Method calls cpu duration'
,
{
action:
nil
,
call_name:
nil
},
[
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
,
100000
0
]
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
1
0
]
)
end
...
...
@@ -44,8 +44,8 @@ module Gitlab
@call_count
+=
1
if
above_threshold?
self
.
class
.
call_real_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@real_time
)
self
.
class
.
call_cpu_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@cpu_time
)
self
.
class
.
call_real_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@real_time
/
1000.0
)
self
.
class
.
call_cpu_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@cpu_time
/
1000.0
)
end
retval
...
...
lib/gitlab/metrics/rack_middleware.rb
浏览文件 @
29a1ad16
...
...
@@ -35,12 +35,6 @@ module Gitlab
# Even in the event of an error we want to submit any metrics we
# might've gathered up to this point.
ensure
if
env
[
CONTROLLER_KEY
]
tag_controller
(
trans
,
env
)
elsif
env
[
ENDPOINT_KEY
]
tag_endpoint
(
trans
,
env
)
end
trans
.
finish
end
...
...
@@ -50,8 +44,14 @@ module Gitlab
def
transaction_from_env
(
env
)
trans
=
Transaction
.
new
trans
.
set
(
:request_uri
,
filtered_path
(
env
))
trans
.
set
(
:request_method
,
env
[
'REQUEST_METHOD'
])
trans
.
set
(
:request_uri
,
filtered_path
(
env
),
false
)
trans
.
set
(
:request_method
,
env
[
'REQUEST_METHOD'
],
false
)
if
env
[
CONTROLLER_KEY
]
tag_controller
(
trans
,
env
)
elsif
env
[
ENDPOINT_KEY
]
tag_endpoint
(
trans
,
env
)
end
trans
end
...
...
lib/gitlab/metrics/subscribers/rails_cache.rb
浏览文件 @
29a1ad16
...
...
@@ -67,7 +67,7 @@ module Gitlab
def
observe
(
key
,
duration
)
return
unless
current_transaction
metric_cache_duration_seconds
.
observe
({
operation:
key
,
action:
action
},
duration
/
1000.1
)
self
.
class
.
metric_cache_duration_seconds
.
observe
({
operation:
key
,
action:
action
},
duration
/
1000.0
)
current_transaction
.
increment
(
:cache_duration
,
duration
,
false
)
current_transaction
.
increment
(
:cache_count
,
1
,
false
)
current_transaction
.
increment
(
"
#{
key
}
_duration"
.
to_sym
,
duration
,
false
)
...
...
lib/gitlab/metrics/transaction.rb
浏览文件 @
29a1ad16
...
...
@@ -54,7 +54,7 @@ module Gitlab
:gitlab_transaction_allocated_memory_bytes
,
'Transaction allocated memory bytes'
,
{
action:
nil
},
[
500000
,
1000000
,
2000000
,
5000000
,
10000000
,
20000000
,
100000000
]
[
1000
,
10000
,
20000
,
500000
,
1000000
,
2000000
,
5000000
,
10000000
,
20000000
,
100000000
]
)
end
...
...
@@ -70,7 +70,7 @@ module Gitlab
@finished_at
=
System
.
monotonic_time
Transaction
.
metric_transaction_duration_seconds
.
observe
({
action:
action
},
duration
*
1000
)
Transaction
.
metric_transaction_allocated_memory_bytes
.
observe
({
action:
action
},
allocated_memory
/
2
^
2
0
)
Transaction
.
metric_transaction_allocated_memory_bytes
.
observe
({
action:
action
},
allocated_memory
*
1024.
0
)
Thread
.
current
[
THREAD_KEY
]
=
nil
end
...
...
@@ -100,13 +100,13 @@ module Gitlab
method
end
def
increment
(
name
,
value
,
compat
=
true
)
self
.
class
.
metric_transaction_counter
(
name
).
increment
({
action:
action
},
value
)
if
compat
def
increment
(
name
,
value
,
use_prometheus
=
true
)
self
.
class
.
metric_transaction_counter
(
name
).
increment
({
action:
action
},
value
)
if
use_prometheus
@values
[
name
]
+=
value
end
def
set
(
name
,
value
,
compat
=
true
)
self
.
class
.
metric_transaction_gauge
(
name
).
set
({
action:
action
},
value
)
if
compat
def
set
(
name
,
value
,
use_prometheus
=
true
)
self
.
class
.
metric_transaction_gauge
(
name
).
set
({
action:
action
},
value
)
if
use_prometheus
@values
[
name
]
=
value
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录