raygun-apm-rails 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79c1cf537ee9e8f781c49e3c2cc6cc74b8b38225e50e34bca773cae3cfdbc6b1
4
- data.tar.gz: 5bd799bfa20772be1aa736220be6bb9efbfdc0aeb07d6b5c84a24b9d3bda0ac5
3
+ metadata.gz: 910685e3adfe69c88e8386cb97c52b39cfee2bea3d24749e8fab7c6a8a1103cf
4
+ data.tar.gz: b53ff2418459434687b85c3a09bef529bb326b6e01823945452baa5c32d71262
5
5
  SHA512:
6
- metadata.gz: a9770fa4db4c1b7d7bdb1a3a404a84d57587f61fe68466cff9c11440396ce59d21a05fe26184b2e4ed5b229eaf6d50af6b801f72353a746d2e044624ea58686d
7
- data.tar.gz: a2282067547e6e0d0928f2c9269d97331ba98224d6f6078ded343a4e953ebc874f74aa9e5374fde64a4294958e5e4f16d939405f4fe4c7b60a5032fb8cf72330
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 = Raygun::Apm::Tracer.new
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
@@ -1,7 +1,7 @@
1
1
  module Raygun
2
2
  module Apm
3
3
  module Rails
4
- VERSION = "1.0.15"
4
+ VERSION = "1.0.16"
5
5
  end
6
6
  end
7
7
  end
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.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raygun