builder_apm 0.3.0 → 0.3.2

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: 31a9a4393e090f4980960c61d6f5cb2cf307a352534b9f8f264c2238dcd281f4
4
- data.tar.gz: a01935162ea2b1fa2701a080536aadc6259c3a9c102148ef1df4475ddd7a89de
3
+ metadata.gz: 8c694ae0d5543f44bb905abf9456e8768e3ae547bd99066fe0012f12e11aa89f
4
+ data.tar.gz: 1df6c105dbe848d600f1ae5197a64c2fe2816584072d4fb82ee69850dc6f61d6
5
5
  SHA512:
6
- metadata.gz: 61269a7ae1127eebfbdec316e015e64e6e0a76b23d81433c1a2569f4ccfabbebccc289d4f5588dfa46ac100d33dd5269fdc6e37208167598cdee7e6066ec35d5
7
- data.tar.gz: 3736371f1c53590cf7e811c19fa7262e70470f50207d414087a08967bd3cdc7375f93a9256906df7ce44bb10aa14b887045da11144791169ca6a861cf19e02c3
6
+ metadata.gz: 21f191411ce9106d7db006b92dc12ffd72efa414f62730f42bb26cdacc77ac0f841d9cabb2be482128ce3577ea9f67f5eadf8421c7ed6d0a826ab924cb40ef35
7
+ data.tar.gz: fcc1962c887a01e84cca5b1a7afa1deced47ef7ffcadefe2d26db6126f56c9bc99b7d0b52b9e65296ccf5a4af01bd6c131d043d50c370990364c37d6e0733637
@@ -47,13 +47,14 @@ $(document).ready(function() {
47
47
  $('<td>').append(renderDuration(item['view_runtime'])).appendTo(row);
48
48
  // Action column
49
49
  var actionTd = $('<td>');
50
- var actionButton = $('<button>').text('Details');
51
- actionButton.on('click', function() {
52
- // Replace 'your-details-url' with the actual URL where the details are to be fetched.
53
- // It's assumed the ID is required as a URL parameter, modify as per your requirements.
54
- window.location.href = '<%= request_details_path %>?request_id=' + item['request_id'];
55
- });
56
- actionButton.appendTo(actionTd);
50
+
51
+ if(item.stack && item.stack.length > 0) {
52
+
53
+ var actionLink = $('<a>').text('Details');
54
+ actionLink.attr('href', '<%= request_details_path %>?request_id=' + item['request_id']);
55
+ actionLink.attr('target', '_blank');
56
+ actionLink.appendTo(actionTd);
57
+ }
57
58
  actionTd.appendTo(row);
58
59
 
59
60
  // Append the row to the table body
@@ -48,13 +48,14 @@ $(document).ready(function() {
48
48
  $('<td>').append(renderDuration(item['view_runtime'])).appendTo(row);
49
49
  // Action column
50
50
  var actionTd = $('<td>');
51
- var actionButton = $('<button>').text('Details');
52
- actionButton.on('click', function() {
53
- // Replace 'your-details-url' with the actual URL where the details are to be fetched.
54
- // It's assumed the ID is required as a URL parameter, modify as per your requirements.
55
- window.location.href = '<%= request_details_path %>?request_id=' + item['request_id'];
56
- });
57
- actionButton.appendTo(actionTd);
51
+
52
+ if(item.stack && item.stack.length > 0) {
53
+
54
+ var actionLink = $('<a>').text('Details');
55
+ actionLink.attr('href', '<%= request_details_path %>?request_id=' + item['request_id']);
56
+ actionLink.attr('target', '_blank');
57
+ actionLink.appendTo(actionTd);
58
+ }
58
59
  actionTd.appendTo(row);
59
60
 
60
61
  // Append the row to the table body
Binary file
Binary file
Binary file
@@ -15,10 +15,11 @@ module BuilderApm
15
15
  end
16
16
 
17
17
  def process_start(event)
18
- return if event.payload[:controller].nil? || event.payload[:controller].start_with?("BuilderApm::")
18
+ return if event.payload[:controller].nil? # || event.payload[:controller].start_with?("BuilderApm::")
19
19
 
20
20
  uuid = event.payload[:headers].env['action_dispatch.request_id']
21
21
  Thread.current[:request_id] = uuid
22
+ Thread.current[:stack] = [setup_controller_stack_data(event)]
22
23
  end
23
24
 
24
25
  def process_action(event)
@@ -32,6 +33,21 @@ module BuilderApm
32
33
 
33
34
  private
34
35
 
36
+ def setup_controller_stack_data(event)
37
+ controller = event.payload[:controller]
38
+ method_id = "#{controller.constantize}##{event.payload[:action]}"
39
+ method_line = file_and_line_number(event.payload[:controller], event.payload[:action])
40
+
41
+ {
42
+ method: method_id,
43
+ method_line: "#{method_line}",
44
+ triggering_line: "",
45
+ children: [],
46
+ start_time: Time.now.to_f * 1000,
47
+ sql_events: []
48
+ }
49
+ end
50
+
35
51
  def event_from_args(*args)
36
52
  data = args.extract_options!
37
53
  ActiveSupport::Notifications::Event.new(*args, data)
@@ -23,7 +23,7 @@ module BuilderApm
23
23
  end
24
24
 
25
25
  def valid_trace_point?(tp)
26
- !Thread.current[:request_id].nil? && tp.path.start_with?(@root_path)
26
+ !Thread.current[:request_id].nil? && tp.path.start_with?(@root_path) && !tp.path.include?('controller.rb')
27
27
  end
28
28
 
29
29
  def process_trace_point(tp)
@@ -39,7 +39,10 @@ module BuilderApm
39
39
  data[:real_start_time] = start_time
40
40
  data[:real_end_time] = end_time
41
41
  data[:real_duration_time] = end_time - start_time
42
-
42
+ data[:stack][0][:start_time] = start_time
43
+ data[:stack][0][:end_time] = end_time
44
+ data[:stack][0][:duration] = end_time - start_time
45
+
43
46
  begin
44
47
  @redis_client.pipelined do |pipeline|
45
48
  pipeline.rpush("builder_apm:Analysis:#{data[:controller]}##{data[:action]}:duration", data[:real_duration_time]||0)
@@ -1,3 +1,3 @@
1
1
  module BuilderApm
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
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.3.0
4
+ version: 0.3.2
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-07-25 00:00:00.000000000 Z
11
+ date: 2023-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,9 @@ files:
94
94
  - app/views/builder_apm/wip/index.html.erb
95
95
  - bin/console
96
96
  - bin/setup
97
+ - builder_apm-0.2.5.gem
98
+ - builder_apm-0.3.0.gem
99
+ - builder_apm-0.3.1.gem
97
100
  - builder_apm.gemspec
98
101
  - config/routes.rb
99
102
  - lib/builder_apm.rb