raygun-apm-rails 1.0.16 → 1.0.21
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 +4 -4
- data/CHANGELOG.rdoc +22 -0
- data/lib/raygun/apm/rails.rb +10 -0
- data/lib/raygun/apm/rails/middleware.rb +39 -13
- data/lib/raygun/apm/rails/railtie.rb +4 -0
- data/lib/raygun/apm/rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f48a149b559692c6a57fa6b207562fbb1f601f2e5680165902fbc1e6f5d6a247
|
4
|
+
data.tar.gz: 8d06e52aa1eed0a84316fa74e156cbfe7471d9a200585daad8734d2c4c268f4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98eafd87b1d591426d08b1e4c3cc73ba1022cbc92509c5316e260e404274f9e792452a4544e51160c05e7a1c05acc4856f4f50830280b9db18f62027ec787234
|
7
|
+
data.tar.gz: f37a4deb0f9dad5c71704f4e74eca6b357314ee4099d8bc3f3e61e3de288b7e52d4a829cbb85e2688ed24571648ec3ddb79222c0584bbe250dd9983ac76a27ac
|
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= Changelog
|
2
|
+
|
3
|
+
== 1.0.21 (March 19, 2020)
|
4
|
+
|
5
|
+
* Further improvements of emitting exceptions and other error status codes for apps with and without raygun4ruby installed
|
6
|
+
|
7
|
+
== 1.0.20 (March 18, 2020)
|
8
|
+
|
9
|
+
* Introduce support for detecting the presence of raygun4ruby and integrate better with the exception tracker
|
10
|
+
|
11
|
+
== 1.0.19 (March 16, 2020)
|
12
|
+
|
13
|
+
* Improve trace emission of unhandled exceptions in a request context
|
14
|
+
|
15
|
+
== 1.0.18 (March 15, 2020)
|
16
|
+
|
17
|
+
* Ensure a better experience with raygun4ruby with only Raygun::track_exception whitelisted
|
18
|
+
* Remove the warning on a HTTP IN event with an exception payload - spams STDOUT and already confused some testers
|
19
|
+
* Ensure errors raised during request exception always result in a fully wrapped trace with a 500 status
|
20
|
+
* Wrap the exceptional HTTP IN error handler in a fake user code method too to get past the agent gate for that
|
21
|
+
* Prefer the singleton interface on the Tracer
|
22
|
+
* Blacklist HTTParty
|
data/lib/raygun/apm/rails.rb
CHANGED
@@ -67,8 +67,18 @@ module Raygun
|
|
67
67
|
Nokogiri
|
68
68
|
Loofah
|
69
69
|
WebConsole
|
70
|
+
HTTParty
|
71
|
+
Raygun::Breadcrumbs
|
72
|
+
Raygun::Configuration
|
73
|
+
Raygun::config
|
70
74
|
+Raygun::Apm::Rails::Middleware::Ruby_APM_profiler_trace
|
75
|
+
+Raygun::Apm::Rails::Middleware::Ruby_APM_request_error
|
76
|
+
+Raygun::track_exception
|
71
77
|
}
|
78
|
+
|
79
|
+
def self.raygun4ruby?
|
80
|
+
defined?(Raygun) && Raygun.respond_to?(:configured?) && Raygun.configured?
|
81
|
+
end
|
72
82
|
end
|
73
83
|
end
|
74
84
|
end
|
@@ -17,30 +17,50 @@ module Raygun
|
|
17
17
|
def instrument(env)
|
18
18
|
res = nil
|
19
19
|
# Can be nil if we had a fatal error
|
20
|
-
@tracer ||= init_tracer
|
20
|
+
@tracer ||= Raygun::Apm::Tracer.instance || init_tracer
|
21
21
|
if @tracer
|
22
22
|
# For the exceptional HTTP IN handler
|
23
23
|
@request_started = @tracer.now
|
24
|
-
Thread.current.thread_variable_set(:_raygun_apm_tracer, @tracer)
|
25
24
|
@tracer.start_trace
|
26
25
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
exception = nil
|
27
|
+
res = nil
|
28
|
+
Ruby_APM_profiler_trace do
|
29
|
+
begin
|
30
|
+
res = @app.call(env)
|
31
|
+
if res && (status = res.first) >= 400 && status < 600
|
32
|
+
Ruby_APM_request_error do
|
33
|
+
message = Rack::Utils::HTTP_STATUS_CODES[status]
|
34
|
+
begin
|
35
|
+
raise "HTTP #{status} #{message}"
|
36
|
+
rescue => e
|
37
|
+
Raygun.track_exception(e, env) if Raygun::Apm::Rails.raygun4ruby?
|
38
|
+
end
|
39
|
+
exceptional_http_in_handler(env, status)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
rescue => e
|
43
|
+
Ruby_APM_request_error do
|
44
|
+
raise e rescue nil
|
45
|
+
Raygun.track_exception(e, env) if Raygun::Apm::Rails.raygun4ruby?
|
46
|
+
exceptional_http_in_handler(env, 500)
|
47
|
+
end
|
48
|
+
exection = e
|
49
|
+
end
|
30
50
|
end
|
31
51
|
# Can be nil if we had a fatal error
|
32
52
|
@tracer.end_trace if @tracer
|
53
|
+
raise exception if exception
|
33
54
|
res
|
34
55
|
rescue Raygun::Apm::FatalError => e
|
35
56
|
raygun_shutdown_handler(e)
|
36
57
|
end
|
37
58
|
|
38
59
|
def init_tracer
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@tracer))
|
60
|
+
tracer = Raygun::Apm::Tracer.new
|
61
|
+
tracer.udp_sink!
|
62
|
+
tracer.process_started
|
63
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(tracer))
|
44
64
|
|
45
65
|
@http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
|
46
66
|
http_in_handler(args)
|
@@ -51,7 +71,7 @@ module Raygun
|
|
51
71
|
end
|
52
72
|
|
53
73
|
GC.stress = true if ENV['RAYGUN_STRESS_GC']
|
54
|
-
|
74
|
+
Raygun::Apm::Tracer.instance = tracer
|
55
75
|
# If any fatal errors on init, shutdown the tracer
|
56
76
|
rescue Raygun::Apm::FatalError => e
|
57
77
|
raygun_shutdown_handler(e)
|
@@ -64,13 +84,15 @@ module Raygun
|
|
64
84
|
ActiveSupport::Notifications.unsubscribe(@sql_subscriber)
|
65
85
|
warn "[Raygun APM] notification hooks unsubscribed"
|
66
86
|
# Let the GC clean up the sink thread through the finalizer below
|
67
|
-
@tracer = nil
|
68
|
-
Thread.current.thread_variable_set(:_raygun_apm_tracer, nil)
|
87
|
+
@tracer = Raygun::Apm::Tracer.instance = nil
|
69
88
|
raise(exception) unless (Raygun::Apm::FatalError === exception)
|
70
89
|
end
|
71
90
|
|
72
91
|
def http_in_handler(args)
|
73
92
|
notification = ActiveSupport::Notifications::Event.new *args
|
93
|
+
if notification.payload[:exception]
|
94
|
+
return
|
95
|
+
end
|
74
96
|
req = Rack::Request.new notification.payload[:headers].env
|
75
97
|
event = http_in_event
|
76
98
|
event[:url] = req.url
|
@@ -149,6 +171,10 @@ module Raygun
|
|
149
171
|
yield
|
150
172
|
end
|
151
173
|
|
174
|
+
def Ruby_APM_request_error
|
175
|
+
yield
|
176
|
+
end
|
177
|
+
|
152
178
|
def self.finalize(tracer)
|
153
179
|
proc {tracer.process_ended}
|
154
180
|
end
|
@@ -6,6 +6,10 @@ module Raygun
|
|
6
6
|
require "raygun/apm"
|
7
7
|
require "raygun/apm/rails/middleware"
|
8
8
|
Raygun::Apm::Blacklist.extend_with Raygun::Apm::Rails::BLACKLIST
|
9
|
+
if Raygun::Apm::Rails.raygun4ruby?
|
10
|
+
# Remove the exception notifier because we handle it in the APM middleware now instead
|
11
|
+
app.middleware.delete Raygun::Middleware::RackExceptionInterceptor
|
12
|
+
end
|
9
13
|
app.middleware.use Raygun::Apm::Rails::Middleware
|
10
14
|
# Explictly enable instrumenting HTTP until a good control API is figured out
|
11
15
|
require "raygun/apm/hooks/net_http"
|
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.21
|
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-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: raygun-apm
|
@@ -76,6 +76,7 @@ extensions: []
|
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
|
+
- CHANGELOG.rdoc
|
79
80
|
- Gemfile
|
80
81
|
- Gemfile.lock
|
81
82
|
- README.rdoc
|