callstacking-rails 0.1.36 → 0.1.37

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: 5bec15f7021fd8dc471e7c1c6a1c77809d83ef10f9f8689bc6a77436570eacaa
4
- data.tar.gz: 2125659cc1c9696fa7d36e7b62fc028d3fc499a6bded81f13f0cd8afd14a79ce
3
+ metadata.gz: c8f0e31ee61913c798aa308ed0d92c76b8755cc0f6a884c0530792a23a0632e8
4
+ data.tar.gz: 04f3fe70825ec3f94c4d3b2d6c700cb55f457444376ffb066884a80ad4a5fb37
5
5
  SHA512:
6
- metadata.gz: 85c474951aba42deb68dc55e81a3e97c79595deb7820b0c3e7b14a447b7030c450c3d1c170487bf9d84d1094f242f9a024b3c83d16b9524202cd0907b97137d1
7
- data.tar.gz: b841f58228f06ef87986d1a488cf04c840abace6619b18c90bb4a6c5a1b783524b7d25dd226d5f1f9a08b41d5a67a0eeb13e6e1935aa0fb4248927b3cd6fc653
6
+ metadata.gz: 4b90cd3642f0b451347aae60efe9174400c66c155d2d5f19b719b9a21c73f730c5a0a3748aa2d0d736c9f001d2e9027a070429a7653bb6e4aa112328fc7ee120
7
+ data.tar.gz: a42354436d3edbc0d8b02878731435f9b3b2f23b7281f011cae9b8fff8220750d4081fc75572595b132560c75d87de1f150df8a9fb8a4c8ace4f591f40f1af3b
@@ -5,16 +5,36 @@ module Callstacking
5
5
  extend ActiveSupport::Concern
6
6
  def callstacking_setup
7
7
  exception = nil
8
+ @last_callstacking_sample = TIme.utc.now
8
9
  Callstacking::Rails::Engine.start_tracing(self)
9
10
 
10
11
  yield
11
12
  rescue Exception => e
13
+ @last_callstacking_exception = Time.utc.now
12
14
  exception = e
13
15
  raise e
14
16
  ensure
15
17
  Callstacking::Rails::Engine.stop_tracing(self, exception)
16
18
  end
17
19
  end
20
+
21
+ def callstcking_sample_trace?
22
+ if @last_callstacking_exception.present? && @last_callstacking_exception < 1.minute.ago
23
+ @last_callstacking_exception = nil
24
+ return true
25
+ end
26
+
27
+ false
28
+ end
29
+
30
+ def callstacking_followup_exception_trace?
31
+ if @last_callstacking_sample.present? && @last_callstacking_sample < 1.hour.ago
32
+ @last_callstacking_exception = nil
33
+ return true
34
+ end
35
+
36
+ false
37
+ end
18
38
  end
19
39
  end
20
40
  end
@@ -39,8 +39,8 @@ module Callstacking
39
39
 
40
40
  method_name = __method__
41
41
 
42
- path = method(__method__).super_method.source_location.first
43
- line_no = method(__method__).super_method.source_location.last
42
+ path = method(__method__).super_method.source_location&.first || ''
43
+ line_no = method(__method__).super_method.source_location&.last || ''
44
44
 
45
45
  p, l = caller.find { |c| c.to_s =~ /#{::Rails.root.to_s}/}&.split(':')
46
46
 
@@ -64,8 +64,8 @@ module Callstacking
64
64
 
65
65
  method_name = __method__
66
66
 
67
- path = method(__method__).super_method.source_location.first
68
- line_no = method(__method__).super_method.source_location.last
67
+ path = method(__method__).super_method.source_location&.first || ''
68
+ line_no = method(__method__).super_method.source_location&.last || ''
69
69
 
70
70
  p, l = caller.find { |c| c.to_s =~ /#{::Rails.root.to_s}/}&.split(':')
71
71
 
@@ -1,5 +1,5 @@
1
1
  module Callstacking
2
2
  module Rails
3
- VERSION = "0.1.36"
3
+ VERSION = "0.1.37"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callstacking-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.36
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Jones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-18 00:00:00.000000000 Z
11
+ date: 2023-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails