simple_apm 0.1.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/app/assets/javascripts/simple_apm/application.js +0 -24
- data/app/assets/stylesheets/simple_apm/application.css +1 -32
- data/app/views/layouts/simple_apm/application.html.erb +66 -2
- data/app/views/simple_apm/apm/data.html.erb +3 -3
- data/lib/simple_apm.rb +4 -4
- data/lib/simple_apm/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede67114e4bfb1b3d6f62f5b46a132e78c9bb7bd827c7ba8f41eb783993d3fce
|
4
|
+
data.tar.gz: f65dafd04fe955efe84167301f1f82751c57a6821f0d250d9ca439906b9804b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48aa29dbae464fdfb7f51c96d99b666fdfb1751c932ec990a500814e16a0d67362cd7319a102255d3bcffd9c15c51b37fd9019f28ff9b99c6846fbd92bc2bbdf
|
7
|
+
data.tar.gz: b55e72a1f844c6e70c3b3132749e5b17b4c423efdd12bf0da11f85b63aae5baf743a90a542746460eeb45a107f5a0fee8c665d6cbf9398147f62880d4826449e
|
data/README.md
CHANGED
@@ -12,28 +12,4 @@
|
|
12
12
|
//
|
13
13
|
//= require_tree .
|
14
14
|
|
15
|
-
// JqueryDataTable自定义排序方法
|
16
|
-
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
|
17
|
-
"sec-pre": function (a) {
|
18
|
-
var x = String(a).replace(/<[\s\S]*?>/g, ""); //去除html标记
|
19
|
-
x = x.replace(/&nbsp;/ig, ""); //去除空格
|
20
|
-
x = x.replace(/%/, ""); //去除百分号
|
21
|
-
if(x.indexOf('ms')>0){
|
22
|
-
x = x.replace(/ms/, "");
|
23
|
-
return parseFloat(x)/1000;
|
24
|
-
}else if(x.indexOf('min')>0){
|
25
|
-
x = x.replace(/min/, "");
|
26
|
-
return parseFloat(x)*60;
|
27
|
-
}else{
|
28
|
-
x = x.replace(/min/, "");
|
29
|
-
return parseFloat(x)
|
30
|
-
}
|
31
|
-
},
|
32
|
-
"sec-asc": function (a, b) { //正序排序引用方法
|
33
|
-
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
34
|
-
},
|
35
|
-
"sec-desc": function (a, b) { //倒序排序引用方法
|
36
|
-
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
37
|
-
}
|
38
|
-
});
|
39
15
|
|
@@ -12,35 +12,4 @@
|
|
12
12
|
*
|
13
13
|
*= require_tree .
|
14
14
|
*= require_self
|
15
|
-
*/
|
16
|
-
footer{
|
17
|
-
text-align: center;
|
18
|
-
padding: 10px;
|
19
|
-
border-top: 1px solid #999999;
|
20
|
-
}
|
21
|
-
a.navbar-brand.active{
|
22
|
-
color: #00AEEF !important;
|
23
|
-
}
|
24
|
-
#page-container{
|
25
|
-
min-height: 80vh;
|
26
|
-
}
|
27
|
-
.select-apm-date{
|
28
|
-
width: auto;
|
29
|
-
float: right;
|
30
|
-
margin-top: 8px;
|
31
|
-
}
|
32
|
-
.select-apm-date>select{
|
33
|
-
display: inline-block;
|
34
|
-
width: auto;
|
35
|
-
}
|
36
|
-
.sql{
|
37
|
-
max-width: 300px;
|
38
|
-
white-space: nowrap;
|
39
|
-
text-overflow:ellipsis;
|
40
|
-
overflow: hidden;
|
41
|
-
color: #00AEEF;
|
42
|
-
cursor: pointer;
|
43
|
-
}
|
44
|
-
pre {
|
45
|
-
white-space: pre-wrap;
|
46
|
-
}
|
15
|
+
*/
|
@@ -11,8 +11,72 @@
|
|
11
11
|
<script src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
12
12
|
<script src="//cdn.bootcss.com/echarts/4.1.0/echarts.js"></script>
|
13
13
|
<script src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
|
14
|
-
|
15
|
-
|
14
|
+
<style>
|
15
|
+
footer {
|
16
|
+
text-align: center;
|
17
|
+
padding: 10px;
|
18
|
+
border-top: 1px solid #999999;
|
19
|
+
}
|
20
|
+
|
21
|
+
a.navbar-brand.active {
|
22
|
+
color: #00AEEF !important;
|
23
|
+
}
|
24
|
+
|
25
|
+
#page-container {
|
26
|
+
min-height: 80vh;
|
27
|
+
}
|
28
|
+
|
29
|
+
.select-apm-date {
|
30
|
+
width: auto;
|
31
|
+
float: right;
|
32
|
+
margin-top: 8px;
|
33
|
+
}
|
34
|
+
|
35
|
+
.select-apm-date > select {
|
36
|
+
display: inline-block;
|
37
|
+
width: auto;
|
38
|
+
}
|
39
|
+
|
40
|
+
.sql {
|
41
|
+
max-width: 300px;
|
42
|
+
white-space: nowrap;
|
43
|
+
text-overflow: ellipsis;
|
44
|
+
overflow: hidden;
|
45
|
+
color: #00AEEF;
|
46
|
+
cursor: pointer;
|
47
|
+
}
|
48
|
+
|
49
|
+
pre {
|
50
|
+
white-space: pre-wrap;
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
<script type="text/javascript">
|
54
|
+
// JqueryDataTable自定义排序方法
|
55
|
+
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
|
56
|
+
"sec-pre": function (a) {
|
57
|
+
var x = String(a).replace(/<[\s\S]*?>/g, ""); //去除html标记
|
58
|
+
x = x.replace(/&nbsp;/ig, ""); //去除空格
|
59
|
+
x = x.replace(/%/, ""); //去除百分号
|
60
|
+
if (x.indexOf('ms') > 0) {
|
61
|
+
x = x.replace(/ms/, "");
|
62
|
+
return parseFloat(x) / 1000;
|
63
|
+
} else if (x.indexOf('min') > 0) {
|
64
|
+
x = x.replace(/min/, "");
|
65
|
+
return parseFloat(x) * 60;
|
66
|
+
} else {
|
67
|
+
x = x.replace(/min/, "");
|
68
|
+
return parseFloat(x)
|
69
|
+
}
|
70
|
+
},
|
71
|
+
"sec-asc": function (a, b) { //正序排序引用方法
|
72
|
+
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
73
|
+
},
|
74
|
+
"sec-desc": function (a, b) { //倒序排序引用方法
|
75
|
+
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
76
|
+
}
|
77
|
+
});
|
78
|
+
</script>
|
79
|
+
|
16
80
|
<%= csrf_meta_tags %>
|
17
81
|
</head>
|
18
82
|
<body>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<p class="pull-right">
|
2
2
|
<span class="text-danger">删除数据:</span>
|
3
|
-
<%= link_to '保留进一周数据', data_delete_path(type: 'week'), class: 'btn btn-danger', 'data-confirm'
|
4
|
-
<%= link_to '保留进一个月数据', data_delete_path(type: 'month'), class: 'btn btn-danger', 'data-confirm'
|
3
|
+
<%= link_to '保留进一周数据', data_delete_path(type: 'week'), class: 'btn btn-danger', 'data-confirm'=> '确定删除所有一周以前的数据?'%>
|
4
|
+
<%= link_to '保留进一个月数据', data_delete_path(type: 'month'), class: 'btn btn-danger', 'data-confirm'=> '确定删除所有一个月以前的数据?' %>
|
5
5
|
</p>
|
6
6
|
|
7
7
|
<table class="table table-bordered">
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<td><%= d[:day]%></td>
|
21
21
|
<td><%= d[:hits]%></td>
|
22
22
|
<td><%= sec_str d[:avg_time]%></td>
|
23
|
-
<td><%= link_to '删除', data_delete_path(date: d[:day]), 'data-confirm'
|
23
|
+
<td><%= link_to '删除', data_delete_path(date: d[:day]), 'data-confirm'=> '确定删除?' %></td>
|
24
24
|
</tr>
|
25
25
|
<% end %>
|
26
26
|
</tbody>
|
data/lib/simple_apm.rb
CHANGED
@@ -22,7 +22,7 @@ module SimpleApm
|
|
22
22
|
controller: payload[:controller],
|
23
23
|
action: payload[:action],
|
24
24
|
host: Socket.gethostname,
|
25
|
-
remote_addr: payload[:headers]['HTTP_X_REAL_IP'],
|
25
|
+
remote_addr: (payload[:headers]['HTTP_X_REAL_IP'] rescue nil),
|
26
26
|
method: payload[:method],
|
27
27
|
format: payload[:format],
|
28
28
|
exception: payload[:exception].presence.to_json
|
@@ -40,7 +40,7 @@ module SimpleApm
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
rescue => e
|
43
|
-
Logger.new("#{Rails.root}/log/simple_apm.log").info e.backtrace
|
43
|
+
Logger.new("#{Rails.root}/log/simple_apm.log").info e.backtrace.join("\n")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -54,7 +54,7 @@ module SimpleApm
|
|
54
54
|
payload.merge!(:line => c.line, :filename => c.filename.to_s.gsub(Rails.root.to_s, ''), :method => c.method)
|
55
55
|
end
|
56
56
|
# ActiveRecord::Relation::QueryAttribute
|
57
|
-
sql_value = payload[:binds].map {|q| [q.name, q.value]}
|
57
|
+
sql_value = payload[:binds].map {|q| [q.name, q.value]} rescue nil
|
58
58
|
info = {
|
59
59
|
request_id: request_id,
|
60
60
|
name: payload[:name],
|
@@ -68,7 +68,7 @@ module SimpleApm
|
|
68
68
|
SimpleApm::Sql.create request_id, info
|
69
69
|
end
|
70
70
|
rescue => e
|
71
|
-
Logger.new("#{Rails.root}/log/simple_apm.log").info e.backtrace
|
71
|
+
Logger.new("#{Rails.root}/log/simple_apm.log").info e.backtrace.join("\n")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/simple_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yuanyin.xia
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis-namespace
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0.0'
|
55
55
|
description: 'xyy: Simple Apm View for rails using redis.'
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- xiayuanyin@qq.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|