builder_apm 0.5.1 → 0.5.3

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: 204f52b000293324cc47566e57c0cfc3a1061262bb4daa85ade76ec733a78e84
4
- data.tar.gz: 95ee965f9d8b64a19951ce3335f6f8255668ad91d95947976d594d63edeb3eb1
3
+ metadata.gz: 1d4bce6745bf405a2373b99d571aed8e87ece7c99fd6041bfc2ce8965d3583e4
4
+ data.tar.gz: '0812e1ac70543838da93f3c586a1eae82801387cf9fb1735f0636b919a92690b'
5
5
  SHA512:
6
- metadata.gz: f34eb19856e557ce3c627245cbad8ff1a39cbdcaa23b313220cf9764af2ea97ad42e8beca9fdaa9d06625f3ec5e324140b00b28a3d76b7c1a4701c258a1d88aa
7
- data.tar.gz: e8be981fb87a3616d28e950e0421f69e622118bd27e5c0444fefe0e63660ec93ef434e180751e15d2499235eec3150ff640403302ee4718a8f54dd89722a8cfb
6
+ metadata.gz: ac4ea9b284511b3e4e0e6639099b178d47b30839bbdfa3b686d8a09fd551338540a76940013665ec53c0b3e7f694c06f64cf48b78696085a903e1527cdd6cd9b
7
+ data.tar.gz: '0608598b9404aea84e2d6ed6fa63bce8cf4d4b1f8454b4c77ceb69765947af7b2064742b2f95bf37179f291da3e69ab88d57bd86c11dc712fbb7aea349258d45'
@@ -227,6 +227,8 @@
227
227
  summaryDiv.append($('<span>').addClass('db_duration').text('DB Duration: ' + formatDuration(request.db_runtime) + 'ms'));
228
228
  summaryDiv.append($('<span>').addClass('view_duration').text('View Duration: ' + formatDuration(request.view_runtime) + 'ms'));
229
229
  summaryDiv.append($('<span>').addClass('method').text('Method: ' + request.method));
230
+ summaryDiv.append($('<span>').addClass('method_tracing_duration').text('APM Method Tracking Duration: ' + formatDuration(request.method_tracing) + 'ms'));
231
+ summaryDiv.append($('<span>').addClass('db_tracing_duration').text('APM DB Tracking Duration: ' + formatDuration(request.db_tracing) + 'ms'));
230
232
  summaryDiv.append($('<span>').addClass('params').text('Params: ' + JSON.stringify(request.params)));
231
233
 
