railswatch_gem 0.1.2 → 0.1.3

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: c3c2f8707dde0136f3ec790ae46558c384646a71d656b3659f46473732a77b5c
4
- data.tar.gz: edec55e909ad43675ba436fac4337ee23a228988b8348cba5a8b9e99322c2f20
3
+ metadata.gz: a4ab7fecdace81bbd2d66eb61b06026abb547c6815fc59c67fb1137bd9aea0bd
4
+ data.tar.gz: 68fccbf28d63b0f133bd9a5d9ef19d93263d913686b7526726aa3b0b170f75aa
5
5
  SHA512:
6
- metadata.gz: 189aad8fdc06a51766bb19e4b4ded13f2b037839ae14dff7e2db632b8f1ae7a20b52d46dc81e60c95acf7603db804c46eae5240e31da6081b0d49e8786f77846
7
- data.tar.gz: 2d7c7ebeaf988bdffd24265bc5eb1cafe659f35b91e5bb5537725279e99de42db9ec646bd92f25b0623b32ca3924e8aa0d062d07d307a8fd0dab5c431ef99be3
6
+ metadata.gz: d0bb1ccbf5d4a199990f9a20bb5ebc937a3eeccef63761d54cf301b1d29977672767ee9815cb7309788cfdcf01769118cde1b2528e70f7140d7f47817545c99c
7
+ data.tar.gz: a757ce0625f2a52679d44a93c5b0ee13c188b66f304a76888396ede5e1d3c42f144bd2c813eadcd8aeb7c31593034ddd74c1aad6e113ce73ac50a1d10b4e1a05
@@ -33,7 +33,7 @@ module RailswatchGem
33
33
 
34
34
  data = {
35
35
  event_type: "cache",
36
- timestamp: Time.at(event.end).utc.iso8601(6),
36
+ timestamp: Time.at(event.time).utc.iso8601(6),
37
37
  action: action,
38
38
  key: payload[:key],
39
39
 
@@ -37,7 +37,7 @@ module RailswatchGem
37
37
 
38
38
  data = {
39
39
  event_type: "command",
40
- timestamp: Time.at(event.end).utc.iso8601(6),
40
+ timestamp: Time.at(event.time).utc.iso8601(6),
41
41
 
42
42
  # Command Identity
43
43
  name: command_name,
@@ -23,7 +23,19 @@ module RailswatchGem
23
23
  # 1. Infinite Loop Protection
24
24
  return if error.class.name.start_with?("RailswatchGem::")
25
25
 
26
- # 2. Context Correlation
26
+ # 2. Capture Backtrace Smartly
27
+ # If error.backtrace is nil (un-raised exception), use the current caller.
28
+ raw_trace = error.backtrace || caller
29
+
30
+ # Clean the trace to remove framework noise (gems, rails internals)
31
+ # This ensures we see the User's code, not the Gem's code.
32
+ clean_trace = if defined?(::Rails.backtrace_cleaner)
33
+ ::Rails.backtrace_cleaner.clean(raw_trace)
34
+ else
35
+ raw_trace
36
+ end
37
+
38
+ # 3. Context Correlation
27
39
  request_id = context[:request_id] || Thread.current[:railswatch_request_id]
28
40
 
29
41
  data = {
@@ -33,10 +45,10 @@ module RailswatchGem
33
45
  # Exception Details
34
46
  class: error.class.name,
35
47
  message: error.message,
36
- # Limit backtrace to save bandwidth
37
- backtrace: (error.backtrace || []).first(25),
38
48
 
39
- # Rails Error Reporter Context
49
+ backtrace: clean_trace.first(25),
50
+
51
+ # Rails Context
40
52
  handled: handled,
41
53
  severity: severity,
42
54
  source: source,
@@ -38,7 +38,7 @@ module RailswatchGem
38
38
 
39
39
  data = {
40
40
  event_type: "job",
41
- timestamp: Time.at(event.end).utc.iso8601(6),
41
+ timestamp: Time.at(event.time).utc.iso8601(6),
42
42
 
43
43
  # Job Identity
44
44
  job_class: job.class.name,
@@ -32,7 +32,7 @@ module RailswatchGem
32
32
 
33
33
  data = {
34
34
  event_type: "mail",
35
- timestamp: Time.at(event.end).utc.iso8601(6),
35
+ timestamp: Time.at(event.time).utc.iso8601(6),
36
36
 
37
37
  # Identity
38
38
  mailer: payload[:mailer],
@@ -37,7 +37,7 @@ module RailswatchGem
37
37
  data = {
38
38
  event_type: "notification",
39
39
  name: event.name,
40
- timestamp: Time.at(event.end).utc.iso8601(6),
40
+ timestamp: Time.at(event.time).utc.iso8601(6),
41
41
  duration_ms: event.duration.round(2),
42
42
  request_id: request_id
43
43
  }
@@ -40,7 +40,7 @@ module RailswatchGem
40
40
 
41
41
  data = {
42
42
  event_type: "outgoing_request",
43
- timestamp: Time.at(event.end).utc.iso8601(6),
43
+ timestamp: Time.at(event.time).utc.iso8601(6),
44
44
 
45
45
  # Request Details
46
46
  method: payload[:method],
@@ -38,7 +38,7 @@ module RailswatchGem
38
38
  event_type: "query",
39
39
 
40
40
  # Without this, the query logs might look 0ms off from the request logs.
41
- timestamp: Time.at(event.end).utc.iso8601(6),
41
+ timestamp: Time.at(event.time).utc.iso8601(6),
42
42
 
43
43
  # Query Details
44
44
  name: name || "SQL",
@@ -39,7 +39,7 @@ module RailswatchGem
39
39
 
40
40
  data = {
41
41
  event_type: "request",
42
- timestamp: Time.at(event.end).utc.iso8601(6),
42
+ timestamp: Time.at(event.time).utc.iso8601(6),
43
43
  request_id: request_id,
44
44
 
45
45
  # HTTP Context
@@ -43,7 +43,7 @@ module RailswatchGem
43
43
 
44
44
  data = {
45
45
  event_type: "scheduled_task",
46
- timestamp: Time.at(event.end).utc.iso8601(6),
46
+ timestamp: Time.at(event.time).utc.iso8601(6),
47
47
 
48
48
  # Task Identity
49
49
  name: task_name,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailswatchGem
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railswatch_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Hammett