simple_apm 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/simple_apm/apm/index.html.erb +15 -9
- data/lib/simple_apm.rb +5 -0
- data/lib/simple_apm/version.rb +1 -1
- data/lib/simple_apm/worker.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13c4a3af0428d79e6e98ad4e523ccdbc6e62f756aedbecb6289f55c9613c07bc
|
4
|
+
data.tar.gz: a44fe2e03f9080a7c44354b9923598f3c83028cf3d432363dd8c3feaec157b3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d2bad5ed7af59fdab080e4ee6345a28f5454c3eab359383ccb343d2d80fe778d3bab84cc06682b68592a765625e8edd91bac365ec341c75c20df57da3a739f
|
7
|
+
data.tar.gz: fcb8e12ddcc73ba608d8e8ffbfab7303b817fec99aa753846d21dfd7a8abd9475c0c1c8eaeb28d825fa817864df82859f4f504f07e86816e7b1cc1cb83639b56
|
@@ -1,15 +1,21 @@
|
|
1
|
-
<
|
1
|
+
<style>
|
2
|
+
.container{
|
3
|
+
width: 90%;
|
4
|
+
min-width: 1200px;
|
5
|
+
}
|
6
|
+
</style>
|
7
|
+
<table id="slow-requests" class="table" style="width: 100%">
|
2
8
|
<thead>
|
3
9
|
<tr>
|
4
10
|
<th>请求时间</th>
|
5
|
-
<th>
|
6
|
-
<th
|
7
|
-
<th>
|
8
|
-
<th>
|
9
|
-
<th
|
10
|
-
<th
|
11
|
-
<th>
|
12
|
-
<th>
|
11
|
+
<th>ActionName</th>
|
12
|
+
<th>TotalTime</th>
|
13
|
+
<th>DB</th>
|
14
|
+
<th>View</th>
|
15
|
+
<th>HTTP</th>
|
16
|
+
<th>Memory(Mb)</th>
|
17
|
+
<th>server</th>
|
18
|
+
<th>ip</th>
|
13
19
|
</tr>
|
14
20
|
</thead>
|
15
21
|
</table>
|
data/lib/simple_apm.rb
CHANGED
@@ -10,8 +10,13 @@ module SimpleApm
|
|
10
10
|
SimpleApm::NetHttp.install
|
11
11
|
|
12
12
|
ActiveSupport::Notifications.subscribe('process_action.action_controller') do |name, started, finished, unique_id, payload|
|
13
|
+
remote_addr = (payload[:headers]['HTTP_X_REAL_IP'] rescue nil)
|
14
|
+
if remote_addr.blank? || remote_addr=='127.0.0.1'
|
15
|
+
remote_addr = (payload[:headers]['REMOTE_ADDR'] rescue nil)
|
16
|
+
end
|
13
17
|
ProcessingThread.add_event(
|
14
18
|
name: name,
|
19
|
+
remote_addr: remote_addr,
|
15
20
|
request_id: Thread.current['action_dispatch.request_id'],
|
16
21
|
started: started, finished: finished,
|
17
22
|
payload: payload.reject{|k,v|k.to_s=='headers'},
|
data/lib/simple_apm/version.rb
CHANGED
data/lib/simple_apm/worker.rb
CHANGED
@@ -22,6 +22,7 @@ module SimpleApm
|
|
22
22
|
finished = event[:finished]
|
23
23
|
started = event[:started]
|
24
24
|
request_id = event[:request_id]
|
25
|
+
remote_addr = event[:remote_addr]
|
25
26
|
net_http_during = event[:net_http_during]
|
26
27
|
begin
|
27
28
|
need_skip = payload[:controller] == 'SimpleApm::ApmController'
|
@@ -46,7 +47,7 @@ module SimpleApm
|
|
46
47
|
controller: payload[:controller],
|
47
48
|
action: payload[:action],
|
48
49
|
host: Socket.gethostname,
|
49
|
-
remote_addr:
|
50
|
+
remote_addr: remote_addr,
|
50
51
|
method: payload[:method],
|
51
52
|
completed_memory: completed_memory,
|
52
53
|
memory_during: memory_during,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yuanyin.xia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|