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 +4 -4
- data/lib/railswatch_gem/instrumentation/cache_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/commands_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/errors_instrumenter.rb +16 -4
- data/lib/railswatch_gem/instrumentation/jobs_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/mail_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/notifications_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/outgoing_requests_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/queries_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/requests_instrumenter.rb +1 -1
- data/lib/railswatch_gem/instrumentation/scheduled_tasks_instrumenter.rb +1 -1
- data/lib/railswatch_gem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4ab7fecdace81bbd2d66eb61b06026abb547c6815fc59c67fb1137bd9aea0bd
|
|
4
|
+
data.tar.gz: 68fccbf28d63b0f133bd9a5d9ef19d93263d913686b7526726aa3b0b170f75aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0bb1ccbf5d4a199990f9a20bb5ebc937a3eeccef63761d54cf301b1d29977672767ee9815cb7309788cfdcf01769118cde1b2528e70f7140d7f47817545c99c
|
|
7
|
+
data.tar.gz: a757ce0625f2a52679d44a93c5b0ee13c188b66f304a76888396ede5e1d3c42f144bd2c813eadcd8aeb7c31593034ddd74c1aad6e113ce73ac50a1d10b4e1a05
|
|
@@ -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.
|
|
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
|
-
|
|
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
|
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.
|
|
41
|
+
timestamp: Time.at(event.time).utc.iso8601(6),
|
|
42
42
|
|
|
43
43
|
# Query Details
|
|
44
44
|
name: name || "SQL",
|