builder_apm 0.5.3 → 0.5.4
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: 3ba1912b1e309f8f3c0f215eaa29be48724f52acfdfd82aa41b5238c739ec3cb
|
4
|
+
data.tar.gz: b97fad9c760392060531925110503806d57d4ab72402054512006077d391ee08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e401a85d41e465c1845b6a3c5ed98e9b04b906e792549831636b5f7fa5571567fe10e62fc3244d2337d3822d6aa67ddb59583cf8d0e5534e95cb5e84145da807
|
7
|
+
data.tar.gz: d3bd84d4d9c4c35880e9cb3d30c8bb27af8021223dd6e97ec570b53090741232b07d65b9727345047e2c7ded811cc91446ce631a4e7cefa1abc7767c4ec3c117
|
@@ -346,6 +346,7 @@
|
|
346
346
|
|
347
347
|
// Check if results are more than 50
|
348
348
|
if (item.record_count > 50) {
|
349
|
+
resultsSpan.append('🚨');
|
349
350
|
resultsSpan.addClass('highlight-results').attr('title', "This is a large number of results. Review if this can be paginated or limited.");
|
350
351
|
}
|
351
352
|
|
@@ -20,6 +20,8 @@ module BuilderApm
|
|
20
20
|
uuid = event.payload[:headers].env['action_dispatch.request_id']
|
21
21
|
Thread.current[:request_id] = uuid
|
22
22
|
Thread.current[:stack] = [setup_controller_stack_data(event)]
|
23
|
+
Thread.current[:method_tracing] = 0
|
24
|
+
Thread.current[:db_tracing] = 0
|
23
25
|
end
|
24
26
|
|
25
27
|
def process_action(event)
|
@@ -28,74 +28,52 @@ module BuilderApm
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def valid_trace_point?(tp)
|
31
|
-
Thread.current[:request_id]
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
start_controller = Thread.current[:stack]&.first
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
"#{tp.defined_class}##{tp.method_id}" != start_controller[:method]
|
40
|
-
end
|
41
|
-
|
42
|
-
def valid_gem_path(tp)
|
43
|
-
return true if tp.path.start_with?(@root_path)
|
44
|
-
return false if tp.path.start_with?(@this_gem_path)
|
45
|
-
return false if gems_to_track.empty?
|
46
|
-
|
31
|
+
return false unless Thread.current[:request_id]
|
32
|
+
return false unless tp.path.start_with?(@root_path)
|
33
|
+
# return false if tp.path.start_with?(@this_gem_path)
|
34
|
+
|
35
|
+
start_controller = Thread.current[:stack]&.first
|
36
|
+
return false if start_controller && "#{tp.defined_class}##{tp.method_id}" == start_controller[:method]
|
37
|
+
|
38
|
+
gems_to_track = BuilderApm.configuration.gems_to_track
|
47
39
|
gems_to_track.any? { |gem| tp.path.include?(File::SEPARATOR + gem) }
|
48
40
|
end
|
49
41
|
|
50
42
|
def process_trace_point(tp)
|
51
43
|
if tp.event == :call || tp.event == :b_call || tp.event == :c_call
|
52
|
-
|
44
|
+
method_id = "#{tp.defined_class}##{tp.method_id}"
|
45
|
+
(@call_times[method_id]||= []) << Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
46
|
+
caller_info = caller_locations(4,1).first
|
47
|
+
calling_file_path = caller_info.absolute_path
|
48
|
+
calling_line_number = caller_info.lineno
|
49
|
+
|
50
|
+
method_call = {
|
51
|
+
method: method_id,
|
52
|
+
method_line: "#{tp.path.gsub(@root_path, '')}:#{tp.lineno}",
|
53
|
+
triggering_line: "#{calling_file_path.gsub(@root_path, '')}:#{calling_line_number}",
|
54
|
+
children: [],
|
55
|
+
start_time: Time.now.to_f * 1000,
|
56
|
+
sql_events: []
|
57
|
+
}
|
58
|
+
|
59
|
+
(Thread.current[:stack] ||= []).push(method_call)
|
53
60
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
method_call = {
|
72
|
-
method: method_id,
|
73
|
-
method_line: "#{tp.path.gsub(@root_path, '')}:#{tp.lineno}",
|
74
|
-
triggering_line: "#{calling_file_path.gsub(@root_path, '')}:#{calling_line_number}",
|
75
|
-
children: [],
|
76
|
-
start_time: Time.now.to_f * 1000,
|
77
|
-
sql_events: []
|
78
|
-
}
|
79
|
-
|
80
|
-
(Thread.current[:stack] ||= []).push(method_call)
|
81
|
-
end
|
82
|
-
|
83
|
-
def process_return_event(tp)
|
84
|
-
method_id = "#{tp.defined_class}##{tp.method_id}"
|
85
|
-
|
86
|
-
if @call_times.key?(method_id)
|
87
|
-
elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @call_times[method_id].pop
|
88
|
-
elapsed_time_in_ms = (elapsed_time * 1000).round(3)
|
89
|
-
@call_times.delete(method_id)
|
90
|
-
|
91
|
-
method_call = (Thread.current[:stack] ||= []).pop
|
92
|
-
method_call[:end_time] = Time.now.to_f * 1000
|
93
|
-
method_call[:duration] = elapsed_time_in_ms
|
94
|
-
|
95
|
-
if Thread.current[:stack]&.any?
|
96
|
-
Thread.current[:stack].last[:children].push(method_call)
|
97
|
-
else
|
98
|
-
Thread.current[:stack].push(method_call)
|
61
|
+
method_id = "#{tp.defined_class}##{tp.method_id}"
|
62
|
+
|
63
|
+
if @call_times.key?(method_id)
|
64
|
+
elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @call_times[method_id].pop
|
65
|
+
elapsed_time_in_ms = (elapsed_time * 1000).round(3)
|
66
|
+
@call_times.delete(method_id)
|
67
|
+
|
68
|
+
method_call = (Thread.current[:stack] ||= []).pop
|
69
|
+
method_call[:end_time] = Time.now.to_f * 1000
|
70
|
+
method_call[:duration] = elapsed_time_in_ms
|
71
|
+
|
72
|
+
if Thread.current[:stack]&.any?
|
73
|
+
Thread.current[:stack].last[:children].push(method_call)
|
74
|
+
else
|
75
|
+
Thread.current[:stack].push(method_call)
|
76
|
+
end
|
99
77
|
end
|
100
78
|
end
|
101
79
|
end
|
@@ -7,6 +7,7 @@ module BuilderApm
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
+
start_time = Time.now.to_f * 1000
|
10
11
|
request_id = env["action_dispatch.request_id"]
|
11
12
|
Thread.current[:request_id] = request_id
|
12
13
|
Thread.current[:n_plus_one_duration] = 0
|
@@ -14,7 +15,6 @@ module BuilderApm
|
|
14
15
|
Thread.current[:db_runtime] = 0
|
15
16
|
Thread.current[:method_tracing] = 0
|
16
17
|
Thread.current[:db_tracing] = 0
|
17
|
-
start_time = Time.now.to_f * 1000
|
18
18
|
|
19
19
|
@status, @headers, @response = @app.call(env)
|
20
20
|
|
data/lib/builder_apm/version.rb
CHANGED