action_reporter 1.0.2 → 1.0.4
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 +8 -0
- data/action_reporter.gemspec +1 -1
- data/lib/action_reporter/audited_reporter.rb +4 -7
- data/lib/action_reporter/base.rb +8 -2
- data/lib/action_reporter/honeybadger_reporter.rb +4 -2
- data/lib/action_reporter/rails_reporter.rb +4 -5
- data/lib/action_reporter/scout_apm_reporter.rb +6 -4
- data/lib/action_reporter/sentry_reporter.rb +4 -5
- data/lib/action_reporter/version.rb +1 -1
- data/lib/action_reporter.rb +16 -14
- 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: 49736906f57c97cd86a7f0963fa78a63d6cbbb9d0fe03d601b987b376dca8e00
|
4
|
+
data.tar.gz: 6446a9feb95c216715b07b1775239b600a2ad1ae8083f7fbacdf86cd97b44469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7294c392d117b9a54625bb80b417c489408e2068d33b9338ec8d3bc60a0a91f3e360163fdcc9e6830eba1231a35ec5fe49f9c58b089f60e983e841302f80ede1
|
7
|
+
data.tar.gz: 047d3ee881ea607458bd29d97dfcb72e3aee38b899aaa2893532a38ccf1f9c466ffd58b4459a0d70355e895a722419ac11cacca60e6f213c3b9cdbe978541715
|
data/CHANGELOG.md
CHANGED
data/action_reporter.gemspec
CHANGED
@@ -2,10 +2,6 @@ module ActionReporter
|
|
2
2
|
class AuditedReporter < Base
|
3
3
|
class_accessor "Audited"
|
4
4
|
|
5
|
-
def transform_context?
|
6
|
-
false
|
7
|
-
end
|
8
|
-
|
9
5
|
def notify(*)
|
10
6
|
end
|
11
7
|
|
@@ -13,9 +9,6 @@ module ActionReporter
|
|
13
9
|
Audited.store[:current_remote_address] = args[:remote_addr] if args[
|
14
10
|
:remote_addr
|
15
11
|
].present?
|
16
|
-
Audited.store[:audited_user] = args[:audited_user] if args[
|
17
|
-
:audited_user
|
18
|
-
].present?
|
19
12
|
end
|
20
13
|
|
21
14
|
def reset_context
|
@@ -26,5 +19,9 @@ module ActionReporter
|
|
26
19
|
def audited_user
|
27
20
|
Audited.store[:audited_user]
|
28
21
|
end
|
22
|
+
|
23
|
+
def audited_user=(user)
|
24
|
+
Audited.store[:audited_user] = user
|
25
|
+
end
|
29
26
|
end
|
30
27
|
end
|
data/lib/action_reporter/base.rb
CHANGED
@@ -7,8 +7,14 @@ module ActionReporter
|
|
7
7
|
const_set(const_name, Object.const_get(class_name))
|
8
8
|
end
|
9
9
|
|
10
|
-
def transform_context
|
11
|
-
|
10
|
+
def transform_context(context)
|
11
|
+
ActionReporter::Utils.deep_transform_values(context) do |value|
|
12
|
+
if value.respond_to?(:to_global_id)
|
13
|
+
value.to_global_id.to_s
|
14
|
+
else
|
15
|
+
value
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
def notify(*)
|
@@ -3,11 +3,13 @@ module ActionReporter
|
|
3
3
|
class_accessor "Honeybadger"
|
4
4
|
|
5
5
|
def notify(error, context: {})
|
6
|
-
|
6
|
+
new_context = transform_context(context)
|
7
|
+
Honeybadger.notify(error, context: new_context)
|
7
8
|
end
|
8
9
|
|
9
10
|
def context(args)
|
10
|
-
|
11
|
+
new_context = transform_context(args)
|
12
|
+
Honeybadger.context(new_context)
|
11
13
|
end
|
12
14
|
|
13
15
|
def reset_context
|
@@ -3,16 +3,15 @@ module ActionReporter
|
|
3
3
|
class_accessor "Rails"
|
4
4
|
|
5
5
|
def notify(error, context: {})
|
6
|
+
new_context = transform_context(context)
|
6
7
|
Rails.logger.info(
|
7
|
-
"Reporter notification: #{error.inspect}, #{
|
8
|
+
"Reporter notification: #{error.inspect}, #{new_context.inspect}"
|
8
9
|
)
|
9
10
|
end
|
10
11
|
|
11
12
|
def context(args)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def reset_context
|
13
|
+
new_context = transform_context(args)
|
14
|
+
Rails.logger.info("Reporter context: #{new_context.inspect}")
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module ActionReporter
|
2
2
|
class ScoutApmReporter < Base
|
3
|
-
class_accessor "ScoutApm::
|
3
|
+
class_accessor "ScoutApm::Error"
|
4
4
|
class_accessor "ScoutApm::Context"
|
5
5
|
|
6
|
-
def notify(
|
7
|
-
|
6
|
+
def notify(error, context: {})
|
7
|
+
self.context(context)
|
8
|
+
ScoutApmError.capture(error)
|
8
9
|
end
|
9
10
|
|
10
11
|
def context(args)
|
11
|
-
|
12
|
+
new_context = transform_context(args)
|
13
|
+
ScoutApmContext.add(new_context)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -8,13 +8,12 @@ module ActionReporter
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def context(args)
|
11
|
-
|
12
|
-
|
13
|
-
end
|
11
|
+
new_context = transform_context(args)
|
12
|
+
Sentry.set_context(args)
|
14
13
|
end
|
15
14
|
|
16
|
-
def
|
17
|
-
Sentry.
|
15
|
+
def audited_user=(user)
|
16
|
+
Sentry.set_user(global_id: user.to_global_id.to_s) if user
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
data/lib/action_reporter.rb
CHANGED
@@ -30,35 +30,37 @@ module ActionReporter
|
|
30
30
|
|
31
31
|
def notify(error, context: {})
|
32
32
|
enabled_reporters.each do |reporter|
|
33
|
-
|
34
|
-
|
35
|
-
reporter.notify(error, context:
|
33
|
+
next unless reporter.respond_to?(:notify)
|
34
|
+
|
35
|
+
reporter.notify(error, context: context)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
def context(args)
|
40
40
|
enabled_reporters.each do |reporter|
|
41
|
-
|
42
|
-
|
41
|
+
next unless reporter.respond_to?(:context)
|
42
|
+
|
43
|
+
reporter.context(args)
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
47
|
def reset_context
|
47
|
-
enabled_reporters.each
|
48
|
+
enabled_reporters.each do |reporter|
|
49
|
+
next unless reporter.respond_to?(:reset_context)
|
50
|
+
|
51
|
+
reporter.reset_context
|
52
|
+
end
|
48
53
|
end
|
49
54
|
|
50
55
|
def audited_user
|
51
56
|
enabled_reporters.find { |r| r.respond_to?(:audited_user) }&.audited_user
|
52
57
|
end
|
53
58
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
else
|
60
|
-
value
|
61
|
-
end
|
59
|
+
def audited_user=(user)
|
60
|
+
enabled_reporters.each do |reporter|
|
61
|
+
next unless reporter.respond_to?(:audited_user=)
|
62
|
+
|
63
|
+
reporter.audited_user = user
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|