raygun-apm-rails 1.0.15 → 1.0.16
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/lib/raygun/apm/rails/middleware.rb +24 -17
- data/lib/raygun/apm/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 910685e3adfe69c88e8386cb97c52b39cfee2bea3d24749e8fab7c6a8a1103cf
|
4
|
+
data.tar.gz: b53ff2418459434687b85c3a09bef529bb326b6e01823945452baa5c32d71262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68661256cec7214dde186391a088d81e88ac4c978e6837b3eeeee2cd87b1b39b77fdc2aaa8e5a0fa85776d2c81ebc86d1a0f798fe6fff47120c19763b4add0f5
|
7
|
+
data.tar.gz: 4298329b5444c9ec7869a53a2ed111e92847b75eb0288edcd13e219eb0716bc8de5bf84edde6c7a55daba70be0b084f5fda5577937f90be4ed6f6cf991bc6e7d
|
@@ -4,23 +4,7 @@ module Raygun
|
|
4
4
|
class Middleware
|
5
5
|
def initialize(app)
|
6
6
|
@app = app
|
7
|
-
@tracer =
|
8
|
-
@tracer.udp_sink!
|
9
|
-
@tracer.process_started
|
10
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@tracer))
|
11
|
-
|
12
|
-
@http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
|
13
|
-
http_in_handler(args)
|
14
|
-
end
|
15
|
-
|
16
|
-
@sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
17
|
-
sql_handler(args)
|
18
|
-
end
|
19
|
-
|
20
|
-
GC.stress = true if ENV['RAYGUN_STRESS_GC']
|
21
|
-
# If any fatal errors on init, shutdown the tracer
|
22
|
-
rescue Raygun::Apm::FatalError => e
|
23
|
-
raygun_shutdown_handler(e)
|
7
|
+
@tracer = nil
|
24
8
|
end
|
25
9
|
|
26
10
|
def call(env)
|
@@ -33,6 +17,7 @@ module Raygun
|
|
33
17
|
def instrument(env)
|
34
18
|
res = nil
|
35
19
|
# Can be nil if we had a fatal error
|
20
|
+
@tracer ||= init_tracer
|
36
21
|
if @tracer
|
37
22
|
# For the exceptional HTTP IN handler
|
38
23
|
@request_started = @tracer.now
|
@@ -50,6 +35,28 @@ module Raygun
|
|
50
35
|
raygun_shutdown_handler(e)
|
51
36
|
end
|
52
37
|
|
38
|
+
def init_tracer
|
39
|
+
return @tracer if @tracer
|
40
|
+
@tracer = Raygun::Apm::Tracer.new
|
41
|
+
@tracer.udp_sink!
|
42
|
+
@tracer.process_started
|
43
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@tracer))
|
44
|
+
|
45
|
+
@http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
|
46
|
+
http_in_handler(args)
|
47
|
+
end
|
48
|
+
|
49
|
+
@sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
50
|
+
sql_handler(args)
|
51
|
+
end
|
52
|
+
|
53
|
+
GC.stress = true if ENV['RAYGUN_STRESS_GC']
|
54
|
+
@tracer
|
55
|
+
# If any fatal errors on init, shutdown the tracer
|
56
|
+
rescue Raygun::Apm::FatalError => e
|
57
|
+
raygun_shutdown_handler(e)
|
58
|
+
end
|
59
|
+
|
53
60
|
def raygun_shutdown_handler(exception)
|
54
61
|
warn "[Raygun APM] shutting down due to error - #{exception.message} #{exception.backtrace.join("\n")}",
|
55
62
|
# Kill extended event subcriptions
|