action_reporter 3.0.0 → 3.1.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 +4 -4
- data/CHANGELOG.md +7 -10
- data/README.md +9 -8
- data/lib/action_reporter/base.rb +23 -0
- data/lib/action_reporter/honeybadger_reporter.rb +2 -1
- data/lib/action_reporter/plugin_discovery.rb +1 -1
- data/lib/action_reporter/scout_apm_reporter.rb +6 -1
- data/lib/action_reporter/sentry_reporter.rb +9 -2
- data/lib/action_reporter/version.rb +1 -1
- data/lib/action_reporter.rb +14 -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: 1ee447f96cc8b2c64df7f7f824b49cd7b5fbbbb591496b507c1a352883468701
|
|
4
|
+
data.tar.gz: 777dd9085576844c30d5a0a81ce57933072be54653c9c2326c041c7de61d796f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52bf9687ec703a12869bef96419ae1873b36d178d1e5cab06d5683dcd048ef1b49066efe0b7f2c1128d64b8bc762eafc89c1890767b900d49dcbc8c35f6e67e1
|
|
7
|
+
data.tar.gz: 94debcd931e0307f881721f94a13d493f65f4e2fc5de61d11ce6ad8a0536e6a2325646f4241613ef80be3a7036fd8608854a7ec22a727cff1890f8aebf890307
|
data/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 3.1.0 (2026-03-27)
|
|
4
|
+
|
|
5
|
+
- Add `ActionReporter.user_id_resolver` for configuring how to resolve user IDs
|
|
6
|
+
- Improve ScoutApmReporter current user setter to use `id` instead of `user_global_id`
|
|
7
|
+
- Improve HoneybadgerReporter current user setter to use `user_id` instead of `user_global_id`
|
|
8
|
+
- Improve SentryReporter current user setter to use `id` instead of `user_global_id` and fix `transaction_id` setter to use `transaction_id` instead of `transactionId`
|
|
9
|
+
|
|
3
10
|
## 3.0.0 (2026-03-13)
|
|
4
11
|
|
|
5
12
|
- BREAKING: Remove backward-compat reporter loading
|
|
6
13
|
- Remove `AVAILABLE_REPORTERS` constant
|
|
7
14
|
- Stop eager requiring built-in reporters at boot
|
|
8
15
|
- Built-in reporters are now loaded lazily through `ActionReporter.available_reporters`
|
|
9
|
-
- Fix built-in reporter constant autoloading
|
|
10
|
-
- Add `autoload` mappings for built-in reporters (`RailsReporter`, `AuditedReporter`, `PaperTrailReporter`, `ActiveVersionReporter`, `SentryReporter`, `HoneybadgerReporter`, `ScoutApmReporter`)
|
|
11
|
-
- Fix `NameError: uninitialized constant ActionReporter::ActiveVersionReporter` when reporters are referenced directly from app initializers
|
|
12
|
-
- Fix custom reporter lazy loading regression
|
|
13
|
-
- `PluginDiscovery.load_registered_reporter` now attempts `require` before constant lookup
|
|
14
|
-
- Registered reporters can now be loaded from `require_path` when class is not preloaded
|
|
15
16
|
- Improve plugin discovery thread safety
|
|
16
17
|
- Synchronize `register` writes with discovery mutex
|
|
17
18
|
- Snapshot registered reporters under lock in `available_reporters` before iteration
|
|
@@ -25,10 +26,6 @@
|
|
|
25
26
|
- New `ActionReporter::Current.reset_storage_adapter!`
|
|
26
27
|
- Storage resolution order: explicit `storage_adapter` -> `ActiveSupport::IsolatedExecutionState` -> `Thread.current`
|
|
27
28
|
- Enables fiber-aware request storage customization in non-Rails environments
|
|
28
|
-
- Add regression coverage for lazy loading and storage behavior
|
|
29
|
-
- Add spec for loading registered reporter via `require_path` when class is not preloaded
|
|
30
|
-
- Add spec for transforming array-contained objects in deep context transform
|
|
31
|
-
- Add specs for `Current.storage_adapter` validation and precedence
|
|
32
29
|
|
|
33
30
|
## 2.0.2 (2026-03-13)
|
|
34
31
|
|
data/README.md
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
# action_reporter
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/rb/action_reporter) [](https://github.com/amkisko/action_reporter.rb/actions/workflows/test.yml) [](https://codecov.io/gh/amkisko/action_reporter.rb) [](https://sonarcloud.io/summary/new_code?id=amkisko_action_reporter.rb)
|
|
3
|
+
[](https://badge.fury.io/rb/action_reporter) [](https://github.com/amkisko/action_reporter.rb/actions/workflows/test.yml) [](https://codecov.io/gh/amkisko/action_reporter.rb) [](https://sonarcloud.io/summary/new_code?id=amkisko_action_reporter.rb)
|
|
4
4
|
|
|
5
5
|
Ruby wrapper for multiple reporting services.
|
|
6
6
|
|
|
7
7
|
Supported services: Rails logger, gem audited, gem PaperTrail, gem ActiveVersion, Sentry, Honeybadger, scoutapm.
|
|
8
8
|
|
|
9
|
-
Sponsored by [Kisko Labs](https://www.kiskolabs.com).
|
|
10
|
-
|
|
11
|
-
<a href="https://www.kiskolabs.com">
|
|
12
|
-
<img src="kisko.svg" width="200" alt="Sponsored by Kisko Labs" />
|
|
13
|
-
</a>
|
|
14
|
-
|
|
15
|
-
|
|
16
9
|
## Installation
|
|
17
10
|
|
|
18
11
|
Add to your Gemfile:
|
|
@@ -173,3 +166,11 @@ gem push action_reporter-*.gem
|
|
|
173
166
|
## License
|
|
174
167
|
|
|
175
168
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
169
|
+
|
|
170
|
+
## Sponsors
|
|
171
|
+
|
|
172
|
+
Sponsored by [Kisko Labs](https://www.kiskolabs.com).
|
|
173
|
+
|
|
174
|
+
<a href="https://www.kiskolabs.com">
|
|
175
|
+
<img src="kisko.svg" width="200" alt="Sponsored by Kisko Labs" />
|
|
176
|
+
</a>
|
data/lib/action_reporter/base.rb
CHANGED
|
@@ -48,5 +48,28 @@ module ActionReporter
|
|
|
48
48
|
|
|
49
49
|
def transaction_name=(transaction_name)
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
def resolve_user_id(user)
|
|
53
|
+
resolver = ActionReporter.user_id_resolver
|
|
54
|
+
if resolver.respond_to?(:call)
|
|
55
|
+
resolver.call(user)
|
|
56
|
+
else
|
|
57
|
+
default_resolve_user_id(user)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
def default_resolve_user_id(user)
|
|
64
|
+
if defined?(::GlobalID) && user.is_a?(::GlobalID)
|
|
65
|
+
user.to_s
|
|
66
|
+
elsif defined?(::ActiveRecord::Base) && user.is_a?(::ActiveRecord::Base)
|
|
67
|
+
(user.try(:to_global_id) || user.try(:id)).to_s
|
|
68
|
+
elsif user.respond_to?(:to_global_id)
|
|
69
|
+
user.to_global_id.to_s
|
|
70
|
+
else
|
|
71
|
+
user.to_s
|
|
72
|
+
end
|
|
73
|
+
end
|
|
51
74
|
end
|
|
52
75
|
end
|
|
@@ -13,8 +13,13 @@ module ActionReporter
|
|
|
13
13
|
scoutapm_context_class.add(new_context)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def current_remote_addr=(remote_addr)
|
|
17
|
+
scoutapm_context_class.add_user(ip: remote_addr)
|
|
18
|
+
end
|
|
19
|
+
|
|
16
20
|
def current_user=(user)
|
|
17
|
-
|
|
21
|
+
id = resolve_user_id(user)
|
|
22
|
+
scoutapm_context_class.add_user(id: id)
|
|
18
23
|
end
|
|
19
24
|
|
|
20
25
|
def ignore_transaction!
|
|
@@ -23,11 +23,12 @@ module ActionReporter
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def current_user=(user)
|
|
26
|
-
|
|
26
|
+
id = resolve_user_id(user)
|
|
27
|
+
sentry_class.set_user(id: id)
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def transaction_id=(transaction_id)
|
|
30
|
-
sentry_class.set_tags(
|
|
31
|
+
sentry_class.set_tags(transaction_id: transaction_id)
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
def transaction_name=(transaction_name)
|
|
@@ -35,5 +36,11 @@ module ActionReporter
|
|
|
35
36
|
scope.set_transaction_name(transaction_name)
|
|
36
37
|
end
|
|
37
38
|
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def blank_user_id?(id)
|
|
43
|
+
id.nil? || (id.respond_to?(:empty?) && id.empty?)
|
|
44
|
+
end
|
|
38
45
|
end
|
|
39
46
|
end
|
data/lib/action_reporter.rb
CHANGED
|
@@ -33,9 +33,10 @@ module ActionReporter
|
|
|
33
33
|
PluginDiscovery.register(name, class_name: class_name, require_path: require_path)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
@enabled_reporters =
|
|
36
|
+
@enabled_reporters = nil
|
|
37
37
|
@logger = nil
|
|
38
38
|
@error_handler = nil
|
|
39
|
+
@user_id_resolver = nil
|
|
39
40
|
|
|
40
41
|
def enabled_reporters=(reporters)
|
|
41
42
|
@enabled_reporters = reporters || []
|
|
@@ -61,6 +62,18 @@ module ActionReporter
|
|
|
61
62
|
@error_handler = handler
|
|
62
63
|
end
|
|
63
64
|
|
|
65
|
+
# Optional proc to turn +current_user+ into a string id for reporters (Sentry, Scout, etc.).
|
|
66
|
+
# Receives the same object passed to +ActionReporter.current_user=+ and must return a String
|
|
67
|
+
# (or +nil+ to skip setting an id, if the reporter supports it).
|
|
68
|
+
# When unset, {ActionReporter::Base#resolve_user_id} uses built-in defaults.
|
|
69
|
+
def user_id_resolver
|
|
70
|
+
@user_id_resolver
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def user_id_resolver=(resolver)
|
|
74
|
+
@user_id_resolver = resolver
|
|
75
|
+
end
|
|
76
|
+
|
|
64
77
|
def handle_reporter_error(reporter, error, method_name)
|
|
65
78
|
error_message = "ActionReporter: #{reporter.class}##{method_name} failed: #{error.class} - #{error.message}"
|
|
66
79
|
|