callstacking-rails 0.1.36 → 0.1.38

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: 5bec15f7021fd8dc471e7c1c6a1c77809d83ef10f9f8689bc6a77436570eacaa
4
- data.tar.gz: 2125659cc1c9696fa7d36e7b62fc028d3fc499a6bded81f13f0cd8afd14a79ce
3
+ metadata.gz: f2ec5f755326bf3ff3f9f11b95efc965f51cda6f8638871903e9d34ffc0c21d6
4
+ data.tar.gz: 4b667c05824c43681b1cd7c1174314895ad2e6c64e388faaa95b27b63b7593bf
5
5
  SHA512:
6
- metadata.gz: 85c474951aba42deb68dc55e81a3e97c79595deb7820b0c3e7b14a447b7030c450c3d1c170487bf9d84d1094f242f9a024b3c83d16b9524202cd0907b97137d1
7
- data.tar.gz: b841f58228f06ef87986d1a488cf04c840abace6619b18c90bb4a6c5a1b783524b7d25dd226d5f1f9a08b41d5a67a0eeb13e6e1935aa0fb4248927b3cd6fc653
6
+ metadata.gz: 4b31b6c061b7d2c92c258616c1ae6be21e69de9752ba2115f25e373391acdf10531245e5961ce619c67b66ee6c5841819f10d4e1bbb06a38cd79fff31242765b
7
+ data.tar.gz: d7fd6bf8f1954efcc15455d1f7bfbfefb2c670bfbf95d4db589a46faa9cd495d156f157e484ecd7b5f225d50cd6506a61c77597ff6cc5adf75578a74ef913801
@@ -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.now.utc
8
9
  Callstacking::Rails::Engine.start_tracing(self)
9
10
 
10
11
  yield
11
12
  rescue Exception => e
13
+ @last_callstacking_exception = Time.now.utc
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.38"
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.38
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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails