simple_apm 1.0.14 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +39 -31
- data/Rakefile +0 -5
- data/app/assets/stylesheets/simple_apm/application.css +611 -1
- data/app/controllers/simple_apm/apm_controller.rb +12 -6
- data/app/controllers/simple_apm/application_controller.rb +15 -1
- data/app/models/simple_apm/action.rb +20 -1
- data/app/models/simple_apm/request.rb +1 -0
- data/app/views/layouts/simple_apm/application.html.erb +57 -65
- data/app/views/simple_apm/apm/action_info.html.erb +72 -47
- data/app/views/simple_apm/apm/actions.html.erb +49 -26
- data/app/views/simple_apm/apm/dashboard.html.erb +100 -14
- data/app/views/simple_apm/apm/data.html.erb +69 -32
- data/app/views/simple_apm/apm/index.html.erb +35 -21
- data/app/views/simple_apm/apm/show.html.erb +132 -82
- data/config/locales/simple_apm.en.yml +131 -0
- data/config/locales/simple_apm.zh-CN.yml +131 -0
- data/config/routes.rb +1 -0
- data/lib/simple_apm/redis.rb +2 -2
- data/lib/simple_apm/setting.rb +11 -1
- data/lib/simple_apm/version.rb +1 -1
- data/lib/simple_apm/worker.rb +3 -1
- data/lib/simple_apm.rb +12 -9
- metadata +39 -13
|
@@ -1,24 +1,38 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
<div class="apm-page-header">
|
|
2
|
+
<div>
|
|
3
|
+
<h1 class="apm-page-title"><%= t("simple_apm.index.title") %></h1>
|
|
4
|
+
<p class="apm-page-subtitle"><%= t("simple_apm.index.subtitle") %></p>
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<section class="apm-panel">
|
|
9
|
+
<div class="apm-panel-header">
|
|
10
|
+
<div>
|
|
11
|
+
<h2 class="apm-panel-title"><%= t("simple_apm.index.samples_title") %></h2>
|
|
12
|
+
<p class="apm-panel-subtitle"><%= t("simple_apm.index.samples_subtitle") %></p>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="apm-panel-body">
|
|
16
|
+
<div class="apm-table-wrap">
|
|
17
|
+
<table id="slow-requests" class="table">
|
|
18
|
+
<thead>
|
|
19
|
+
<tr>
|
|
20
|
+
<th><%= t("simple_apm.index.request_time") %></th>
|
|
21
|
+
<th><%= t("simple_apm.index.action_name") %></th>
|
|
22
|
+
<th><%= t("simple_apm.index.total_time") %></th>
|
|
23
|
+
<th><%= t("simple_apm.common.db") %></th>
|
|
24
|
+
<th><%= t("simple_apm.common.sql") %></th>
|
|
25
|
+
<th><%= t("simple_apm.common.view") %></th>
|
|
26
|
+
<th><%= t("simple_apm.common.http") %></th>
|
|
27
|
+
<th><%= t("simple_apm.index.memory_mb") %></th>
|
|
28
|
+
<th><%= t("simple_apm.common.server") %></th>
|
|
29
|
+
<th><%= t("simple_apm.index.ip") %></th>
|
|
30
|
+
</tr>
|
|
31
|
+
</thead>
|
|
32
|
+
</table>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</section>
|
|
22
36
|
|
|
23
37
|
<script type="text/javascript">
|
|
24
38
|
$(document).ready(function () {
|
|
@@ -1,90 +1,140 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<p>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
<div class="apm-page-header">
|
|
2
|
+
<div>
|
|
3
|
+
<h1 class="apm-page-title"><%= t("simple_apm.show.title") %></h1>
|
|
4
|
+
<p class="apm-page-subtitle"><%= @request.action_name %>.<%= @request.format %>(<%= @request.method %>)</p>
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="apm-metrics">
|
|
9
|
+
<div class="apm-stat">
|
|
10
|
+
<p class="apm-stat-label"><%= t("simple_apm.common.total") %></p>
|
|
11
|
+
<div class="apm-stat-value"><%= sec_str @request.during %></div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="apm-stat">
|
|
14
|
+
<p class="apm-stat-label"><%= t("simple_apm.common.db") %></p>
|
|
15
|
+
<div class="apm-stat-value"><%= sec_str @request.db_runtime %></div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="apm-stat">
|
|
18
|
+
<p class="apm-stat-label"><%= t("simple_apm.common.sql") %></p>
|
|
19
|
+
<div class="apm-stat-value"><%= @request.queries_count.to_i %></div>
|
|
20
|
+
<div class="apm-stat-meta"><%= t("simple_apm.show.cached") %> <%= @request.cached_queries_count.to_i %></div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="apm-stat">
|
|
23
|
+
<p class="apm-stat-label"><%= t("simple_apm.common.view") %></p>
|
|
24
|
+
<div class="apm-stat-value"><%= sec_str @request.view_runtime %></div>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="apm-stat">
|
|
27
|
+
<p class="apm-stat-label"><%= t("simple_apm.common.http") %></p>
|
|
28
|
+
<div class="apm-stat-value"><%= sec_str @request.net_http_during %></div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<section class="apm-panel">
|
|
33
|
+
<div class="apm-panel-header">
|
|
34
|
+
<div>
|
|
35
|
+
<h2 class="apm-panel-title"><%= t("simple_apm.show.basic_info") %></h2>
|
|
36
|
+
<p class="apm-panel-subtitle"><%= t("simple_apm.show.basic_info_subtitle") %></p>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="apm-panel-body">
|
|
40
|
+
<dl class="apm-detail-list">
|
|
41
|
+
<dt><%= t("simple_apm.common.url") %></dt>
|
|
42
|
+
<dd><%= @request.url %></dd>
|
|
43
|
+
<dt><%= t("simple_apm.show.started_at") %></dt>
|
|
44
|
+
<dd><%= time_label @request.started, true %></dd>
|
|
45
|
+
<dt><%= t("simple_apm.show.completed_memory") %></dt>
|
|
46
|
+
<dd><%= @request.completed_memory.to_f.round(1) %>M (<%= t("simple_apm.show.memory_increase") %>: <%= @request.memory_during.to_f.round(1) %>M)</dd>
|
|
47
|
+
<dt><%= t("simple_apm.common.server") %></dt>
|
|
48
|
+
<dd><%= @request.host %></dd>
|
|
49
|
+
<dt><%= t("simple_apm.show.ip") %></dt>
|
|
50
|
+
<dd><%= @request.remote_addr %></dd>
|
|
51
|
+
</dl>
|
|
52
|
+
</div>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
34
55
|
<% if @request.exception.present? && @request.exception != 'null' %>
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
<section class="apm-panel">
|
|
57
|
+
<div class="apm-panel-header">
|
|
58
|
+
<div>
|
|
59
|
+
<h2 class="apm-panel-title"><%= t("simple_apm.show.exception") %></h2>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="apm-panel-body">
|
|
63
|
+
<pre><%= @request.exception %></pre>
|
|
64
|
+
</div>
|
|
65
|
+
</section>
|
|
39
66
|
<% end %>
|
|
67
|
+
|
|
40
68
|
<% if @request.net_http_requests.present? %>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
<section class="apm-panel">
|
|
70
|
+
<div class="apm-panel-header">
|
|
71
|
+
<div>
|
|
72
|
+
<h2 class="apm-panel-title"><%= t("simple_apm.show.external_requests") %></h2>
|
|
73
|
+
<p class="apm-panel-subtitle"><%= t("simple_apm.show.external_requests_subtitle") %></p>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="apm-panel-body">
|
|
77
|
+
<div class="apm-table-wrap">
|
|
78
|
+
<table class="table table-bordered">
|
|
79
|
+
<tr>
|
|
80
|
+
<th><%= t("simple_apm.show.started_at") %></th>
|
|
81
|
+
<th><%= t("simple_apm.show.duration") %></th>
|
|
82
|
+
<th><%= t("simple_apm.common.url") %></th>
|
|
83
|
+
<th><%= t("simple_apm.show.other_info") %></th>
|
|
84
|
+
</tr>
|
|
85
|
+
<% @request.net_http_requests.each do |r| %>
|
|
86
|
+
<tr>
|
|
87
|
+
<td><%= time_label r.started %></td>
|
|
88
|
+
<td><%= sec_str r.during %></td>
|
|
89
|
+
<td><%= r.url %></td>
|
|
90
|
+
<td><%= "#{r.filename}: #{r.line}" if r.filename.present? %></td>
|
|
91
|
+
</tr>
|
|
92
|
+
<% end %>
|
|
93
|
+
</table>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</section>
|
|
58
97
|
<% end %>
|
|
59
98
|
|
|
60
99
|
<% if @request.sqls.present? %>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
<section class="apm-panel">
|
|
101
|
+
<div class="apm-panel-header">
|
|
102
|
+
<div>
|
|
103
|
+
<h2 class="apm-panel-title"><%= t("simple_apm.show.sql_list") %></h2>
|
|
104
|
+
<p class="apm-panel-subtitle"><%= t("simple_apm.show.sql_list_subtitle") %></p>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="apm-panel-body">
|
|
108
|
+
<div class="apm-table-wrap">
|
|
109
|
+
<table id="sql-table" class="table">
|
|
110
|
+
<thead>
|
|
111
|
+
<tr>
|
|
112
|
+
<td>time</td>
|
|
113
|
+
<td>name</td>
|
|
114
|
+
<td>sql</td>
|
|
115
|
+
<td><%= t("simple_apm.show.time_ms") %></td>
|
|
116
|
+
<td><%= t("simple_apm.show.location") %></td>
|
|
117
|
+
</tr>
|
|
118
|
+
</thead>
|
|
119
|
+
<tbody>
|
|
120
|
+
<% @request.sqls.each do |sql| %>
|
|
121
|
+
<tr>
|
|
122
|
+
<td><%= time_label sql.started %></td>
|
|
123
|
+
<td>
|
|
124
|
+
<%= sql.name %>
|
|
125
|
+
</td>
|
|
126
|
+
<td>
|
|
127
|
+
<div class="sql"><%= sql.full_sql -%></div>
|
|
128
|
+
</td>
|
|
129
|
+
<td><%= sec_str sql.during %></td>
|
|
130
|
+
<td><%= sql.filename %>:<%= sql.line %></td>
|
|
131
|
+
</tr>
|
|
132
|
+
<% end %>
|
|
133
|
+
</tbody>
|
|
134
|
+
</table>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</section>
|
|
88
138
|
<script type="text/javascript">
|
|
89
139
|
$(document).ready(function () {
|
|
90
140
|
$('#sql-table').DataTable({
|
|
@@ -95,4 +145,4 @@
|
|
|
95
145
|
|
|
96
146
|
})
|
|
97
147
|
</script>
|
|
98
|
-
<% end %>
|
|
148
|
+
<% end %>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
en:
|
|
2
|
+
simple_apm:
|
|
3
|
+
actions:
|
|
4
|
+
title: "Action Performance"
|
|
5
|
+
subtitle: "Aggregate hits, response time, and SQL behavior by Controller#Action."
|
|
6
|
+
list_title: "Action List"
|
|
7
|
+
list_subtitle: "Click an action name to inspect its slow request samples."
|
|
8
|
+
name: "Name"
|
|
9
|
+
click_count: "Hits"
|
|
10
|
+
avg_response_time: "Avg Response Time"
|
|
11
|
+
avg_db_time: "Avg DB Time"
|
|
12
|
+
avg_sql_count: "Avg SQL Count"
|
|
13
|
+
avg_http_time: "Avg HTTP Time"
|
|
14
|
+
fastest_response_time: "Fastest Response Time"
|
|
15
|
+
slowest_response_time: "Slowest Response Time"
|
|
16
|
+
action_info:
|
|
17
|
+
title: "Action Overview"
|
|
18
|
+
daily_hits: "Daily Hits"
|
|
19
|
+
avg_response_time: "Avg Response Time"
|
|
20
|
+
avg_db_time: "Avg DB Time"
|
|
21
|
+
avg_sql_count: "Avg SQL Count"
|
|
22
|
+
slowest_response_time: "Slowest Response Time"
|
|
23
|
+
fastest: "Fastest"
|
|
24
|
+
slow_samples_title: "Slow Request Samples"
|
|
25
|
+
slow_samples_subtitle: "Keeps the slowest requests for this action."
|
|
26
|
+
response_time: "Response Time"
|
|
27
|
+
access_time: "Access Time"
|
|
28
|
+
memory_delta: "Memory Delta"
|
|
29
|
+
request_id: "Request ID"
|
|
30
|
+
ip: "IP"
|
|
31
|
+
common:
|
|
32
|
+
db: "DB"
|
|
33
|
+
http: "HTTP"
|
|
34
|
+
running: "Running"
|
|
35
|
+
paused: "Paused"
|
|
36
|
+
server: "Server"
|
|
37
|
+
sql: "SQL"
|
|
38
|
+
total: "Total"
|
|
39
|
+
url: "URL"
|
|
40
|
+
view: "View"
|
|
41
|
+
dashboard:
|
|
42
|
+
title: "Performance Overview"
|
|
43
|
+
subtitle: "Review response time and traffic trends in 10-minute intervals."
|
|
44
|
+
stat_points: "Data Points"
|
|
45
|
+
ten_minute_intervals: "10-minute intervals"
|
|
46
|
+
hits: "Hits"
|
|
47
|
+
current_day_total: "Current day total"
|
|
48
|
+
peak_avg_response: "Peak Avg Response"
|
|
49
|
+
interval_peak: "Interval peak"
|
|
50
|
+
current_collection: "Collection"
|
|
51
|
+
redis_status: "Redis status"
|
|
52
|
+
query_date: "Query Date"
|
|
53
|
+
switch_in_top_right: "Switchable in the top right"
|
|
54
|
+
response_time: "Response Time"
|
|
55
|
+
response_time_subtitle: "Average response time for each interval."
|
|
56
|
+
hit_count: "Hit Count"
|
|
57
|
+
hit_count_subtitle: "Request count for each interval."
|
|
58
|
+
data:
|
|
59
|
+
title: "Data Management"
|
|
60
|
+
subtitle: "Manage collection status and historical Redis data."
|
|
61
|
+
collection_status: "Collection Status"
|
|
62
|
+
collection_subtitle: "When paused, middleware stops recording new request performance data."
|
|
63
|
+
pause_collection: "Pause Collection"
|
|
64
|
+
resume_collection: "Resume Collection"
|
|
65
|
+
confirm_pause: "Pause collection?"
|
|
66
|
+
delete_data: "Delete Data"
|
|
67
|
+
delete_subtitle: "Clean historical data by retention period, or delete one day."
|
|
68
|
+
keep_one_week: "Keep One Week"
|
|
69
|
+
keep_one_month: "Keep One Month"
|
|
70
|
+
confirm_delete_week: "Delete all data older than one week?"
|
|
71
|
+
confirm_delete_month: "Delete all data older than one month?"
|
|
72
|
+
history_title: "Historical Data"
|
|
73
|
+
history_subtitle: "View collection volume and average response time by date."
|
|
74
|
+
date: "Date"
|
|
75
|
+
request_count: "Requests"
|
|
76
|
+
avg_response_time: "Avg Response Time"
|
|
77
|
+
operation: "Operation"
|
|
78
|
+
delete: "Delete"
|
|
79
|
+
confirm_delete: "Delete this data?"
|
|
80
|
+
flash:
|
|
81
|
+
deleted: "Deleted successfully."
|
|
82
|
+
deleted_count: "Deleted %{count} records successfully."
|
|
83
|
+
no_data_for_day: "No data for this day."
|
|
84
|
+
unknown_action: "Unknown action."
|
|
85
|
+
updated: "Updated successfully."
|
|
86
|
+
index:
|
|
87
|
+
title: "Slow Requests"
|
|
88
|
+
subtitle: "Sort by response duration to locate DB, SQL, View, and external request cost."
|
|
89
|
+
samples_title: "Request Samples"
|
|
90
|
+
samples_subtitle: "Loads recent slow request records by default."
|
|
91
|
+
request_time: "Request Time"
|
|
92
|
+
action_name: "Action Name"
|
|
93
|
+
total_time: "Total Time"
|
|
94
|
+
memory_mb: "Memory (Mb)"
|
|
95
|
+
ip: "IP"
|
|
96
|
+
layout:
|
|
97
|
+
collected: "Collecting data"
|
|
98
|
+
date: "Date"
|
|
99
|
+
language: "Language"
|
|
100
|
+
nav_actions: "Actions"
|
|
101
|
+
nav_dashboard: "Dashboard"
|
|
102
|
+
nav_data: "Data"
|
|
103
|
+
nav_slow_requests: "Slow Requests"
|
|
104
|
+
redis_info:
|
|
105
|
+
current_memory: "Current Memory"
|
|
106
|
+
current_memory_rss: "Current Memory (RSS)"
|
|
107
|
+
db: "DB"
|
|
108
|
+
peak_memory: "Peak Memory"
|
|
109
|
+
redis_version: "Redis Version"
|
|
110
|
+
system_memory: "System Memory"
|
|
111
|
+
locales:
|
|
112
|
+
en: "English"
|
|
113
|
+
zh-CN: "中文"
|
|
114
|
+
show:
|
|
115
|
+
title: "Request Details"
|
|
116
|
+
cached: "Cached"
|
|
117
|
+
basic_info: "Basic Info"
|
|
118
|
+
basic_info_subtitle: "Request source, time, and memory changes."
|
|
119
|
+
started_at: "Started At"
|
|
120
|
+
completed_memory: "Completed Memory"
|
|
121
|
+
memory_increase: "Increase"
|
|
122
|
+
ip: "IP"
|
|
123
|
+
exception: "Exception"
|
|
124
|
+
external_requests: "External Requests"
|
|
125
|
+
external_requests_subtitle: "Net::HTTP calls triggered during this request."
|
|
126
|
+
duration: "Duration"
|
|
127
|
+
other_info: "Other Info"
|
|
128
|
+
sql_list: "SQL List"
|
|
129
|
+
sql_list_subtitle: "Click SQL text to view the complete statement."
|
|
130
|
+
time_ms: "Time (ms)"
|
|
131
|
+
location: "Location"
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
zh-CN:
|
|
2
|
+
simple_apm:
|
|
3
|
+
actions:
|
|
4
|
+
title: "Action 性能"
|
|
5
|
+
subtitle: "按 Controller#Action 聚合访问次数、响应时间和 SQL 行为。"
|
|
6
|
+
list_title: "Action 列表"
|
|
7
|
+
list_subtitle: "点击 Action 名称查看该接口的慢请求样本。"
|
|
8
|
+
name: "Name"
|
|
9
|
+
click_count: "点击次数"
|
|
10
|
+
avg_response_time: "平均响应时间"
|
|
11
|
+
avg_db_time: "平均 DB 时间"
|
|
12
|
+
avg_sql_count: "平均 SQL 次数"
|
|
13
|
+
avg_http_time: "平均 HTTP 访问时间"
|
|
14
|
+
fastest_response_time: "最快响应时间"
|
|
15
|
+
slowest_response_time: "最慢响应时间"
|
|
16
|
+
action_info:
|
|
17
|
+
title: "Action 概况"
|
|
18
|
+
daily_hits: "当日点击次数"
|
|
19
|
+
avg_response_time: "平均响应时间"
|
|
20
|
+
avg_db_time: "平均 DB 时间"
|
|
21
|
+
avg_sql_count: "平均 SQL 次数"
|
|
22
|
+
slowest_response_time: "最慢响应时间"
|
|
23
|
+
fastest: "最快"
|
|
24
|
+
slow_samples_title: "慢请求样本"
|
|
25
|
+
slow_samples_subtitle: "保留该 Action 下响应最慢的请求。"
|
|
26
|
+
response_time: "响应时间"
|
|
27
|
+
access_time: "访问时间"
|
|
28
|
+
memory_delta: "内存波动"
|
|
29
|
+
request_id: "请求 ID"
|
|
30
|
+
ip: "访问 IP"
|
|
31
|
+
common:
|
|
32
|
+
db: "DB"
|
|
33
|
+
http: "HTTP"
|
|
34
|
+
running: "运行中"
|
|
35
|
+
paused: "已暂停"
|
|
36
|
+
server: "Server"
|
|
37
|
+
sql: "SQL"
|
|
38
|
+
total: "Total"
|
|
39
|
+
url: "URL"
|
|
40
|
+
view: "View"
|
|
41
|
+
dashboard:
|
|
42
|
+
title: "性能概览"
|
|
43
|
+
subtitle: "按 10 分钟粒度观察响应时间和访问量趋势。"
|
|
44
|
+
stat_points: "统计点"
|
|
45
|
+
ten_minute_intervals: "10 分钟区间"
|
|
46
|
+
hits: "访问次数"
|
|
47
|
+
current_day_total: "当前日期累计"
|
|
48
|
+
peak_avg_response: "最高平均响应"
|
|
49
|
+
interval_peak: "区间峰值"
|
|
50
|
+
current_collection: "当前采集"
|
|
51
|
+
redis_status: "Redis 状态"
|
|
52
|
+
query_date: "查询日期"
|
|
53
|
+
switch_in_top_right: "可在右上角切换"
|
|
54
|
+
response_time: "响应时间"
|
|
55
|
+
response_time_subtitle: "每个时间段的平均响应耗时。"
|
|
56
|
+
hit_count: "访问次数"
|
|
57
|
+
hit_count_subtitle: "每个时间段的请求数量。"
|
|
58
|
+
data:
|
|
59
|
+
title: "数据管理"
|
|
60
|
+
subtitle: "管理采集开关和历史 Redis 数据。"
|
|
61
|
+
collection_status: "采集状态"
|
|
62
|
+
collection_subtitle: "暂停后 middleware 不再记录新的请求性能数据。"
|
|
63
|
+
pause_collection: "暂停收集数据"
|
|
64
|
+
resume_collection: "继续收集数据"
|
|
65
|
+
confirm_pause: "确定暂停吗?"
|
|
66
|
+
delete_data: "删除数据"
|
|
67
|
+
delete_subtitle: "按保留周期清理历史数据,或删除单日数据。"
|
|
68
|
+
keep_one_week: "保留一周数据"
|
|
69
|
+
keep_one_month: "保留一个月数据"
|
|
70
|
+
confirm_delete_week: "确定删除所有一周以前的数据?"
|
|
71
|
+
confirm_delete_month: "确定删除所有一个月以前的数据?"
|
|
72
|
+
history_title: "历史数据"
|
|
73
|
+
history_subtitle: "以日期为单位查看采集量和平均响应时间。"
|
|
74
|
+
date: "日期"
|
|
75
|
+
request_count: "请求数量"
|
|
76
|
+
avg_response_time: "平均响应时间"
|
|
77
|
+
operation: "操作"
|
|
78
|
+
delete: "删除"
|
|
79
|
+
confirm_delete: "确定删除?"
|
|
80
|
+
flash:
|
|
81
|
+
deleted: "删除成功!"
|
|
82
|
+
deleted_count: "成功删除 %{count} 条数据"
|
|
83
|
+
no_data_for_day: "当日没有数据"
|
|
84
|
+
unknown_action: "未知操作!"
|
|
85
|
+
updated: "设置成功!"
|
|
86
|
+
index:
|
|
87
|
+
title: "慢事务列表"
|
|
88
|
+
subtitle: "按响应耗时排序,快速定位 DB、SQL、View 和外部请求占比。"
|
|
89
|
+
samples_title: "请求样本"
|
|
90
|
+
samples_subtitle: "默认加载最近的慢请求记录。"
|
|
91
|
+
request_time: "请求时间"
|
|
92
|
+
action_name: "Action Name"
|
|
93
|
+
total_time: "Total Time"
|
|
94
|
+
memory_mb: "Memory (Mb)"
|
|
95
|
+
ip: "IP"
|
|
96
|
+
layout:
|
|
97
|
+
collected: "数据收集中"
|
|
98
|
+
date: "统计日期"
|
|
99
|
+
language: "语言"
|
|
100
|
+
nav_actions: "Action 列表"
|
|
101
|
+
nav_dashboard: "Dashboard"
|
|
102
|
+
nav_data: "数据管理"
|
|
103
|
+
nav_slow_requests: "慢事务列表"
|
|
104
|
+
redis_info:
|
|
105
|
+
current_memory: "当前内存占用"
|
|
106
|
+
current_memory_rss: "当前内存占用 (RSS)"
|
|
107
|
+
db: "DB"
|
|
108
|
+
peak_memory: "占用内存峰值"
|
|
109
|
+
redis_version: "Redis 版本"
|
|
110
|
+
system_memory: "系统内存"
|
|
111
|
+
locales:
|
|
112
|
+
en: "English"
|
|
113
|
+
zh-CN: "中文"
|
|
114
|
+
show:
|
|
115
|
+
title: "请求详情"
|
|
116
|
+
cached: "缓存"
|
|
117
|
+
basic_info: "基础信息"
|
|
118
|
+
basic_info_subtitle: "请求来源、时间和内存变化。"
|
|
119
|
+
started_at: "开始时间"
|
|
120
|
+
completed_memory: "结束时内存"
|
|
121
|
+
memory_increase: "增幅"
|
|
122
|
+
ip: "访问 IP"
|
|
123
|
+
exception: "报错信息"
|
|
124
|
+
external_requests: "外部请求"
|
|
125
|
+
external_requests_subtitle: "请求过程中触发的 Net::HTTP 调用。"
|
|
126
|
+
duration: "耗时"
|
|
127
|
+
other_info: "其他信息"
|
|
128
|
+
sql_list: "SQL 列表"
|
|
129
|
+
sql_list_subtitle: "点击 SQL 文本查看完整语句。"
|
|
130
|
+
time_ms: "时间 (ms)"
|
|
131
|
+
location: "位置"
|
data/config/routes.rb
CHANGED
data/lib/simple_apm/redis.rb
CHANGED
|
@@ -62,12 +62,12 @@ module SimpleApm
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def rerun!
|
|
65
|
-
hset('status', 'running', true)
|
|
65
|
+
hset('status', 'running', 'true')
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# 停止收集数据
|
|
69
69
|
def stop!
|
|
70
|
-
hset('status', 'running', false)
|
|
70
|
+
hset('status', 'running', 'false')
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def method_missing(method, *args)
|
data/lib/simple_apm/setting.rb
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
|
|
1
3
|
module SimpleApm
|
|
2
4
|
class Setting
|
|
3
|
-
|
|
5
|
+
def self.load_settings(path = "config/simple_apm.yml")
|
|
6
|
+
yaml = ERB.new(File.read(path)).result
|
|
7
|
+
settings = YAML.safe_load(yaml, aliases: true) || {}
|
|
8
|
+
settings.is_a?(Hash) ? settings : {}
|
|
9
|
+
rescue
|
|
10
|
+
{}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
ApmSettings = load_settings
|
|
4
14
|
REDIS_URL = ApmSettings['redis_url'].presence || 'redis://localhost:6379/0'
|
|
5
15
|
# nil , hiredis ...
|
|
6
16
|
REDIS_DRIVER = ApmSettings['redis_driver']
|
data/lib/simple_apm/version.rb
CHANGED
data/lib/simple_apm/worker.rb
CHANGED
|
@@ -44,6 +44,8 @@ module SimpleApm
|
|
|
44
44
|
started: started.to_s,
|
|
45
45
|
db_runtime: payload[:db_runtime].to_f / 1000,
|
|
46
46
|
view_runtime: payload[:view_runtime].to_f / 1000,
|
|
47
|
+
queries_count: payload[:queries_count].to_i,
|
|
48
|
+
cached_queries_count: payload[:cached_queries_count].to_i,
|
|
47
49
|
controller: payload[:controller],
|
|
48
50
|
action: payload[:action],
|
|
49
51
|
host: Socket.gethostname,
|
|
@@ -127,4 +129,4 @@ module SimpleApm
|
|
|
127
129
|
end
|
|
128
130
|
end
|
|
129
131
|
end
|
|
130
|
-
end
|
|
132
|
+
end
|