raygun-apm-rails 1.0.17 → 1.0.22
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 +27 -0
- data/lib/raygun/apm/rails.rb +11 -0
- data/lib/raygun/apm/rails/middleware.rb +36 -14
- data/lib/raygun/apm/rails/railtie.rb +4 -0
- data/lib/raygun/apm/rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f02b24c73e81c0e61e03ba065bfcc8ee32e03ca8e5a035734f65aa7f67db986c
|
4
|
+
data.tar.gz: a0f88c3268b2f082038f44dd28e4af67087d08b56713885cd4f92fe58db12119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a103e44784bd63d622633c124d0d073ad860d414add2a46842cc2949620391284fbad5907b24d89e28ca8541756d4ccde779e63f12abd3f1b8ea8f9e0b83c0a7
|
7
|
+
data.tar.gz: a197d265464e0f65337d480038729878d995b41b86d11fe639656c79e51bfb0d4d7357a8a3e10ef5a3e1c833ad55492333999fe708c4473be31e2bb3db70c2d2
|
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
= Changelog
|
2
|
+
|
3
|
+
== 1.0.22 (March 24, 2020)
|
4
|
+
|
5
|
+
* Fix local variable typo in the Rails middleware
|
6
|
+
* Blacklist TZInfo
|
7
|
+
|
8
|
+
== 1.0.21 (March 19, 2020)
|
9
|
+
|
10
|
+
* Further improvements of emitting exceptions and other error status codes for apps with and without raygun4ruby installed
|
11
|
+
|
12
|
+
== 1.0.20 (March 18, 2020)
|
13
|
+
|
14
|
+
* Introduce support for detecting the presence of raygun4ruby and integrate better with the exception tracker
|
15
|
+
|
16
|
+
== 1.0.19 (March 16, 2020)
|
17
|
+
|
18
|
+
* Improve trace emission of unhandled exceptions in a request context
|
19
|
+
|
20
|
+
== 1.0.18 (March 15, 2020)
|
21
|
+
|
22
|
+
* Ensure a better experience with raygun4ruby with only Raygun::track_exception whitelisted
|
23
|
+
* Remove the warning on a HTTP IN event with an exception payload - spams STDOUT and already confused some testers
|
24
|
+
* Ensure errors raised during request exception always result in a fully wrapped trace with a 500 status
|
25
|
+
* Wrap the exceptional HTTP IN error handler in a fake user code method too to get past the agent gate for that
|
26
|
+
* Prefer the singleton interface on the Tracer
|
27
|
+
* Blacklist HTTParty
|
data/lib/raygun/apm/rails.rb
CHANGED
@@ -67,8 +67,19 @@ module Raygun
|
|
67
67
|
Nokogiri
|
68
68
|
Loofah
|
69
69
|
WebConsole
|
70
|
+
HTTParty
|
71
|
+
TZinfo
|
72
|
+
Raygun::Breadcrumbs
|
73
|
+
Raygun::Configuration
|
74
|
+
Raygun::config
|
70
75
|
+Raygun::Apm::Rails::Middleware::Ruby_APM_profiler_trace
|
76
|
+
+Raygun::Apm::Rails::Middleware::Ruby_APM_request_error
|
77
|
+
+Raygun::track_exception
|
71
78
|
}
|
79
|
+
|
80
|
+
def self.raygun4ruby?
|
81
|
+
defined?(Raygun) && Raygun.respond_to?(:configured?) && Raygun.configured?
|
82
|
+
end
|
72
83
|
end
|
73
84
|
end
|
74
85
|
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
|
+
exception = 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,15 +84,13 @@ 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
|
74
93
|
if notification.payload[:exception]
|
75
|
-
warn "[Raygun APM] exception in HTTP IN event: #{notification.payload[:exception]}"
|
76
94
|
return
|
77
95
|
end
|
78
96
|
req = Rack::Request.new notification.payload[:headers].env
|
@@ -153,6 +171,10 @@ module Raygun
|
|
153
171
|
yield
|
154
172
|
end
|
155
173
|
|
174
|
+
def Ruby_APM_request_error
|
175
|
+
yield
|
176
|
+
end
|
177
|
+
|
156
178
|
def self.finalize(tracer)
|
157
179
|
proc {tracer.process_ended}
|
158
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.22
|
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-24 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
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.0.6
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Raygun application performance monitoring for Rails
|