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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/views/builder_apm/css/_main.html.erb +3 -1
- data/app/views/builder_apm/shared/_header.html.erb +1 -1
- data/lib/builder_apm/middleware/timing.rb +3 -17
- data/lib/builder_apm/models/instrumenter.rb +13 -8
- data/lib/builder_apm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ce10ef00890d74a1b18ef6afb1644c0983a9ae1a5f5174aadcdcc7957dabba8
|
4
|
+
data.tar.gz: 1fc6f2f584168cb7081bd47be58107bbee2d8e3741306c2d3e009ef94118819c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65ce830867f91ccf8ed25a23fd632625e9b3fe8cefcdc9460ffbd0aa666653dc39ee7776d063be82f156c2a29841088c176d0d1002460654fa1d758aefd44251
|
7
|
+
data.tar.gz: 217349f4f9cc1f9e094849237dd650b262dbf1d0f43fb721417e05895e2d8ffc80351e425058090044614ee83656313bd8a5ff6889ff32c3387a604bc21d945c
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
73
|
-
|
74
|
-
last_sql
|
75
|
-
|
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
|
data/lib/builder_apm/version.rb
CHANGED