simple_apm 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/simple_apm/request.rb +1 -1
- data/app/views/simple_apm/apm/show.html.erb +4 -0
- data/config/routes.rb +1 -1
- data/config/simple_apm.yml +3 -1
- data/lib/simple_apm/redis.rb +3 -1
- data/lib/simple_apm/setting.rb +2 -0
- data/lib/simple_apm/version.rb +1 -1
- data/lib/simple_apm.rb +8 -2
- 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: c9c10a4595dc4a7edaaea7749ff4b55e0cc81f9eed50fe50aa9682d1c196efb9
|
4
|
+
data.tar.gz: 180fa1647b8dec347d607ba8f3088b1323f7dc4ba01fbeb4d882cf09c1472dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35dfd32b5ff9456ab58e847d9193cebbe3d0e5ccaf0280af8dcbad4d42063f74d647376482da2306e9b705e4e073e5a76d83050d75adfdc5cb430b63ec348625
|
7
|
+
data.tar.gz: 524e2ed5481223458a1b238ceaf7b4e2d56e82e419362109559eca624e7cb0a1550312b0b40e4e5ed1f45c46a326866e4ca3839f21939a5c6932abdf530d41df
|
data/config/routes.rb
CHANGED
data/config/simple_apm.yml
CHANGED
data/lib/simple_apm/redis.rb
CHANGED
data/lib/simple_apm/setting.rb
CHANGED
data/lib/simple_apm/version.rb
CHANGED
data/lib/simple_apm.rb
CHANGED
@@ -3,8 +3,11 @@ require "simple_apm/redis"
|
|
3
3
|
require "simple_apm/engine"
|
4
4
|
require 'callsite'
|
5
5
|
module SimpleApm
|
6
|
+
# RUBY_PLATFORM darwin linux win32
|
7
|
+
# ps aux | grep -w 30057 | awk '$2==30057 {print $6}'
|
6
8
|
ActiveSupport::Notifications.subscribe('process_action.action_controller') do |name, started, finished, unique_id, payload|
|
7
9
|
begin
|
10
|
+
SimpleApm::RedisKey.query_date = nil
|
8
11
|
request_id = Thread.current['action_dispatch.request_id']
|
9
12
|
need_skip = payload[:controller] == 'SimpleApm::ApmController'
|
10
13
|
need_skip = true if payload[:status].to_s=='302' && payload[:path].to_s=~/login/ && payload[:method].to_s.downcase=='get'
|
@@ -16,6 +19,7 @@ module SimpleApm
|
|
16
19
|
info = {
|
17
20
|
request_id: request_id,
|
18
21
|
action_name: action_name,
|
22
|
+
url: payload[:path],
|
19
23
|
during: finished - started,
|
20
24
|
started: started.to_s,
|
21
25
|
db_runtime: payload[:db_runtime].to_f / 1000,
|
@@ -47,8 +51,10 @@ module SimpleApm
|
|
47
51
|
|
48
52
|
ActiveSupport::Notifications.subscribe 'sql.active_record' do |name, started, finished, unique_id, payload|
|
49
53
|
begin
|
54
|
+
SimpleApm::RedisKey.query_date = nil
|
50
55
|
request_id = Thread.current['action_dispatch.request_id'].presence || Thread.main['action_dispatch.request_id']
|
51
|
-
|
56
|
+
during = finished - started
|
57
|
+
if request_id.present? || during < SimpleApm::Setting::SQL_CRITICAL_TIME
|
52
58
|
dev_caller = caller.detect {|c| c.include? Rails.root.to_s}
|
53
59
|
if dev_caller
|
54
60
|
c = ::Callsite.parse(dev_caller)
|
@@ -59,7 +65,7 @@ module SimpleApm
|
|
59
65
|
info = {
|
60
66
|
request_id: request_id,
|
61
67
|
name: payload[:name],
|
62
|
-
during:
|
68
|
+
during: during,
|
63
69
|
started: started,
|
64
70
|
sql: payload[:sql],
|
65
71
|
value: sql_value,
|
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.3
|
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-
|
11
|
+
date: 2018-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|