builder_apm 0.2.1 → 0.2.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: 274458c5c8b14edbf9269ed80ed646e5eae7b20dd26757ab0e89e2218ff1f94f
4
- data.tar.gz: 181f657ae560ae0d5697c5017f8e3e6f751ddfeb36ce1a87bf9ad2a2b82fbd2e
3
+ metadata.gz: 1ce10ef00890d74a1b18ef6afb1644c0983a9ae1a5f5174aadcdcc7957dabba8
4
+ data.tar.gz: 1fc6f2f584168cb7081bd47be58107bbee2d8e3741306c2d3e009ef94118819c
5
5
  SHA512:
6
- metadata.gz: 4ad3669d45c8ca1adfbea69f706e464a2841abf009785a496cf1756a3dabc312ec9f654f607ff43ba60983ca02c6a6ca62c8eb3eb0badb30c5fb2f2ad9f8abcd
7
- data.tar.gz: 6ef78f15c27b19f5e731c712a295884df52060bc7e1db4c5fedd86a6990f6bc78c07cb00541d6ba10008c93849278bbc16b792dafc4f5a4b4fb23e48dc7a6549
6
+ metadata.gz: 65ce830867f91ccf8ed25a23fd632625e9b3fe8cefcdc9460ffbd0aa666653dc39ee7776d063be82f156c2a29841088c176d0d1002460654fa1d758aefd44251
7
+ data.tar.gz: 217349f4f9cc1f9e094849237dd650b262dbf1d0f43fb721417e05895e2d8ffc80351e425058090044614ee83656313bd8a5ff6889ff32c3387a604bc21d945c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- builder_apm (0.1.0)
4
+ builder_apm (0.2.2)
5
5
  rails (>= 4.0, < 8)
6
6
  redis (~> 4.5)
7
7
 
@@ -11,7 +11,9 @@ body {
11
11
  padding: 10px;
12
12
  margin-bottom: 20px;
13
13
  }
14
-
14
+ .version {
15
+ font-size:14px;
16
+ }
15
17
  #navbar {
16
18
  background-color: #333;
17
19
  overflow: hidden;
@@ -36,7 +36,7 @@ $(document).ready(function() {
36
36
  </script>
37
37
  </head>
38
38
  <body>
39
- <h1 id="header">BuilderApm Dashboard</h1>
39
+ <h1 id="header">BuilderApm Dashboard<span class="version"> (<%= BuilderApm::VERSION %>)</span></h1>
40
40
  <nav id="navbar">
41
41
  <ul>
42
42
  <li><%= link_to 'Dashboard', dashboard_path, class: ("active" if current_page?(dashboard_path)) %></li>
@@ -11,12 +11,9 @@ module BuilderApm
11
11
  Thread.current["request_id"] = request_id
12
12
  start_time = Time.now.to_f * 1000
13
13
 
14
- begin
15
- @status, @headers, @response = @app.call(env)
16
- rescue => e
17
- handle_exception(e, start_time, request_id)
18
- raise e
19
- end
14
+ @status, @headers, @response = @app.call(env)
15
+
16
+ ensure
20
17
 
21
18
  end_time = Time.now.to_f * 1000
22
19
  handle_timing(start_time, end_time, request_id)
@@ -40,17 +37,6 @@ module BuilderApm
40
37
  @redis_client.set("builder_apm:Request:#{data[:request_id]}", data.to_json)
41
38
  end
42
39
  end
43
-
44
- def handle_exception(e, start_time, request_id)
45
- end_time = Time.now.to_f * 1000
46
-
47
- data = Thread.current['request_data'] || {}
48
- data[:exception_class] = e.class.to_s
49
- data[:exception_message] = e.message
50
- data[:exception_backtrace] = e.backtrace
51
-
52
- handle_timing(start_time, end_time, request_id)
53
- end
54
40
  end
55
41
  end
56
42
  end
@@ -66,16 +66,21 @@ module BuilderApm
66
66
  def update_last_sql_query_data_with_instantiation_info(event)
67
67
  stack = Thread.current[:stack]
68
68
  request_id = Thread.current[:request_id]
69
-
69
+
70
70
  return if stack.nil? || stack.empty? || request_id.nil?
71
-
72
- last_sql = Thread.current[:stack].last[:sql_events].pop
73
- if last_sql[:sql_id] == Thread.current[:sql_event_id]
74
- last_sql[:record_count] = event.payload[:record_count]
75
- last_sql[:class_name] = event.payload[:class_name]
71
+
72
+ begin
73
+ last_sql = stack.last[:sql_events].pop
74
+ return unless last_sql && last_sql[:sql_id]
75
+
76
+ if last_sql[:sql_id] == Thread.current[:sql_event_id]
77
+ last_sql[:record_count] = event.payload[:record_count]
78
+ last_sql[:class_name] = event.payload[:class_name]
79
+ end
80
+ Thread.current[:stack].last[:sql_events].push(last_sql)
81
+ ensure
82
+ Thread.current[:sql_event_id] = nil
76
83
  end
77
- Thread.current[:stack].last[:sql_events].push(last_sql)
78
- Thread.current[:sql_event_id] = nil
79
84
  end
80
85
  end
81
86
  end
@@ -1,3 +1,3 @@
1
1
  module BuilderApm
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
3
3
  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.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Ketelle