action_reporter 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/action_reporter.gemspec +1 -1
- data/lib/action_reporter/base.rb +6 -4
- data/lib/action_reporter/error.rb +3 -0
- data/lib/action_reporter/honeybadger_reporter.rb +8 -4
- data/lib/action_reporter/rails_reporter.rb +3 -3
- data/lib/action_reporter/scout_apm_reporter.rb +6 -2
- data/lib/action_reporter/sentry_reporter.rb +9 -5
- data/lib/action_reporter/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a55d0da65743cb598db1ca915e69704f6fd3871921b015193d6445eaf5f1702b
|
4
|
+
data.tar.gz: 469868c0928f40fbefaabf40a797ce86d3b3aaa16c2f283faaee8dc2ee4a4ee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a280cc47e2b244299dd1279e480b1b65454e810f99ad675f5abfefe4b93dc8b80ed2e84816f28222c11d10977384d5c41fb5c23bcbe53f67d517c28b68dbddb
|
7
|
+
data.tar.gz: b80979582abbedc6db34ba723a8f225200e37c3e2fe5bf5eddd05a4d4301aef0a442fcd97002ac94dc6f4d4fa7cdb383e591afad2108039cb8f80881eb7aeaf6
|
data/CHANGELOG.md
CHANGED
data/action_reporter.gemspec
CHANGED
data/lib/action_reporter/base.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module ActionReporter
|
2
2
|
class Base
|
3
3
|
def self.class_accessor(class_name)
|
4
|
-
|
4
|
+
method_name = class_name.gsub("::", "_").downcase + "_class"
|
5
|
+
define_method(method_name) do
|
6
|
+
raise Error.new("#{class_name} is not defined") unless Object.const_defined?(class_name)
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
Object.const_get(class_name)
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
def transform_context(context)
|
@@ -23,7 +25,7 @@ module ActionReporter
|
|
23
25
|
elsif identifier.respond_to?(:to_s)
|
24
26
|
identifier.to_s
|
25
27
|
else
|
26
|
-
raise ArgumentError
|
28
|
+
raise ArgumentError.new("Unknown check-in identifier: #{identifier.inspect}")
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
@@ -4,21 +4,25 @@ module ActionReporter
|
|
4
4
|
|
5
5
|
def notify(error, context: {})
|
6
6
|
new_context = transform_context(context)
|
7
|
-
|
7
|
+
honeybadger_class.notify(error, context: new_context)
|
8
8
|
end
|
9
9
|
|
10
10
|
def context(args)
|
11
11
|
new_context = transform_context(args)
|
12
|
-
|
12
|
+
honeybadger_class.context(new_context)
|
13
13
|
end
|
14
14
|
|
15
15
|
def reset_context
|
16
|
-
|
16
|
+
honeybadger_class.context.clear!
|
17
17
|
end
|
18
18
|
|
19
19
|
def check_in(identifier)
|
20
20
|
check_in_id = resolve_check_in_id(identifier)
|
21
|
-
|
21
|
+
honeybadger_class.check_in(check_in_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def audited_user=(user)
|
25
|
+
honeybadger_class.context(user_global_id: user.to_global_id.to_s) if user
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -4,19 +4,19 @@ module ActionReporter
|
|
4
4
|
|
5
5
|
def notify(error, context: {})
|
6
6
|
new_context = transform_context(context)
|
7
|
-
|
7
|
+
rails_class.logger.info(
|
8
8
|
"Reporter notification: #{error.inspect}, #{new_context.inspect}"
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
12
12
|
def context(args)
|
13
13
|
new_context = transform_context(args)
|
14
|
-
|
14
|
+
rails_class.logger.info("Reporter context: #{new_context.inspect}")
|
15
15
|
end
|
16
16
|
|
17
17
|
def check_in(identifier)
|
18
18
|
check_in_id = resolve_check_in_id(identifier)
|
19
|
-
|
19
|
+
rails_class.logger.info("Reporter check-in: #{check_in_id}")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -5,12 +5,16 @@ module ActionReporter
|
|
5
5
|
|
6
6
|
def notify(error, context: {})
|
7
7
|
self.context(context)
|
8
|
-
|
8
|
+
scoutapm_error_class.capture(error)
|
9
9
|
end
|
10
10
|
|
11
11
|
def context(args)
|
12
12
|
new_context = transform_context(args)
|
13
|
-
|
13
|
+
scoutapm_context_class.add(new_context)
|
14
|
+
end
|
15
|
+
|
16
|
+
def audited_user=(user)
|
17
|
+
scoutapm_context_class.add_user(user_global_id: user&.to_global_id&.to_s)
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -3,23 +3,27 @@ module ActionReporter
|
|
3
3
|
class_accessor "Sentry"
|
4
4
|
|
5
5
|
def notify(error, context: {})
|
6
|
-
|
6
|
+
sentry_class.with_scope do |temp_scope|
|
7
7
|
temp_scope.set_context("context", transform_context(context))
|
8
8
|
|
9
9
|
if error.is_a?(StandardError)
|
10
|
-
|
10
|
+
sentry_class.capture_exception(error)
|
11
11
|
else
|
12
|
-
|
12
|
+
sentry_class.capture_message(error)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
def context(args)
|
18
|
-
|
18
|
+
sentry_class.get_current_scope.set_context("context", transform_context(args))
|
19
|
+
end
|
20
|
+
|
21
|
+
def reset_context
|
22
|
+
sentry_class.get_current_scope.set_context("context", {})
|
19
23
|
end
|
20
24
|
|
21
25
|
def audited_user=(user)
|
22
|
-
|
26
|
+
sentry_class.set_user(user_global_id: user&.to_global_id&.to_s)
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Makarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby wrapper for multiple reporting services
|
14
14
|
email:
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- lib/action_reporter.rb
|
25
25
|
- lib/action_reporter/audited_reporter.rb
|
26
26
|
- lib/action_reporter/base.rb
|
27
|
+
- lib/action_reporter/error.rb
|
27
28
|
- lib/action_reporter/honeybadger_reporter.rb
|
28
29
|
- lib/action_reporter/rails_reporter.rb
|
29
30
|
- lib/action_reporter/scout_apm_reporter.rb
|