232
234
  if (diagnosis.length === 0) { // Add the AiDoctor button
@@ -1,54 +1,56 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>BuilderApm Dashboard</title>
5
- <%= render 'builder_apm/css/main' %>
6
- <%= render 'builder_apm/css/dark' %>
7
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script>
9
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.css" />
10
- <%= render 'builder_apm/js/data_fetcher' %>
11
- <script>
12
- $(document).ready(function() {
3
+ <head>
4
+ <title>BuilderApm Dashboard</title>
5
+ <%= render 'builder_apm/css/main' %>
6
+ <%= render 'builder_apm/css/dark' %>
7
+ <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script>
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.css"/>
10
+ <%= render 'builder_apm/js/data_fetcher' %>
11
+ <script>
12
+ $(document).ready(function () { // Check for saved 'darkMode' in localStorage
13
+ if (localStorage.getItem('darkMode') === 'true') {
14
+ $('body').addClass('dark');
15
+ }
13
16
 
14
- // Check for saved 'darkMode' in localStorage
15
- if (localStorage.getItem('darkMode') === 'true') {
16
- $('body').addClass('dark');
17
- }
17
+ $('#clearData').on('click', function () {
18
+ localStorage.removeItem('builder_apm_requests');
19
+ localStorage.removeItem('builder_apm_cursor');
20
+ alert('Local Data Cleared');
21
+ });
22
+ $('#darkModeToggle').on('click', function () {
23
+ $('body').toggleClass('dark');
18
24
 
19
- $('#clearData').on('click', function() {
20
- localStorage.removeItem('builder_apm_requests');
21
- localStorage.removeItem('builder_apm_cursor');
22
- alert('Local Data Cleared');
23
- });
24
- $('#darkModeToggle').on('click', function() {
25
- $('body').toggleClass('dark');
26
-
27
- // Save the current mode in localStorage
28
- if ($('body').hasClass('dark')) {
29
- localStorage.setItem('darkMode', 'true');
30
- } else {
31
- localStorage.setItem('darkMode', 'false');
32
- }
33
- });
34
- $('body').show();
35
- });
36
- </script>
37
- </head>
38
- <body>
39
- <h1 id="header">BuilderApm Dashboard<span class="version"> (<%= BuilderApm::VERSION %>)</span></h1>
40
- <nav id="navbar">
41
- <ul>
42
- <li><%= link_to 'Dashboard', dashboard_path, class: ("active" if current_page?(dashboard_path)) %></li>
43
- <li><%= link_to 'Request Analysis', request_analysis_path, class: ("active" if current_page?(request_analysis_path)) %></li>
44
- <li><%= link_to '500 Errors', errors_500_path, class: ("active" if current_page?(errors_500_path)) %></li>
45
- <li><%= link_to 'Recent Requests', recent_requests_path, class: ("active" if current_page?(recent_requests_path)) %></li>
46
- <li><%= link_to 'Slow Requests', slow_requests_path, class: ("active" if current_page?(slow_requests_path)) %></li>
47
- <li><%= link_to 'N+1', n_plus_one_path, class: ("active" if current_page?(n_plus_one_path)) %></li>
48
- <li id="dark-mode-toggle"><button id="darkModeToggle" class="nav-button">Toggle Dark Mode</button></li>
49
- </ul>
50
- </nav>
51
- <div id="options">
52
- <input type="checkbox" id="autoUpdate" name="autoUpdate">
53
- <label for="autoUpdate">Auto-Update</label>
54
- </div>
25
+ // Save the current mode in localStorage
26
+ if ($('body').hasClass('dark')) {
27
+ localStorage.setItem('darkMode', 'true');
28
+ } else {
29
+ localStorage.setItem('darkMode', 'false');
30
+ }
31
+ });
32
+ $('body').show();
33
+ });
34
+ </script>
35
+ </head>
36
+ <body>
37
+ <h1 id="header">BuilderApm Dashboard<span class="version">
38
+ (<%= BuilderApm::VERSION %>)</span>
39
+ </h1>
40
+ <nav id="navbar">
41
+ <ul>
42
+ <li><%= link_to 'Dashboard', dashboard_path, class: ("active" if current_page?(dashboard_path)) %></li>
43
+ <li><%= link_to 'Request Analysis', request_analysis_path, class: ("active" if current_page?(request_analysis_path)) %></li>
44
+ <li><%= link_to '500 Errors', errors_500_path, class: ("active" if current_page?(errors_500_path)) %></li>
45
+ <li><%= link_to 'Recent Requests', recent_requests_path, class: ("active" if current_page?(recent_requests_path)) %></li>
46
+ <li><%= link_to 'Slow Requests', slow_requests_path, class: ("active" if current_page?(slow_requests_path)) %></li>
47
+ <li><%= link_to 'N+1', n_plus_one_path, class: ("active" if current_page?(n_plus_one_path)) %></li>
48
+ <li id="dark-mode-toggle">
49
+ <button id="darkModeToggle" class="nav-button">Toggle Dark Mode</button>
50
+ </li>
51
+ </ul>
52
+ </nav>
53
+ <div id="options">
54
+ <input type="checkbox" id="autoUpdate" name="autoUpdate">
55
+ <label for="autoUpdate">Load Older data</label>
56
+ </div>
@@ -17,7 +17,7 @@ module BuilderApm
17
17
  @enable_n_plus_one_profiler = true
18
18
  @api_key = nil
19
19
  @api = 'Bravo'
20
- @gems_to_track = ["bx_block_"]
20
+ @gems_to_track = []
21
21
  end
22
22
  end
23
23
  end
@@ -23,14 +23,12 @@ module BuilderApm
23
23
  me.process_trace_point(tp) if me.valid_trace_point?(tp)
24
24
  duration = (Time.now.to_f * 1000) - starttime
25
25
 
26
- Thread.current["method_tracing"] = (Thread.current["method_tracing"] ||= 0) + duration
26
+ Thread.current[:method_tracing] = (Thread.current[:method_tracing] ||= 0) + duration
27
27
  end
28
28
  end
29
29
 
30
30
  def valid_trace_point?(tp)
31
- return !Thread.current[:request_id].nil? && tp.path.start_with?(@root_path)
32
-
33
- # !Thread.current[:request_id].nil? && not_controller_endpoint(tp) && valid_gem_path(tp)
31
+ Thread.current[:request_id] && not_controller_endpoint(tp) && valid_gem_path(tp)
34
32
  end
35
33
 
36
34
  def not_controller_endpoint(tp)
@@ -42,11 +40,11 @@ module BuilderApm
42
40
  end
43
41
 
44
42
  def valid_gem_path(tp)
45
- not_this_gem = !tp.path.start_with?(@this_gem_path)
46
- is_a_tracked_gem = tp.path.split(File::SEPARATOR).any? { |folder| folder.start_with?(*gems_to_track) }
47
- is_a_rails_app_file = tp.path.start_with?(@root_path)
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?
48
46
 
49
- not_this_gem && (is_a_tracked_gem || is_a_rails_app_file)
47
+ gems_to_track.any? { |gem| tp.path.include?(File::SEPARATOR + gem) }
50
48
  end
51
49
 
52
50
  def process_trace_point(tp)
@@ -1,3 +1,3 @@
1
1
  module BuilderApm
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.3"
3
3
  end
@@ -1,9 +1,9 @@
1
1
  BuilderApm.configure do |config|
2
- config.redis_url = 'redis://localhost:6379/0'
3
- config.enable_controller_profiler = true
4
- config.enable_active_record_profiler = true
5
- config.enable_methods_profiler = true
6
- # config.api_key = ENV["OPENAI_API_KEY"]
7
- # config.api = ENV["API_AI"] # "Bravo" - internal Ai | "OpenAi" - use openai ChatGPT
8
- config.gems_to_track = ["bx_block_"] #partial and full gem names can be used.
9
- end
2
+ config.redis_url = 'redis://localhost:6379/0' # optional - defaults to 'redis://localhost:6379/0'
3
+ config.api_key = ENV["OPENAI_API_KEY"] #required only if you want to use Ai Doctor
4
+ config.api = "Bravo" # optional - default to 'Bravo' - "Bravo" - internal Ai / "OpenAi" - use openai ChatGPT
5
+ config.gems_to_track = [] # optional - default to empty array []
6
+ config.enable_controller_profiler = true # optional - defaults to true
7
+ config.enable_active_record_profiler = true # optional - defaults to true
8
+ config.enable_methods_profiler = true # optional - defaults to true
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: builder_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Ketelle