rails_event_viewer 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 935a008c1e9519c485ee47d472d8980a36e1e6e4778e83c76e38629350ed93e9
4
- data.tar.gz: 9244a13f193475b62847af18366b4e53246a9602f84c13cd00114ec6ead86c72
3
+ metadata.gz: d23e7d737a8e9d46d9ccbc7b5eafca59dbff648f3fd8deef10576d45555fbe3a
4
+ data.tar.gz: 9931baf5951842895eeacb45a87d56e50f2294dbbb0b105972995bdcfd7becf9
5
5
  SHA512:
6
- metadata.gz: af5581280410b7b5eb3a79ce61b3dc53ca8dac9ddb083d79554c61f950977319049714334c6fb19713d6aa8c67b38bb63a2bb1dd9042a08a71da7def2bd6b5e1
7
- data.tar.gz: bc898a58889c8786fcc83c6467084275637c5e27ddc8ee33a233c571d917724b65445f235eebcf3e99be1e2aea70c4eb6a301d764aa5a3bb2ac53ce40be16750
6
+ metadata.gz: ca612bc3fc3a3f16fa398cac9179a5dd23adc54021384693f552abc6333789ed6c8b0fb9904c3b7ca5a57bdfb90e60857292be0bd395beb82f99cbd05118f016
7
+ data.tar.gz: 89c8fe09a4ca8a901b2737b013280cbea230ca8a7ab9c10ffd5656a0e2e5214f30667e11e9f8a23e5c6db49575e9cda27851f060336ece2f08b985aa52e2015f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1 (2026-10-03)
4
+
5
+ Added:
6
+
7
+ - `config.transactional`, on by default. With `async = false`, set it to `false` so a failed event write does not abort the transaction caller's code is running in.
8
+
3
9
  ## 0.4.0 (2026-10-03)
4
10
 
5
11
  Breaking:
data/README.md CHANGED
@@ -60,6 +60,7 @@ RailsEventViewer.configure do |config|
60
60
  config.buffer_size = 100 # flush after this many events
61
61
  config.flush_interval = 2 # or after this many seconds
62
62
  config.sample_rate = 1.0 # 0.1 keeps 10% of events
63
+ config.transactional = true # with async = false, a failed write aborts the transaction
63
64
 
64
65
  config.captured_events = [] # empty captures everything
65
66
  config.ignored_events += [/^debug\./] # strings or regexes
@@ -74,6 +75,7 @@ Internal Rails events such as `active_record.*` and `action_controller.*` are ig
74
75
  ## Sync vs async
75
76
 
76
77
  - With `async = false`, each event is written inside your transaction, and a failed write is reported to `Rails.error`. In development and test, where Rails sets `raise_on_error`, it raises instead.
78
+ Sync writes are transactional by default, so a failed event write aborts the transaction on PostgreSQL. Set `transactional = false` to run each write in a savepoint instead.
77
79
  - With `async = true`, events wait in an in-memory buffer and are lost if the process is killed. Set `config.buffer` to your own `RailsEventViewer::Buffer`, for example backed by Redis, to keep them.
78
80
 
79
81
  ## Authentication
@@ -49,6 +49,10 @@ RailsEventViewer.configure do |config|
49
49
  # Useful for high-volume production environments
50
50
  # config.sample_rate = 1.0
51
51
 
52
+ # With async = false, events are written inside the transaction. By default a failed
53
+ # write aborts it. Set to false to run each write in a savepoint so host's own writes survive.
54
+ # config.transactional = true
55
+
52
56
  # ==========================================================================
53
57
  # General Configuration
54
58
  # ==========================================================================
@@ -27,7 +27,9 @@ module RailsEventViewer
27
27
  }
28
28
  end
29
29
 
30
- Entry.insert_all(records, returning: false)
30
+ Entry.transaction(requires_new: !RailsEventViewer.transactional) do
31
+ Entry.insert_all(records, returning: false)
32
+ end
31
33
  end
32
34
 
33
35
  def fetch_events(relation)
@@ -1,3 +1,3 @@
1
1
  module RailsEventViewer
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -14,6 +14,7 @@ module RailsEventViewer
14
14
  mattr_accessor :buffer_size, default: 100 # Flush after N events
15
15
  mattr_accessor :flush_interval, default: 2 # Flush every N seconds
16
16
  mattr_accessor :sample_rate, default: 1.0 # 1.0 = 100%, 0.1 = 10%
17
+ mattr_accessor :transactional, default: true # false = a failed sync write does not abort the caller's transaction
17
18
  mattr_accessor :buffer, default: Buffers::Memory.new
18
19
 
19
20
  mattr_accessor :retention_period, default: 7.days
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_event_viewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keshav Biswa