inner_performance 0.1.0 → 0.1.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 +4 -4
- data/README.md +2 -2
- data/app/controllers/inner_performance/dashboard_controller.rb +1 -4
- data/app/controllers/inner_performance/events_controller.rb +0 -1
- data/app/helpers/inner_performance/application_helper.rb +2 -0
- data/app/views/inner_performance/dashboard/index.html.erb +5 -7
- data/app/views/inner_performance/events/index.html.erb +1 -3
- data/db/migrate/20241124111458_add_type_to_inner_performance_events.rb +1 -1
- data/lib/inner_performance/configuration.rb +2 -2
- data/lib/inner_performance/version.rb +1 -1
- data/lib/inner_performance.rb +3 -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: c6fb86a53413ef53d7256b526e4b75dd7d910473fc8d047b97976285ad82a91f
|
4
|
+
data.tar.gz: 60147dd06fb7069a809c402e3cd9aeebf18df7d4921d1df52f0733159390ec22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ffe8d954c92f5736d9a57d161657dbca3cbbea5303fb42f31a5f007af962096f8a9709a190eb21bb10cfd78004ff628f7548317fc90505971d2f0893a3477b
|
7
|
+
data.tar.gz: cc4a9176b3d7c787f0bd9636c294ffc554471fd3466c1a10c92eb267dd67d273152df7e00fbdb21eee520157b7cdf11a40fa1738b9762eeed8d551fc2648e293
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# InnerPerformance
|
1
|
+
# ☯️ InnerPerformance [](https://badge.fury.io/rb/inner_performance)
|
2
2
|
Database-backed modest performance monitoring tool for your Rails app.
|
3
3
|
|
4
4
|
<img width="1188" alt="image" src="https://github.com/user-attachments/assets/cb659c76-8139-4ee0-b683-d6acef227dc6">
|
@@ -62,7 +62,7 @@ InnerPerformance.configure do |config|
|
|
62
62
|
# the job that saves the events because that leeds to infinite loop.
|
63
63
|
# Better not remove this rule as it will lead to stack overflow.
|
64
64
|
config.ignore_rules.push(
|
65
|
-
proc { |event| event.is_a?(ActiveSupport::Notifications::Event) }
|
65
|
+
proc { |event| !event.is_a?(ActiveSupport::Notifications::Event) }
|
66
66
|
)
|
67
67
|
end
|
68
68
|
```
|
@@ -1,10 +1,7 @@
|
|
1
1
|
module InnerPerformance
|
2
2
|
class DashboardController < ApplicationController
|
3
3
|
def index
|
4
|
-
@
|
5
|
-
@q.sorts = "created_at desc" if @q.sorts.empty?
|
6
|
-
@recent_events = @q.result.limit(100)
|
7
|
-
|
4
|
+
@recent_events = InnerPerformance::Event.all.order(id: :desc).limit(25)
|
8
5
|
@average_req_duration = InnerPerformance::Events::ProcessActionActionController.all.average(:duration)
|
9
6
|
@average_job_duration = InnerPerformance::Events::PerformActiveJob.average(:duration) || 0
|
10
7
|
@biggest_events = \
|
@@ -41,14 +41,12 @@
|
|
41
41
|
<h4 class="mt-4">Recent events</h4>
|
42
42
|
<table class="table table-hover">
|
43
43
|
<thead>
|
44
|
-
<th
|
45
|
-
<th
|
46
|
-
<th
|
47
|
-
<th class="text-end"
|
44
|
+
<th>Name</th>
|
45
|
+
<th>Duration</th>
|
46
|
+
<th>DB</th>
|
47
|
+
<th class="text-end">When</th>
|
48
48
|
</thead>
|
49
49
|
<tbody>
|
50
|
-
|
51
|
-
<%= render event.becomes(InnerPerformance::Event) %>
|
52
|
-
<% end %>
|
50
|
+
<%= render collection: @recent_events, partial: 'inner_performance/events/event', cached: true %>
|
53
51
|
</tbody>
|
54
52
|
</table>
|
@@ -21,9 +21,7 @@
|
|
21
21
|
<th class="text-end"><%= sort_link @q, :created_at, hide_indicator: true %></th>
|
22
22
|
</thead>
|
23
23
|
<tbody>
|
24
|
-
|
25
|
-
<%= render event.becomes(InnerPerformance::Event) %>
|
26
|
-
<% end %>
|
24
|
+
<%= render collection: @events, partial: 'inner_performance/events/event', cached: true %>
|
27
25
|
</tbody>
|
28
26
|
</table>
|
29
27
|
|
@@ -13,8 +13,8 @@ module InnerPerformance
|
|
13
13
|
@events_retention = 1.week
|
14
14
|
@medium_duration_range = [200, 999]
|
15
15
|
@ignore_rules = [
|
16
|
-
proc { |event| rand(100)
|
17
|
-
proc { |event| (event.payload[:job]&.class&.name || '').
|
16
|
+
proc { |event| rand(100) > InnerPerformance.configuration.sample_rates[event.name.to_s] },
|
17
|
+
proc { |event| (event.payload[:job]&.class&.name || '').include?('InnerPerformance') }
|
18
18
|
]
|
19
19
|
end
|
20
20
|
end
|
data/lib/inner_performance.rb
CHANGED
@@ -46,10 +46,12 @@ module InnerPerformance
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Iterate throug the ignored_rules array and return false on first rule
|
50
|
+
# that returns `true`
|
49
51
|
def save_event?(event)
|
50
52
|
InnerPerformance.configuration.ignore_rules.each_with_object([]) do |rule, arr|
|
51
53
|
arr << rule.call(event)
|
52
|
-
end.
|
54
|
+
end.find { |r| r == true }
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|