raygun-apm-rails 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raygun/apm/rails.rb +4 -0
- data/lib/raygun/apm/rails/middleware.rb +23 -5
- data/lib/raygun/apm/rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56652e1a7f4025972adeff71e48d15e0c9de9160b594c317a0542cbbb755dd68
|
4
|
+
data.tar.gz: 9d5ecc225f6ff015b355847336b536a6c753b86b376f7a0122d31beaa1501103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9920374e2efa710d18f2bd877ef3a9a583eda90fb3b6e5cb1f0cfc2f6cf4c84ea0876c67a0cc4714488d6658db3865e5d8716755941b15abe2cfe73cd5f92371
|
7
|
+
data.tar.gz: a5da42a667bf6affb31abb3d9e9390ed1dd9bb7164b6d1d63e7dd263d218377228ff98e955617fb3eea10c25d194339cd34e01c98d2d8a458f317f866232f653
|
data/lib/raygun/apm/rails.rb
CHANGED
@@ -23,6 +23,7 @@ module Raygun
|
|
23
23
|
@http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
|
24
24
|
http_in_handler(args)
|
25
25
|
end
|
26
|
+
|
26
27
|
@sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
27
28
|
sql_handler(args)
|
28
29
|
end
|
@@ -39,10 +40,15 @@ module Raygun
|
|
39
40
|
@tracer_initialized ||= initialize_tracer
|
40
41
|
# Can be nil if we had a fatal error
|
41
42
|
if @tracer
|
43
|
+
# For the exceptional HTTP IN handler
|
44
|
+
@request_started = @tracer.now
|
42
45
|
Thread.current.thread_variable_set(:_raygun_apm_tracer, @tracer)
|
43
46
|
@tracer.start_trace
|
44
47
|
end
|
45
48
|
res = Ruby_APM_profiler_trace{ @app.call(env) }
|
49
|
+
if (status = res.first) >= 400 && status < 500 || status >= 500 && status < 600
|
50
|
+
exceptional_http_in_handler(env, status)
|
51
|
+
end
|
46
52
|
# Can be nil if we had a fatal error
|
47
53
|
@tracer.end_trace if @tracer
|
48
54
|
res
|
@@ -51,7 +57,7 @@ module Raygun
|
|
51
57
|
end
|
52
58
|
|
53
59
|
def raygun_shutdown_handler(exception)
|
54
|
-
warn "[Raygun APM] shutting down due to error - #{exception.message}",
|
60
|
+
warn "[Raygun APM] shutting down due to error - #{exception.message} #{exception.backtrace.join("\n")}",
|
55
61
|
# Kill extended event subcriptions
|
56
62
|
ActiveSupport::Notifications.unsubscribe(@http_in_subscriber)
|
57
63
|
ActiveSupport::Notifications.unsubscribe(@sql_subscriber)
|
@@ -64,10 +70,6 @@ module Raygun
|
|
64
70
|
|
65
71
|
def http_in_handler(args)
|
66
72
|
notification = ActiveSupport::Notifications::Event.new *args
|
67
|
-
if notification.payload[:exception]
|
68
|
-
warn "[Raygun APM] exception in HTTP IN event: #{notification.payload[:exception]}"
|
69
|
-
return
|
70
|
-
end
|
71
73
|
req = Rack::Request.new notification.payload[:headers].env
|
72
74
|
event = http_in_event
|
73
75
|
event[:url] = req.url
|
@@ -83,6 +85,22 @@ module Raygun
|
|
83
85
|
raygun_shutdown_handler(e)
|
84
86
|
end
|
85
87
|
|
88
|
+
# For middleware chain halts that does not trigger 'process_action.action_controller'
|
89
|
+
def exceptional_http_in_handler(env, status)
|
90
|
+
req = Rack::Request.new env
|
91
|
+
event = http_in_event
|
92
|
+
event[:url] = req.url
|
93
|
+
event[:verb] = req.request_method
|
94
|
+
event[:status] = status
|
95
|
+
event[:duration] = @tracer.now - @request_started
|
96
|
+
event[:timestamp] = @tracer.now
|
97
|
+
event[:tid] = @tracer.get_thread_id(Thread.current)
|
98
|
+
@tracer.emit(event)
|
99
|
+
rescue => e
|
100
|
+
warn "[Raygun APM] error reporting exceptional HTTP IN event"
|
101
|
+
raygun_shutdown_handler(e)
|
102
|
+
end
|
103
|
+
|
86
104
|
def http_in_event
|
87
105
|
@http_in_event ||= begin
|
88
106
|
event = Raygun::Apm::Event::HttpIn.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun-apm-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raygun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-03-
|
12
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: raygun-apm
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
|
-
rubygems_version: 3.0.
|
108
|
+
rubygems_version: 3.0.6
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Raygun application performance monitoring for Rails
|