action_reporter 1.4.1 → 1.5.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/README.md +20 -1
- data/action_reporter.gemspec +13 -13
- data/lib/action_reporter/audited_reporter.rb +22 -8
- data/lib/action_reporter/honeybadger_reporter.rb +1 -1
- data/lib/action_reporter/paper_trail_reporter.rb +2 -2
- data/lib/action_reporter/scout_apm_reporter.rb +5 -1
- data/lib/action_reporter/sentry_reporter.rb +1 -1
- data/lib/action_reporter.rb +33 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f663c691abaa4b55ce115001639b405521d07ee55b9bb37ec838c26f28e2fd4d
|
4
|
+
data.tar.gz: 4acb1954e62b1ecbfe19ba4112b1147bba8c44cbd703052bfba433b7aacd4cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d4554027681577f761d588d77a61e6745951de6b39671e8ff75e0d8190bb81173ece7cd521190a801a277cbf52392b7f816e40ae470115fa424381c75a3018e
|
7
|
+
data.tar.gz: 37265ec7091183773a6261ac2ae1b0e006f77bbd050bd03bfd48b18d1c17f3a1d661707024602cfeb76a4a5a1cc87a78193f0aa0f0d64c563b59a526e4213c88
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/action_reporter.svg)](https://badge.fury.io/rb/action_reporter) [![Test Status](https://github.com/amkisko/action_reporter.rb/actions/workflows/test.yml/badge.svg)](https://github.com/amkisko/action_reporter.rb/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/amkisko/action_reporter.rb/graph/badge.svg?token=JCV2A7NWTE)](https://codecov.io/gh/amkisko/action_reporter.rb)
|
4
4
|
|
5
|
+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f4bef9a52eac43a5a0f6d8c1b58cc6af)](https://app.codacy.com/gh/amkisko/action_reporter.rb/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/f4bef9a52eac43a5a0f6d8c1b58cc6af)](https://app.codacy.com/gh/amkisko/action_reporter.rb/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
6
|
+
|
5
7
|
Ruby wrapper for multiple reporting services.
|
6
8
|
|
7
9
|
Supported services:
|
@@ -50,11 +52,28 @@ ActionReporter.enabled_reporters = [
|
|
50
52
|
Then you can use it in your code:
|
51
53
|
|
52
54
|
```ruby
|
53
|
-
ActionReporter.
|
55
|
+
ActionReporter.current_user = current_user
|
56
|
+
ActionReporter.current_request_uuid = request.env['action_dispatch.request_id']
|
57
|
+
ActionReporter.current_remote_addr = request.env['action_dispatch.remote_ip']
|
54
58
|
ActionReporter.context(entry_id: entry.id)
|
55
59
|
ActionReporter.notify('Something went wrong', context: { record: record })
|
56
60
|
```
|
57
61
|
|
62
|
+
## Hook debugger to notify method
|
63
|
+
|
64
|
+
Apply patch on initializer level or before running the main code:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
module ActionReporter
|
68
|
+
class RailsReporter < Base
|
69
|
+
def notify(error, context: {})
|
70
|
+
super
|
71
|
+
binding.pry
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
58
77
|
## Contributing
|
59
78
|
|
60
79
|
Bug reports and pull requests are welcome on GitHub at https://github.com/amkisko/action_reporter.rb
|
data/action_reporter.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "action_reporter"
|
3
|
-
gem.version = File.read(File.expand_path(
|
3
|
+
gem.version = File.read(File.expand_path("../lib/action_reporter.rb", __FILE__)).match(/VERSION\s*=\s*'(.*?)'/)[1]
|
4
4
|
|
5
5
|
gem.license = "MIT"
|
6
6
|
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
"rubygems_mfa_required" => "true"
|
22
22
|
}
|
23
23
|
|
24
|
-
gem.files = Dir.glob("lib/**/*.rb") + Dir.glob("bin/**/*") + %w
|
24
|
+
gem.files = Dir.glob("lib/**/*.rb") + Dir.glob("bin/**/*") + %w[CHANGELOG.md LICENSE.md README.md action_reporter.gemspec]
|
25
25
|
|
26
26
|
# s.bindir = "bin"
|
27
27
|
# s.executables = ["action_reporter"]
|
@@ -29,17 +29,17 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.required_ruby_version = ">= 2.5.0"
|
30
30
|
gem.require_path = "lib"
|
31
31
|
|
32
|
-
gem.add_runtime_dependency
|
32
|
+
gem.add_runtime_dependency "rails", "> 5"
|
33
33
|
|
34
|
-
gem.add_development_dependency
|
35
|
-
gem.add_development_dependency
|
36
|
-
gem.add_development_dependency
|
37
|
-
gem.add_development_dependency
|
38
|
-
gem.add_development_dependency
|
34
|
+
gem.add_development_dependency "audited", "~> 5"
|
35
|
+
gem.add_development_dependency "honeybadger", "~> 5"
|
36
|
+
gem.add_development_dependency "sentry-ruby", "~> 5"
|
37
|
+
gem.add_development_dependency "scout_apm", "~> 5"
|
38
|
+
gem.add_development_dependency "paper_trail", "~> 15"
|
39
39
|
|
40
|
-
gem.add_development_dependency
|
41
|
-
gem.add_development_dependency
|
42
|
-
gem.add_development_dependency
|
43
|
-
gem.add_development_dependency
|
44
|
-
gem.add_development_dependency
|
40
|
+
gem.add_development_dependency "rspec", "~> 3"
|
41
|
+
gem.add_development_dependency "webmock", "~> 3"
|
42
|
+
gem.add_development_dependency "pry", "~> 0.14"
|
43
|
+
gem.add_development_dependency "simplecov", "~> 0.21"
|
44
|
+
gem.add_development_dependency "simplecov-cobertura", "~> 2"
|
45
45
|
end
|
@@ -6,22 +6,36 @@ module ActionReporter
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def context(args)
|
9
|
-
Audited.store[:current_remote_address] = args[:remote_addr] if args[
|
10
|
-
:remote_addr
|
11
|
-
].present?
|
12
9
|
end
|
13
10
|
|
14
11
|
def reset_context
|
15
12
|
Audited.store.delete(:current_remote_address)
|
16
|
-
Audited.store.delete(:
|
13
|
+
Audited.store.delete(:current_request_uuid)
|
14
|
+
Audited.store.delete(:current_user)
|
17
15
|
end
|
18
16
|
|
19
|
-
def
|
20
|
-
Audited.store[:
|
17
|
+
def current_user
|
18
|
+
Audited.store[:current_user]
|
21
19
|
end
|
22
20
|
|
23
|
-
def
|
24
|
-
Audited.store[:
|
21
|
+
def current_user=(user)
|
22
|
+
Audited.store[:current_user] = user
|
23
|
+
end
|
24
|
+
|
25
|
+
def current_request_uuid
|
26
|
+
Audited.store[:current_request_uuid]
|
27
|
+
end
|
28
|
+
|
29
|
+
def current_request_uuid=(request_uuid)
|
30
|
+
Audited.store[:current_request_uuid] = request_uuid
|
31
|
+
end
|
32
|
+
|
33
|
+
def current_remote_addr
|
34
|
+
Audited.store[:current_remote_address]
|
35
|
+
end
|
36
|
+
|
37
|
+
def current_remote_addr=(remote_addr)
|
38
|
+
Audited.store[:current_remote_address] = remote_addr
|
25
39
|
end
|
26
40
|
end
|
27
41
|
end
|
@@ -12,11 +12,11 @@ module ActionReporter
|
|
12
12
|
PaperTrail.request.whodunnit = nil
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def current_user
|
16
16
|
PaperTrail.request.whodunnit
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def current_user=(user)
|
20
20
|
PaperTrail.request.whodunnit = user
|
21
21
|
end
|
22
22
|
end
|
@@ -13,8 +13,12 @@ module ActionReporter
|
|
13
13
|
scoutapm_context_class.add(new_context)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def current_user=(user)
|
17
17
|
scoutapm_context_class.add_user(user_global_id: user&.to_global_id&.to_s)
|
18
18
|
end
|
19
|
+
|
20
|
+
def ignore_transaction!
|
21
|
+
scoutapm_context_class.ignore_transaction!
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/action_reporter.rb
CHANGED
@@ -10,7 +10,7 @@ require 'action_reporter/paper_trail_reporter'
|
|
10
10
|
module ActionReporter
|
11
11
|
module_function
|
12
12
|
|
13
|
-
VERSION = '1.
|
13
|
+
VERSION = '1.5.0'.freeze
|
14
14
|
|
15
15
|
AVAILABLE_REPORTERS = [
|
16
16
|
ActionReporter::RailsReporter,
|
@@ -55,15 +55,42 @@ module ActionReporter
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
58
|
+
def current_user
|
59
|
+
@current_user
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def current_user=(user)
|
63
|
+
@current_user = user
|
63
64
|
enabled_reporters.each do |reporter|
|
64
|
-
next unless reporter.respond_to?(:
|
65
|
+
next unless reporter.respond_to?(:current_user=)
|
65
66
|
|
66
|
-
reporter.
|
67
|
+
reporter.current_user = user
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def current_request_uuid
|
72
|
+
@current_request_uuid
|
73
|
+
end
|
74
|
+
|
75
|
+
def current_request_uuid=(request_uuid)
|
76
|
+
@current_request_uuid = request_uuid
|
77
|
+
enabled_reporters.each do |reporter|
|
78
|
+
next unless reporter.respond_to?(:current_request_uuid=)
|
79
|
+
|
80
|
+
reporter.current_request_uuid = request_uuid
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def current_remote_addr
|
85
|
+
@current_remote_addr
|
86
|
+
end
|
87
|
+
|
88
|
+
def current_remote_addr=(remote_addr)
|
89
|
+
@current_remote_addr = remote_addr
|
90
|
+
enabled_reporters.each do |reporter|
|
91
|
+
next unless reporter.respond_to?(:current_remote_addr=)
|
92
|
+
|
93
|
+
reporter.current_remote_addr = remote_addr
|
67
94
|
end
|
68
95
|
end
|
69
96
|
|
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.5.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: 2024-
|
11
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.5.11
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: See description
|