callstacking-rails 0.1.35 → 0.1.36
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bec15f7021fd8dc471e7c1c6a1c77809d83ef10f9f8689bc6a77436570eacaa
|
4
|
+
data.tar.gz: 2125659cc1c9696fa7d36e7b62fc028d3fc499a6bded81f13f0cd8afd14a79ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c474951aba42deb68dc55e81a3e97c79595deb7820b0c3e7b14a447b7030c450c3d1c170487bf9d84d1094f242f9a024b3c83d16b9524202cd0907b97137d1
|
7
|
+
data.tar.gz: b841f58228f06ef87986d1a488cf04c840abace6619b18c90bb4a6c5a1b783524b7d25dd226d5f1f9a08b41d5a67a0eeb13e6e1935aa0fb4248927b3cd6fc653
|
@@ -73,7 +73,7 @@ module Callstacking
|
|
73
73
|
true
|
74
74
|
end
|
75
75
|
|
76
|
-
def self.stop_tracing(controller)
|
76
|
+
def self.stop_tracing(controller, exception)
|
77
77
|
Logger.log("Callstacking::Rails::Engine.stop_tracing")
|
78
78
|
|
79
79
|
settings.disable!
|
@@ -86,8 +86,12 @@ module Callstacking
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
trace&.end_trace(controller)
|
90
|
-
|
89
|
+
trace&.end_trace(controller, exception)
|
90
|
+
|
91
|
+
lock.synchronize do
|
92
|
+
spans[Thread.current.object_id]&.reset
|
93
|
+
end
|
94
|
+
|
91
95
|
true
|
92
96
|
end
|
93
97
|
end
|
@@ -4,11 +4,15 @@ module Callstacking
|
|
4
4
|
module InstrumentHelper
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
def callstacking_setup
|
7
|
+
exception = nil
|
7
8
|
Callstacking::Rails::Engine.start_tracing(self)
|
8
9
|
|
9
10
|
yield
|
11
|
+
rescue Exception => e
|
12
|
+
exception = e
|
13
|
+
raise e
|
10
14
|
ensure
|
11
|
-
Callstacking::Rails::Engine.stop_tracing(self)
|
15
|
+
Callstacking::Rails::Engine.stop_tracing(self, exception)
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
@@ -5,9 +5,7 @@ module Callstacking
|
|
5
5
|
attr_accessor :call_entry_callback, :call_return_callback
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
|
9
|
-
@order_num = -1
|
10
|
-
@previous_entry = nil
|
8
|
+
reset
|
11
9
|
end
|
12
10
|
|
13
11
|
def increment_order_num
|
@@ -40,6 +38,12 @@ module Callstacking
|
|
40
38
|
@call_return_callback = block
|
41
39
|
end
|
42
40
|
|
41
|
+
def reset
|
42
|
+
@nesting_level = -1
|
43
|
+
@order_num = -1
|
44
|
+
@previous_entry = nil
|
45
|
+
end
|
46
|
+
|
43
47
|
private
|
44
48
|
def previous_event(klass, method_name)
|
45
49
|
"#{klass}:#{method_name}"
|
@@ -5,6 +5,11 @@ require "callstacking/rails/helpers/heads_up_display_helper"
|
|
5
5
|
module Callstacking
|
6
6
|
module Rails
|
7
7
|
class Trace
|
8
|
+
TRACE_CALL_ENTRY = 'TraceCallEntry'
|
9
|
+
TRACE_CALL_RETURN = 'TraceCallReturn'
|
10
|
+
TRACE_MESSAGE = 'TraceMessage'
|
11
|
+
TRACE_EXCEPTION = 'TraceException'
|
12
|
+
|
8
13
|
include Callstacking::Rails::Helpers::HeadsUpDisplayHelper
|
9
14
|
|
10
15
|
attr_accessor :spans, :client, :lock, :traces
|
@@ -44,16 +49,16 @@ module Callstacking
|
|
44
49
|
controller.request.headers, controller.request.params, @traces)
|
45
50
|
end
|
46
51
|
|
47
|
-
def end_trace(controller)
|
52
|
+
def end_trace(controller, exception)
|
48
53
|
return if @trace_id.nil? || @tuid.nil?
|
49
54
|
|
50
|
-
complete_request(@trace_id, @tuid,
|
55
|
+
complete_request(@trace_id, @tuid, exception,
|
51
56
|
controller.action_name, controller.controller_name,
|
52
57
|
controller.action_name, controller.request.format,
|
53
58
|
controller.request&.original_url,
|
54
59
|
@traces, MAX_TRACE_ENTRIES)
|
55
60
|
|
56
|
-
inject_hud(@settings, controller.request, controller.response)
|
61
|
+
inject_hud(@settings, controller.request, controller.response) if ::Rails.env.development? || ::Rails.env.test?
|
57
62
|
end
|
58
63
|
|
59
64
|
def self.trace_log_clear
|
@@ -87,10 +92,15 @@ module Callstacking
|
|
87
92
|
"Started request: #{method} #{controller}##{action} as #{format}"
|
88
93
|
end
|
89
94
|
|
95
|
+
def exception_message(exception, method, controller, action, format)
|
96
|
+
"#{exception.class} #{exception.message}<br/><br/>" \
|
97
|
+
"#{exception.backtrace[0]}".html_safe
|
98
|
+
end
|
99
|
+
|
90
100
|
def create_call_return(tuid, coupled_callee, nesting_level, order_num, klass, method_name, path, line_no, return_val, traces)
|
91
101
|
lock.synchronize do
|
92
102
|
traces << { tuid: tuid,
|
93
|
-
type:
|
103
|
+
type: TRACE_CALL_RETURN,
|
94
104
|
order_num: order_num,
|
95
105
|
nesting_level: nesting_level,
|
96
106
|
local_variables: {},
|
@@ -109,7 +119,7 @@ module Callstacking
|
|
109
119
|
def create_call_entry(tuid, nesting_level, order_num, klass, method_name, arguments, path, line_no, traces)
|
110
120
|
lock.synchronize do
|
111
121
|
traces << { tuid: tuid,
|
112
|
-
type:
|
122
|
+
type: TRACE_CALL_ENTRY,
|
113
123
|
order_num: order_num,
|
114
124
|
nesting_level: nesting_level,
|
115
125
|
args: arguments,
|
@@ -125,10 +135,10 @@ module Callstacking
|
|
125
135
|
end
|
126
136
|
end
|
127
137
|
|
128
|
-
def create_message(tuid, message, order_num, traces)
|
138
|
+
def create_message(tuid, message, order_num, traces, type = TRACE_MESSAGE)
|
129
139
|
lock.synchronize do
|
130
140
|
traces << { tuid: tuid,
|
131
|
-
type:
|
141
|
+
type: type,
|
132
142
|
order_num: order_num,
|
133
143
|
nesting_level: 0,
|
134
144
|
message: message,
|
@@ -182,11 +192,17 @@ module Callstacking
|
|
182
192
|
url
|
183
193
|
end
|
184
194
|
|
185
|
-
def complete_request(trace_id, tuid, method, controller,
|
195
|
+
def complete_request(trace_id, tuid, exception, method, controller,
|
196
|
+
action, format, original_url, traces, max_trace_entries)
|
186
197
|
return if do_not_track_request?(original_url, format)
|
187
198
|
|
188
|
-
|
189
|
-
|
199
|
+
if exception.present?
|
200
|
+
create_message(tuid, exception_message(exception, method, controller, action, format),
|
201
|
+
spans.increment_order_num, traces, TRACE_EXCEPTION)
|
202
|
+
else
|
203
|
+
create_message(tuid, completed_request_message(method, controller, action, format),
|
204
|
+
spans.increment_order_num, traces)
|
205
|
+
end
|
190
206
|
|
191
207
|
send_traces!(trace_id, traces[0..max_trace_entries])
|
192
208
|
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.
|
4
|
+
version: 0.1.36
|
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-
|
11
|
+
date: 2023-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|