raygun-apm-rails 0.1.13 → 0.1.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: feedfb6825f3dbe8893072208bc6904f1a838fb785b0b771aa39276a7bf6c60a
4
- data.tar.gz: 8e3ba8a42d36bbeb70ca0cd7666e0275620e3f14f65b0f1f9ab7f32104842f8f
3
+ metadata.gz: b32dbda41f5ec97d4087eeb129cf4e931c8c836a028aac5aa44d3f1d7d4f8107
4
+ data.tar.gz: c31b24a26171d71c30fa745a74a749ab72c98275aa26f736bb4d67fe8b927f33
5
5
  SHA512:
6
- metadata.gz: 44ddcc5ac107e35f6ef4ca34200cae8253f988847d325f8a96456f03a9d6a8e903e68af259d5091efbcb931a9590e4910f953d8e2597ef073e5516b6f5351cd6
7
- data.tar.gz: aaa9672094ac627d4f5cf2d8c52d193e1928e2d02713f000a748c8b6529737acd46228eed2d6aa1490ac6df8c33b5848c9f85d3bf62e43431485f32944194487
6
+ metadata.gz: 7a7ee9fab13361fa65fc5eb18d24e39bad80497c9c46255a1bc8b105ba903d81dfa7b2a0eccbc34a7000f274b3ec443a32926c5d2c6029bd969d1e6c28cd5455
7
+ data.tar.gz: 5b51e1e1b60bdca91f7faa8be9f7ab4eea2237e17d3bc6e37afcac77f7bd7e205118c6470af3353792d6bfb5c39a5892e714220d66b5583d6c82ebf5b79bb9fb
@@ -7,10 +7,8 @@ module Raygun
7
7
 
8
8
  # from https://api.rubyonrails.org/ , to automate
9
9
  BLACKLIST = %w{
10
- #<Class:
11
- #<Module:
12
- #<ActiveRecord:
13
- #<ActiveModel:
10
+ #<ActiveRecord
11
+ #<ActiveModel
14
12
  Benchmark
15
13
  BigDecimal
16
14
  Concurrent
@@ -59,10 +57,7 @@ module Raygun
59
57
  Puma
60
58
  PG
61
59
  EnabledModule
62
- }
63
-
64
- BOUNDARY = %w{
65
- +RequestStore::Middleware::call
60
+ +Raygun::Apm::Rails::Middleware::start_of_trace
66
61
  }
67
62
  end
68
63
  end
@@ -33,21 +33,25 @@ module Raygun
33
33
  Thread.current.thread_variable_set(:_raygun_apm_tracer, @tracer)
34
34
  @tracer.start_trace
35
35
  end
36
- res = @app.call(env)
36
+ res = start_of_trace{ @app.call(env) }
37
37
  # Can be nil if we had a fatal error
38
38
  @tracer.end_trace if @tracer
39
39
  res
40
40
  rescue Raygun::Apm::FatalError => e
41
41
  raygun_shutdown_handler(e)
42
42
  end
43
-
43
+
44
44
  def raygun_shutdown_handler(exception)
45
- warn "Raygun APM shutting down due to error - %s", e.message
45
+ warn "[Raygun APM] shutting down due to error - #{exception.message}",
46
46
  # Kill extended event subcriptions
47
47
  ActiveSupport::Notifications.unsubscribe(@http_in_subscriber)
48
48
  ActiveSupport::Notifications.unsubscribe(@sql_subscriber)
49
+ warn "[Raygun APM] notification hooks unsubscribed"
49
50
  # Shutdown the tracepoint if enabled to reduce any overhead and stall emission
50
- @tracer.tracepoint.stop if @tracer.tracepoint.enabled?
51
+ if @tracer.tracepoint.enabled?
52
+ @tracer.tracepoint.stop
53
+ warn "[Raygun APM] tracepoint stopped"
54
+ end
51
55
  # Let the GC clean up the sink thread through the finalizer below
52
56
  @tracer = nil
53
57
  Thread.current.thread_variable_set(:_raygun_apm_tracer, nil)
@@ -66,11 +70,12 @@ module Raygun
66
70
  event[:status] = notification.payload[:status]
67
71
  # XXX constant milliseconds to microseconds
68
72
  event[:duration] = notification.duration * 1000
69
- event[:timestamp] = notification.time.to_f * 1000000
73
+ event[:timestamp] = @tracer.now
70
74
  event[:tid] = @tracer.get_thread_id(Thread.current)
71
75
  @tracer.emit(event)
72
76
  rescue => e
73
77
  warn "[Raygun APM] error reporting HTTP IN event"
78
+ raygun_shutdown_handler(e)
74
79
  end
75
80
 
76
81
  def http_in_event
@@ -105,6 +110,7 @@ module Raygun
105
110
  @tracer.emit(event)
106
111
  rescue => e
107
112
  warn "[Raygun APM] error reporting SQL event"
113
+ raygun_shutdown_handler(e)
108
114
  end
109
115
 
110
116
  def sql_event
@@ -115,6 +121,10 @@ module Raygun
115
121
  end
116
122
  end
117
123
 
124
+ def start_of_trace
125
+ yield
126
+ end
127
+
118
128
  def self.finalize(tracer)
119
129
  proc {tracer.process_ended}
120
130
  end
@@ -6,8 +6,7 @@ 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
- Raygun::Apm::Blacklist.extend_with Raygun::Apm::Rails::BOUNDARY
10
- app.middleware.insert_before Rack::Sendfile, Raygun::Apm::Rails::Middleware
9
+ app.middleware.use Raygun::Apm::Rails::Middleware
11
10
  # Explictly enable instrumenting HTTP until a good control API is figured out
12
11
  require "raygun/apm/hooks/net_http"
13
12
  end
@@ -1,7 +1,7 @@
1
1
  module Raygun
2
2
  module Apm
3
3
  module Rails
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.18"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raygun-apm-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erkki Eilonen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-06 00:00:00.000000000 Z
11
+ date: 2020-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raygun-apm