findbug 0.2.2 → 0.3.1
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 +54 -1
- data/app/views/findbug/errors/index.html.erb +5 -4
- data/lib/findbug/engine.rb +9 -5
- data/lib/findbug/version.rb +1 -1
- data/lib/generators/findbug/templates/POST_INSTALL +6 -0
- 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: 1c29bc5c8718f46a269d9987839af57928d7aab2c0b3451f08edd4683729f381
|
|
4
|
+
data.tar.gz: fd9771ef2dee52d0b50fa1b5226c401b15ce85e3c4481e15684907d5756b83db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '018370d27b3517272c7ecf1c1f392c2d3abbcd54b92d223227ad200f39232f534a0ecc875fc79019bad2bf7e48fdbe9b81ac51326fdfdc9854fa6da2f8c9149d'
|
|
7
|
+
data.tar.gz: 64bb0554fd369ed717dd17b3c05fdfc7ae5fb275c461491ee85a19dcae91938e07e371941bc21940def52d69426f2d1bc6397300a365b3d1782555642ed18387
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FindBug
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/rb/findbug
|
|
3
|
+
[](https://badge.fury.io/rb/findbug)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://github.com/ITSSOUMIT/findbug)
|
|
6
6
|
|
|
@@ -297,6 +297,59 @@ rails findbug:clear_buffers
|
|
|
297
297
|
rails findbug:db:stats
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
+
## Multi-Tenant Applications (Apartment/ros-apartment)
|
|
301
|
+
|
|
302
|
+
If you're using [ros-apartment](https://github.com/rails-on-services/apartment) or similar multi-tenant gems with PostgreSQL schemas, FindBug's tables need to stay in the public schema and the dashboard path should be excluded from tenant switching.
|
|
303
|
+
|
|
304
|
+
### 1. Exclude FindBug Models
|
|
305
|
+
|
|
306
|
+
Add FindBug models to the `excluded_models` list in `config/initializers/apartment.rb`:
|
|
307
|
+
|
|
308
|
+
```ruby
|
|
309
|
+
Apartment.configure do |config|
|
|
310
|
+
config.excluded_models = %w[
|
|
311
|
+
# Your existing excluded models...
|
|
312
|
+
Findbug::ErrorEvent
|
|
313
|
+
Findbug::PerformanceEvent
|
|
314
|
+
]
|
|
315
|
+
end
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 2. Exclude FindBug Dashboard Path
|
|
319
|
+
|
|
320
|
+
Add `/findbug` to your tenant switching middleware's excluded paths:
|
|
321
|
+
|
|
322
|
+
```ruby
|
|
323
|
+
class SwitchTenantMiddleware < Apartment::Elevators::Generic
|
|
324
|
+
EXCLUDED_PATHS = %w[
|
|
325
|
+
/findbug
|
|
326
|
+
# Your other excluded paths...
|
|
327
|
+
].freeze
|
|
328
|
+
|
|
329
|
+
def parse_tenant_name(request)
|
|
330
|
+
return nil if excluded_path?(request.path)
|
|
331
|
+
# ... rest of your tenant logic
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
private
|
|
335
|
+
|
|
336
|
+
def excluded_path?(path)
|
|
337
|
+
EXCLUDED_PATHS.any? { |excluded| path.start_with?(excluded) }
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### 3. Run Migrations in Public Schema
|
|
343
|
+
|
|
344
|
+
Ensure FindBug migrations run in the public schema:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
# Run migrations in public schema only (not per-tenant)
|
|
348
|
+
rails db:migrate
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
The FindBug tables (`findbug_error_events`, `findbug_performance_events`) will be created in the public schema and shared across all tenants.
|
|
352
|
+
|
|
300
353
|
## Advanced: Using ActiveJob Instead of Built-in Thread
|
|
301
354
|
|
|
302
355
|
By default, FindBug uses a built-in background thread for persistence. If you prefer to use ActiveJob with your own job backend:
|
|
@@ -9,27 +9,28 @@
|
|
|
9
9
|
["Resolved", "resolved"],
|
|
10
10
|
["Ignored", "ignored"],
|
|
11
11
|
["All Statuses", ""]
|
|
12
|
-
], params[:status]), onchange: "this.form.submit()" %>
|
|
12
|
+
], params.key?(:status) ? params[:status] : "unresolved"), onchange: "this.form.submit()" %>
|
|
13
13
|
|
|
14
14
|
<%= select_tag :severity, options_for_select([
|
|
15
15
|
["All Severities", ""],
|
|
16
16
|
["Error", "error"],
|
|
17
17
|
["Warning", "warning"],
|
|
18
18
|
["Info", "info"]
|
|
19
|
-
], params[:severity]), onchange: "this.form.submit()" %>
|
|
19
|
+
], params[:severity] || ""), onchange: "this.form.submit()" %>
|
|
20
20
|
|
|
21
21
|
<%= select_tag :since, options_for_select([
|
|
22
|
+
["All Time", ""],
|
|
22
23
|
["Last Hour", "1h"],
|
|
23
24
|
["Last 24 Hours", "24h"],
|
|
24
25
|
["Last 7 Days", "7d"],
|
|
25
26
|
["Last 30 Days", "30d"]
|
|
26
|
-
], params[:since]), onchange: "this.form.submit()" %>
|
|
27
|
+
], params[:since] || ""), onchange: "this.form.submit()" %>
|
|
27
28
|
|
|
28
29
|
<%= select_tag :sort, options_for_select([
|
|
29
30
|
["Most Recent", "recent"],
|
|
30
31
|
["Most Occurrences", "occurrences"],
|
|
31
32
|
["Oldest", "oldest"]
|
|
32
|
-
], params[:sort]), onchange: "this.form.submit()" %>
|
|
33
|
+
], params[:sort] || "recent"), onchange: "this.form.submit()" %>
|
|
33
34
|
</div>
|
|
34
35
|
|
|
35
36
|
<div class="filter-bar-search">
|
data/lib/findbug/engine.rb
CHANGED
|
@@ -6,11 +6,7 @@ require "rails/engine"
|
|
|
6
6
|
# __dir__ is lib/findbug, so we go up two levels to get the gem root
|
|
7
7
|
FINDBUG_GEM_ROOT = File.expand_path("../..", __dir__)
|
|
8
8
|
|
|
9
|
-
# Require
|
|
10
|
-
require_relative "../../app/models/findbug/error_event"
|
|
11
|
-
require_relative "../../app/models/findbug/performance_event"
|
|
12
|
-
|
|
13
|
-
# Require controllers
|
|
9
|
+
# Require controllers (needed for routing)
|
|
14
10
|
require_relative "../../app/controllers/findbug/application_controller"
|
|
15
11
|
require_relative "../../app/controllers/findbug/dashboard_controller"
|
|
16
12
|
require_relative "../../app/controllers/findbug/errors_controller"
|
|
@@ -77,6 +73,14 @@ module Findbug
|
|
|
77
73
|
end
|
|
78
74
|
end
|
|
79
75
|
|
|
76
|
+
# Load models after ActiveRecord is ready
|
|
77
|
+
# This is important for multi-tenant setups (Apartment) where excluded_models
|
|
78
|
+
# are resolved early in the boot process
|
|
79
|
+
initializer "findbug.load_models", after: :load_config_initializers do
|
|
80
|
+
require_relative "../../app/models/findbug/error_event"
|
|
81
|
+
require_relative "../../app/models/findbug/performance_event"
|
|
82
|
+
end
|
|
83
|
+
|
|
80
84
|
# NOTE: We intentionally do NOT add session/flash middleware here.
|
|
81
85
|
# Adding middleware to API-mode apps would change their behavior
|
|
82
86
|
# (e.g., showing HTML error pages instead of JSON).
|
data/lib/findbug/version.rb
CHANGED
|
@@ -36,6 +36,12 @@ Next steps:
|
|
|
36
36
|
)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
7. (Multi-tenant apps) If using Apartment/ros-apartment, add to apartment.rb:
|
|
40
|
+
|
|
41
|
+
config.excluded_models = %w[Findbug::ErrorEvent Findbug::PerformanceEvent]
|
|
42
|
+
|
|
43
|
+
And exclude /findbug from your tenant switching middleware.
|
|
44
|
+
|
|
39
45
|
For more information, see: https://github.com/ITSSOUMIT/findbug
|
|
40
46
|
|
|
41
47
|
===============================================================================
|