findbug 0.2.1 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da1d392b6e05c3ad804b9934c6680e9c5602db9dbe4abf7d96fe9a58ac72ff15
4
- data.tar.gz: fd6934649e5ab318cd61b2d81623ce31d1f26d3adcaca07608a52d27f755e469
3
+ metadata.gz: c722ca45605700abb60218e4f1235a05351b6b70e591a71aec8be182605bde21
4
+ data.tar.gz: 74860b9979a5a9648a0d7e7dae574402792e7ab0fdf0e20814be82bd26c351bb
5
5
  SHA512:
6
- metadata.gz: 980da2b4212a7fafe712be0d39112659f5f2a9a2aa5d6e199d3416685b402ad78314a370ef256abf65261fd91af8bbdb160a39c40a4601b5ff5280723bfbc8eb
7
- data.tar.gz: 408e475663d7bfaf9d8c64961082c49c0ed4fd052fb9a2bc8c6f9ab3ffc60652a4df70aad59b2265bbaa5093b854221638c6831ccd9d6fd60b3e677147456d3b
6
+ metadata.gz: a3f57534ea32b44c6f17a3fdc6cbdbaf13f33e30081f953b75777ba6309ce7fb9fab6c374fea24a9ef853dc13c09b3bf139d6a2a8b20fdd42b634ddda930bf9b
7
+ data.tar.gz: b717253e518e0ee0c917e4680ef32be97f49a942df1f3df304c2faea6202c66ddf7a0d34a9470bbe39319913c5af8f7662e2865a82f1b805f67430f707eddc54
data/README.md CHANGED
@@ -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">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Findbug
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -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
  ===============================================================================
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: findbug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soumit Das