builder_apm 0.5.3 → 0.5.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d92ead706d6d43ec760d3aa3013f130be9a6cf096282b194324c3563cd945a65
|
4
|
+
data.tar.gz: 05ba3ed9fbe3bf2dc505511087627b81ed5d4b6d3f441f103d84ef76ae8305f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d27c722cc27f63d497157fff8cdec589136b68f8ab18bbbd8fa0e7d9e13e4e9dc96b39656c6e717ab87158b700ada76beda0b192e6c2f5dfa224654c833cd4c3
|
7
|
+
data.tar.gz: bee94e64a77c9a7fb9a2d7ea08d8d711eac7d9d73fb08f8a66a798e8669ce8594d753292468e22139716b0718e53d2ded6b13831fff203efe75fa2b0e20135bd
|
@@ -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,51 @@ 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
|
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
|
-
|
47
|
-
gems_to_track.any? { |gem| tp.path.include?(File::SEPARATOR + gem) }
|
31
|
+
return false unless Thread.current[:request_id]
|
32
|
+
return false unless tp.path.start_with?(@root_path)
|
33
|
+
|
34
|
+
start_controller = Thread.current[:stack]&.first
|
35
|
+
start_controller && "#{tp.defined_class}##{tp.method_id}" == start_controller[:method]
|
36
|
+
|
37
|
+
# gems_to_track = BuilderApm.configuration.gems_to_track
|
38
|
+
# gems_to_track.any? { |gem| tp.path.include?(File::SEPARATOR + gem) }
|
48
39
|
end
|
49
40
|
|
50
41
|
def process_trace_point(tp)
|
51
42
|
if tp.event == :call || tp.event == :b_call || tp.event == :c_call
|
52
|
-
|
43
|
+
method_id = "#{tp.defined_class}##{tp.method_id}"
|
44
|
+
(@call_times[method_id]||= []) << Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
45
|
+
caller_info = caller_locations(4,1).first
|
46
|
+
calling_file_path = caller_info.absolute_path
|
47
|
+
calling_line_number = caller_info.lineno
|
48
|
+
|
49
|
+
method_call = {
|
50
|
+
method: method_id,
|
51
|
+
method_line: "#{tp.path.gsub(@root_path, '')}:#{tp.lineno}",
|
52
|
+
triggering_line: "#{calling_file_path.gsub(@root_path, '')}:#{calling_line_number}",
|
53
|
+
children: [],
|
54
|
+
start_time: Time.now.to_f * 1000,
|
55
|
+
sql_events: []
|
56
|
+
}
|
57
|
+
|
58
|
+
(Thread.current[:stack] ||= []).push(method_call)
|
53
59
|
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)
|
60
|
+
method_id = "#{tp.defined_class}##{tp.method_id}"
|
61
|
+
|
62
|
+
if @call_times.key?(method_id)
|
63
|
+
elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @call_times[method_id].pop
|
64
|
+
elapsed_time_in_ms = (elapsed_time * 1000).round(3)
|
65
|
+
@call_times.delete(method_id)
|
66
|
+
|
67
|
+
method_call = (Thread.current[:stack] ||= []).pop
|
68
|
+
method_call[:end_time] = Time.now.to_f * 1000
|
69
|
+
method_call[:duration] = elapsed_time_in_ms
|
70
|
+
|
71
|
+
if Thread.current[:stack]&.any?
|
72
|
+
Thread.current[:stack].last[:children].push(method_call)
|
73
|
+
else
|
74
|
+
Thread.current[:stack].push(method_call)
|
75
|
+
end
|
99
76
|
end
|
100
77
|
end
|
101
78
|
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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: builder_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Ketelle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|