action_reporter 3.1.0 → 3.2.2
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 +25 -0
- data/README.md +15 -2
- data/action_reporter.gemspec +7 -6
- data/bin/polyrun +108 -0
- data/lib/action_reporter/active_version_reporter.rb +4 -2
- data/lib/action_reporter/audited_reporter.rb +4 -2
- data/lib/action_reporter/base.rb +12 -2
- data/lib/action_reporter/honeybadger_reporter.rb +5 -3
- data/lib/action_reporter/paper_trail_reporter.rb +1 -1
- data/lib/action_reporter/plugin_discovery.rb +3 -3
- data/lib/action_reporter/scout_apm_reporter.rb +23 -7
- data/lib/action_reporter/sentry_reporter.rb +26 -6
- data/lib/action_reporter/version.rb +1 -1
- data/lib/action_reporter.rb +17 -0
- metadata +35 -34
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2b857fcdb2cb3d2a5c295a64ccb2e19d9b8e3d901318470daf4150e763ab719
|
|
4
|
+
data.tar.gz: ef0bff6df6d8c5674f665286c7ebd3835eea4a822133efc63f48745e9ca051cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 419c025a5525b32a6d76654225ae11469dd6b2fda5a6d34325926c4f3e1e5fb05fbca634cd18494fc48c9b1e579955102e5f4ec85161c22ba46f9c9efa84380b
|
|
7
|
+
data.tar.gz: 509c80e97e8f3405da0eda1d118a98bedefe8a7834c24eaca6fdde5a584938f69cc15bd1b6d2f565f2347e7878d2069c8563b379ee962d27eefaac3224610e75
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 3.2.2 (2026-11-07)
|
|
4
|
+
|
|
5
|
+
- Clear Sentry user and transaction identifiers when resetting request context.
|
|
6
|
+
- Delete the Sentry `transaction_id` tag when the setter receives `nil`.
|
|
7
|
+
- Clear ScoutApm user and extra context when resetting request context.
|
|
8
|
+
- Restore ScoutApm extra context after `notify` so per-call context does not linger.
|
|
9
|
+
- Call `ScoutApm::Transaction.ignore!` from `ScoutApmReporter#ignore_transaction!`.
|
|
10
|
+
- Cancel release preparation when confirmation input is closed.
|
|
11
|
+
- Require a CHANGELOG version heading before gem push.
|
|
12
|
+
- Run the test workflow on pull requests with read-only contents permission.
|
|
13
|
+
|
|
14
|
+
## 3.2.1 (2026-07-13)
|
|
15
|
+
|
|
16
|
+
- Fix check-in identifier errors to raise `ActionReporter::Error` instead of stack overflow when an identifier cannot be stringified
|
|
17
|
+
|
|
18
|
+
## 3.2.0 (2026-07-13)
|
|
19
|
+
|
|
20
|
+
- Improve context propagation across reporters
|
|
21
|
+
- Merge updates into existing reporter context instead of replacing prior keys on each call
|
|
22
|
+
- Remove context keys when an update passes `nil` for that key
|
|
23
|
+
- Apply shared merge semantics to `ActiveVersionReporter`, `AuditedReporter`, `HoneybadgerReporter`, `ScoutApmReporter`, and `SentryReporter`
|
|
24
|
+
- Improve `SentryReporter` reset to clear the reporter context bucket from the Sentry scope
|
|
25
|
+
- Remove unused `gem_spec` parameter from reporter `class_accessor` declarations (version checks were dropped in 2.0.1)
|
|
26
|
+
- Improve plugin discovery warnings for reporter files and registrations that fail to load
|
|
27
|
+
|
|
3
28
|
## 3.1.0 (2026-03-27)
|
|
4
29
|
|
|
5
30
|
- Add `ActionReporter.user_id_resolver` for configuring how to resolve user IDs
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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://app.codecov.io/github/amkisko/action_reporter.rb) [](https://sonarcloud.io/project/overview?id=amkisko_action_reporter.rb)
|
|
4
4
|
|
|
5
5
|
Ruby wrapper for multiple reporting services.
|
|
6
6
|
|
|
@@ -133,7 +133,7 @@ end
|
|
|
133
133
|
```bash
|
|
134
134
|
bundle install
|
|
135
135
|
bundle exec appraisal generate
|
|
136
|
-
bundle exec rspec
|
|
136
|
+
bundle exec polyrun parallel-rspec --workers 5 --merge-failures
|
|
137
137
|
bin/appraisals
|
|
138
138
|
bundle exec standardrb --fix
|
|
139
139
|
```
|
|
@@ -163,6 +163,19 @@ gem push action_reporter-*.gem
|
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
|
|
166
|
+
## Links
|
|
167
|
+
|
|
168
|
+
- [GitHub](https://github.com/amkisko/action_reporter.rb)
|
|
169
|
+
- [GitLab](https://gitlab.com/amkisko/action_reporter.rb)
|
|
170
|
+
- [RubyGems](https://rubygems.org/gems/action_reporter)
|
|
171
|
+
- [Versions Atom](https://rubygems.org/gems/action_reporter/versions.atom) (feed id `5814531496962`)
|
|
172
|
+
- [libraries.io](https://libraries.io/rubygems/action_reporter)
|
|
173
|
+
- [Deps.dev](https://deps.dev/rubygems/action_reporter)
|
|
174
|
+
- [SonarCloud](https://sonarcloud.io/project/overview?id=amkisko_action_reporter.rb)
|
|
175
|
+
- [Snyk](https://snyk.io/test/github/amkisko/action_reporter.rb)
|
|
176
|
+
- [Codecov](https://app.codecov.io/github/amkisko/action_reporter.rb)
|
|
177
|
+
- [OpenSSF Scorecard](https://scorecard.dev/viewer/?uri=github.com/amkisko/action_reporter.rb)
|
|
178
|
+
|
|
166
179
|
## License
|
|
167
180
|
|
|
168
181
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/action_reporter.gemspec
CHANGED
|
@@ -28,10 +28,12 @@ Gem::Specification.new do |gem|
|
|
|
28
28
|
# s.bindir = "bin"
|
|
29
29
|
# s.executables = ["action_reporter"]
|
|
30
30
|
|
|
31
|
-
gem.required_ruby_version = ">=
|
|
31
|
+
gem.required_ruby_version = ">= 3.4"
|
|
32
32
|
gem.require_path = "lib"
|
|
33
33
|
|
|
34
|
-
gem.add_runtime_dependency "
|
|
34
|
+
gem.add_runtime_dependency "activesupport", ">= 7.0"
|
|
35
|
+
|
|
36
|
+
gem.add_development_dependency "rails", "> 5"
|
|
35
37
|
|
|
36
38
|
gem.add_development_dependency "audited", "~> 5"
|
|
37
39
|
gem.add_development_dependency "honeybadger", "~> 5"
|
|
@@ -40,13 +42,12 @@ Gem::Specification.new do |gem|
|
|
|
40
42
|
gem.add_development_dependency "paper_trail", "~> 15"
|
|
41
43
|
gem.add_development_dependency "active_version", "~> 1"
|
|
42
44
|
|
|
43
|
-
gem.add_development_dependency "bundler", "
|
|
45
|
+
gem.add_development_dependency "bundler", ">= 2"
|
|
44
46
|
gem.add_development_dependency "rspec", "~> 3"
|
|
45
|
-
gem.add_development_dependency "
|
|
47
|
+
gem.add_development_dependency "polyrun", ">= 2.2.9"
|
|
48
|
+
gem.add_development_dependency "prosopite", "~> 2.0"
|
|
46
49
|
gem.add_development_dependency "webmock", "~> 3"
|
|
47
50
|
gem.add_development_dependency "pry", "~> 0.15"
|
|
48
|
-
gem.add_development_dependency "simplecov", "~> 0.22"
|
|
49
|
-
gem.add_development_dependency "simplecov-cobertura", "~> 3"
|
|
50
51
|
gem.add_development_dependency "standard", "~> 1.52"
|
|
51
52
|
gem.add_development_dependency "standard-custom", "~> 1.0"
|
|
52
53
|
gem.add_development_dependency "standard-performance", "~> 1.8"
|
data/bin/polyrun
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Delegates to `bundle exec polyrun` with repo config.
|
|
3
|
+
# - No args → same as `polyrun` with no subcommand (auto parallel RSpec from polyrun.yml / spec/**/*_spec.rb).
|
|
4
|
+
# - Path-like argv (spec files, globs, dirs) → polyrun implicit parallel (path-only argv).
|
|
5
|
+
# - Named subcommands (plan, config, parallel-rspec, ci-shard-rspec, …) → pass through.
|
|
6
|
+
# - Otherwise (RSpec flags first, e.g. --format) → `start --workers N -- bundle exec rspec "$@"`.
|
|
7
|
+
# Globals: -c/--config, -v/--verbose, -h/--help, --help (same as bundle exec polyrun).
|
|
8
|
+
# Workers: POLYRUN_WORKERS (default 5, max 10, min 1) — read by polyrun run-shards/start.
|
|
9
|
+
set -eo pipefail
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
11
|
+
cd "$ROOT"
|
|
12
|
+
|
|
13
|
+
W="${POLYRUN_WORKERS:-5}"
|
|
14
|
+
case "$W" in ''|*[!0-9]*) W=5 ;; esac
|
|
15
|
+
if [ "$W" -gt 10 ]; then W=10; fi
|
|
16
|
+
if [ "$W" -lt 1 ]; then W=1; fi
|
|
17
|
+
|
|
18
|
+
CONFIG="${POLYRUN_CONFIG:-polyrun.yml}"
|
|
19
|
+
polyrun_prefix=()
|
|
20
|
+
have_config=0
|
|
21
|
+
|
|
22
|
+
while [ $# -gt 0 ]; do
|
|
23
|
+
case "$1" in
|
|
24
|
+
-c|--config)
|
|
25
|
+
polyrun_prefix+=("$1" "$2")
|
|
26
|
+
CONFIG="$2"
|
|
27
|
+
have_config=1
|
|
28
|
+
shift 2
|
|
29
|
+
;;
|
|
30
|
+
-v|--verbose)
|
|
31
|
+
polyrun_prefix+=("$1")
|
|
32
|
+
shift
|
|
33
|
+
;;
|
|
34
|
+
-h|--help)
|
|
35
|
+
if [ "$have_config" -eq 0 ]; then
|
|
36
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" -c "$CONFIG" -h
|
|
37
|
+
else
|
|
38
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" -h
|
|
39
|
+
fi
|
|
40
|
+
;;
|
|
41
|
+
*)
|
|
42
|
+
break
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
if [ "${1:-}" = "--version" ]; then
|
|
48
|
+
if [ "$have_config" -eq 0 ]; then
|
|
49
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" -c "$CONFIG" version
|
|
50
|
+
else
|
|
51
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" version
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
is_polyrun_command() {
|
|
56
|
+
case "$1" in
|
|
57
|
+
plan|prepare|merge-coverage|report-coverage|report-junit|report-timing|env|config|merge-timing|\
|
|
58
|
+
db:setup-template|db:setup-shard|db:clone-shards|run-shards|parallel-rspec|start|build-paths|\
|
|
59
|
+
ci-shard-run|ci-shard-rspec|init|queue|quick|help|version)
|
|
60
|
+
return 0 ;;
|
|
61
|
+
*)
|
|
62
|
+
return 1 ;;
|
|
63
|
+
esac
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# True if argv should use polyrun implicit path parallel (any path-like token).
|
|
67
|
+
implicit_path_in_argv() {
|
|
68
|
+
for a in "$@"; do
|
|
69
|
+
case "$a" in
|
|
70
|
+
-*) [ "$a" = "-" ] || continue ;;
|
|
71
|
+
esac
|
|
72
|
+
case "$a" in
|
|
73
|
+
*.rb|spec/*|test/*|./|/*|*[\*\?[]*) return 0 ;;
|
|
74
|
+
esac
|
|
75
|
+
[ -e "$a" ] && return 0
|
|
76
|
+
done
|
|
77
|
+
return 1
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
run_polyrun() {
|
|
81
|
+
if [ "$have_config" -eq 0 ]; then
|
|
82
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" -c "$CONFIG" "$@"
|
|
83
|
+
else
|
|
84
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" "$@"
|
|
85
|
+
fi
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
exec_parallel_rspec() {
|
|
89
|
+
if [ "$have_config" -eq 0 ]; then
|
|
90
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" -c "$CONFIG" start --workers "$W" -- bundle exec rspec "$@"
|
|
91
|
+
else
|
|
92
|
+
exec bundle exec polyrun "${polyrun_prefix[@]}" start --workers "$W" -- bundle exec rspec "$@"
|
|
93
|
+
fi
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if [ $# -eq 0 ]; then
|
|
97
|
+
run_polyrun
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
if is_polyrun_command "$1"; then
|
|
101
|
+
run_polyrun "$@"
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
if implicit_path_in_argv "$@"; then
|
|
105
|
+
run_polyrun "$@"
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
exec_parallel_rspec "$@"
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
module ActionReporter
|
|
2
2
|
class ActiveVersionReporter < Base
|
|
3
|
-
class_accessor "ActiveVersion"
|
|
3
|
+
class_accessor "ActiveVersion"
|
|
4
4
|
|
|
5
5
|
def notify(*)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def context(args)
|
|
9
|
-
|
|
9
|
+
return unless ActiveVersion.respond_to?(:context=)
|
|
10
|
+
|
|
11
|
+
ActiveVersion.context = merge_context_updates(ActiveVersion.context, args)
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def reset_context
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
module ActionReporter
|
|
2
2
|
class AuditedReporter < Base
|
|
3
|
-
class_accessor "Audited"
|
|
3
|
+
class_accessor "Audited"
|
|
4
4
|
|
|
5
5
|
def notify(*)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def context(args)
|
|
9
|
-
|
|
9
|
+
return unless Audited.respond_to?(:context=)
|
|
10
|
+
|
|
11
|
+
Audited.context = merge_context_updates(Audited.context, args)
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def reset_context
|
data/lib/action_reporter/base.rb
CHANGED
|
@@ -2,7 +2,7 @@ require_relative "error"
|
|
|
2
2
|
|
|
3
3
|
module ActionReporter
|
|
4
4
|
class Base
|
|
5
|
-
def self.class_accessor(class_name
|
|
5
|
+
def self.class_accessor(class_name)
|
|
6
6
|
method_name = class_name.gsub("::", "_").downcase + "_class"
|
|
7
7
|
define_method(method_name) do
|
|
8
8
|
raise ActionReporter::Error.new("#{class_name} is not defined") unless Object.const_defined?(class_name)
|
|
@@ -24,13 +24,23 @@ module ActionReporter
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def merge_context_updates(current, updates)
|
|
28
|
+
transformed = transform_context(updates)
|
|
29
|
+
keys_to_remove = transformed.each_with_object([]) do |(key, value), removals|
|
|
30
|
+
removals << key if value.nil?
|
|
31
|
+
end
|
|
32
|
+
current.merge(transformed).except(*keys_to_remove)
|
|
33
|
+
end
|
|
34
|
+
|
|
27
35
|
def resolve_check_in_id(identifier)
|
|
28
36
|
if identifier.respond_to?(:reporter_check_in)
|
|
29
37
|
identifier.reporter_check_in
|
|
30
38
|
elsif identifier.respond_to?(:to_s)
|
|
31
39
|
identifier.to_s
|
|
32
40
|
else
|
|
33
|
-
raise ActionReporter::Error.new(
|
|
41
|
+
raise ActionReporter::Error.new(
|
|
42
|
+
"Unknown check-in identifier (#{identifier.class}, object_id=#{identifier.object_id})"
|
|
43
|
+
)
|
|
34
44
|
end
|
|
35
45
|
end
|
|
36
46
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module ActionReporter
|
|
2
2
|
class HoneybadgerReporter < Base
|
|
3
|
-
class_accessor "Honeybadger"
|
|
3
|
+
class_accessor "Honeybadger"
|
|
4
4
|
|
|
5
5
|
def notify(error, context: {})
|
|
6
6
|
new_context = transform_context(context)
|
|
@@ -8,8 +8,10 @@ module ActionReporter
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def context(args)
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
current = honeybadger_class.get_context || {}
|
|
12
|
+
merged = merge_context_updates(current, args)
|
|
13
|
+
honeybadger_class.context.clear!
|
|
14
|
+
honeybadger_class.context(merged) unless merged.empty?
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
def reset_context
|
|
@@ -55,7 +55,7 @@ module ActionReporter
|
|
|
55
55
|
discovered_reporters << reporter_class if reporter_class
|
|
56
56
|
rescue => e
|
|
57
57
|
# Silently skip files that can't be loaded (non-blocking)
|
|
58
|
-
warn "ActionReporter: Failed to discover reporter from #{file}: #{e.message}"
|
|
58
|
+
warn "ActionReporter: Failed to discover reporter from #{file}: #{e.message}"
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
self.discovered_reporters = discovered_reporters.freeze
|
|
@@ -74,7 +74,7 @@ module ActionReporter
|
|
|
74
74
|
reporters << reporter_class if reporter_class
|
|
75
75
|
rescue => e
|
|
76
76
|
# Silently skip registered reporters that can't be loaded (non-blocking)
|
|
77
|
-
warn "ActionReporter: Failed to load registered reporter #{config[:class_name]}: #{e.message}"
|
|
77
|
+
warn "ActionReporter: Failed to load registered reporter #{config[:class_name]}: #{e.message}"
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
reporters.uniq.freeze
|
|
@@ -125,7 +125,7 @@ module ActionReporter
|
|
|
125
125
|
begin
|
|
126
126
|
require config[:require_path]
|
|
127
127
|
rescue LoadError => e
|
|
128
|
-
warn "ActionReporter: Could not require #{config[:require_path]}: #{e.message}"
|
|
128
|
+
warn "ActionReporter: Could not require #{config[:require_path]}: #{e.message}"
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
131
|
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
module ActionReporter
|
|
2
2
|
class ScoutApmReporter < Base
|
|
3
|
-
class_accessor "ScoutApm::Error"
|
|
4
|
-
class_accessor "ScoutApm::Context"
|
|
3
|
+
class_accessor "ScoutApm::Error"
|
|
4
|
+
class_accessor "ScoutApm::Context"
|
|
5
|
+
class_accessor "ScoutApm::Transaction"
|
|
5
6
|
|
|
6
7
|
def notify(error, context: {})
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
context_object = scoutapm_context_class.current
|
|
9
|
+
previous_extra = context_object.instance_variable_get(:@extra).dup
|
|
10
|
+
begin
|
|
11
|
+
self.context(context)
|
|
12
|
+
scoutapm_error_class.capture(error)
|
|
13
|
+
ensure
|
|
14
|
+
context_object.instance_variable_set(:@extra, previous_extra)
|
|
15
|
+
end
|
|
9
16
|
end
|
|
10
17
|
|
|
11
18
|
def context(args)
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
context_object = scoutapm_context_class.current
|
|
20
|
+
extra = context_object.instance_variable_get(:@extra).dup
|
|
21
|
+
# ScoutApm::Context.add ignores nil values and has no per-key delete API; replace @extra directly.
|
|
22
|
+
context_object.instance_variable_set(:@extra, merge_context_updates(extra, args))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def reset_context
|
|
26
|
+
context_object = scoutapm_context_class.current
|
|
27
|
+
# ScoutApm::Context no longer exposes clear!; wipe request-local user and extra hashes.
|
|
28
|
+
context_object.instance_variable_set(:@extra, {})
|
|
29
|
+
context_object.instance_variable_set(:@user, {})
|
|
14
30
|
end
|
|
15
31
|
|
|
16
32
|
def current_remote_addr=(remote_addr)
|
|
@@ -23,7 +39,7 @@ module ActionReporter
|
|
|
23
39
|
end
|
|
24
40
|
|
|
25
41
|
def ignore_transaction!
|
|
26
|
-
|
|
42
|
+
scoutapm_transaction_class.ignore!
|
|
27
43
|
end
|
|
28
44
|
end
|
|
29
45
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module ActionReporter
|
|
2
2
|
class SentryReporter < Base
|
|
3
|
-
class_accessor "Sentry"
|
|
3
|
+
class_accessor "Sentry"
|
|
4
4
|
|
|
5
5
|
def notify(error, context: {})
|
|
6
6
|
sentry_class.with_scope do |temp_scope|
|
|
@@ -15,11 +15,15 @@ module ActionReporter
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def context(args)
|
|
18
|
-
|
|
18
|
+
apply_reporter_context(merge_context_updates(current_reporter_context, args))
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def reset_context
|
|
22
|
-
|
|
22
|
+
apply_reporter_context({})
|
|
23
|
+
scope = sentry_class.get_current_scope
|
|
24
|
+
scope.set_user({})
|
|
25
|
+
scope.tags.delete(:transaction_id)
|
|
26
|
+
scope.set_transaction_name(nil)
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
def current_user=(user)
|
|
@@ -28,7 +32,11 @@ module ActionReporter
|
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
def transaction_id=(transaction_id)
|
|
31
|
-
|
|
35
|
+
if transaction_id.nil?
|
|
36
|
+
sentry_class.get_current_scope.tags.delete(:transaction_id)
|
|
37
|
+
else
|
|
38
|
+
sentry_class.set_tags(transaction_id: transaction_id)
|
|
39
|
+
end
|
|
32
40
|
end
|
|
33
41
|
|
|
34
42
|
def transaction_name=(transaction_name)
|
|
@@ -39,8 +47,20 @@ module ActionReporter
|
|
|
39
47
|
|
|
40
48
|
private
|
|
41
49
|
|
|
42
|
-
def
|
|
43
|
-
|
|
50
|
+
def current_reporter_context
|
|
51
|
+
sentry_class.get_current_scope.contexts["context"] || {}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# sentry-ruby merges via set_context and cannot remove keys; replace the bucket via protected setter.
|
|
55
|
+
def apply_reporter_context(context_hash)
|
|
56
|
+
scope = sentry_class.get_current_scope
|
|
57
|
+
contexts = scope.contexts.dup
|
|
58
|
+
if context_hash.empty?
|
|
59
|
+
contexts.delete("context")
|
|
60
|
+
else
|
|
61
|
+
contexts["context"] = context_hash
|
|
62
|
+
end
|
|
63
|
+
scope.send(:contexts=, contexts)
|
|
44
64
|
end
|
|
45
65
|
end
|
|
46
66
|
end
|
data/lib/action_reporter.rb
CHANGED
|
@@ -37,6 +37,7 @@ module ActionReporter
|
|
|
37
37
|
@logger = nil
|
|
38
38
|
@error_handler = nil
|
|
39
39
|
@user_id_resolver = nil
|
|
40
|
+
@no_reporters_warned = false
|
|
40
41
|
|
|
41
42
|
def enabled_reporters=(reporters)
|
|
42
43
|
@enabled_reporters = reporters || []
|
|
@@ -91,6 +92,8 @@ module ActionReporter
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def notify(error, context: {})
|
|
95
|
+
warn_if_no_reporters(:notify)
|
|
96
|
+
|
|
94
97
|
enabled_reporters.each do |reporter|
|
|
95
98
|
next unless reporter.respond_to?(:notify)
|
|
96
99
|
|
|
@@ -105,6 +108,8 @@ module ActionReporter
|
|
|
105
108
|
def context(args)
|
|
106
109
|
raise ArgumentError, "context must be a Hash" unless args.is_a?(Hash)
|
|
107
110
|
|
|
111
|
+
warn_if_no_reporters(:context)
|
|
112
|
+
|
|
108
113
|
enabled_reporters.each do |reporter|
|
|
109
114
|
next unless reporter.respond_to?(:context)
|
|
110
115
|
|
|
@@ -254,6 +259,18 @@ module ActionReporter
|
|
|
254
259
|
ensure
|
|
255
260
|
self.transaction_name = previous_name if name
|
|
256
261
|
self.transaction_id = previous_id if id
|
|
262
|
+
if context_options.any?
|
|
263
|
+
context(context_options.transform_values { nil })
|
|
264
|
+
end
|
|
257
265
|
end
|
|
258
266
|
end
|
|
267
|
+
|
|
268
|
+
def warn_if_no_reporters(method_name)
|
|
269
|
+
return if @no_reporters_warned
|
|
270
|
+
return unless enabled_reporters.empty?
|
|
271
|
+
|
|
272
|
+
@no_reporters_warned = true
|
|
273
|
+
warn "[action_reporter] #{method_name} called but enabled_reporters is empty"
|
|
274
|
+
end
|
|
275
|
+
private :warn_if_no_reporters
|
|
259
276
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: action_reporter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Makarov
|
|
@@ -9,6 +9,20 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: activesupport
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '7.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '7.0'
|
|
12
26
|
- !ruby/object:Gem::Dependency
|
|
13
27
|
name: rails
|
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -16,7 +30,7 @@ dependencies:
|
|
|
16
30
|
- - ">"
|
|
17
31
|
- !ruby/object:Gem::Version
|
|
18
32
|
version: '5'
|
|
19
|
-
type: :
|
|
33
|
+
type: :development
|
|
20
34
|
prerelease: false
|
|
21
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
36
|
requirements:
|
|
@@ -111,14 +125,14 @@ dependencies:
|
|
|
111
125
|
name: bundler
|
|
112
126
|
requirement: !ruby/object:Gem::Requirement
|
|
113
127
|
requirements:
|
|
114
|
-
- - "
|
|
128
|
+
- - ">="
|
|
115
129
|
- !ruby/object:Gem::Version
|
|
116
130
|
version: '2'
|
|
117
131
|
type: :development
|
|
118
132
|
prerelease: false
|
|
119
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
134
|
requirements:
|
|
121
|
-
- - "
|
|
135
|
+
- - ">="
|
|
122
136
|
- !ruby/object:Gem::Version
|
|
123
137
|
version: '2'
|
|
124
138
|
- !ruby/object:Gem::Dependency
|
|
@@ -136,75 +150,61 @@ dependencies:
|
|
|
136
150
|
- !ruby/object:Gem::Version
|
|
137
151
|
version: '3'
|
|
138
152
|
- !ruby/object:Gem::Dependency
|
|
139
|
-
name:
|
|
140
|
-
requirement: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - "~>"
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: '0.6'
|
|
145
|
-
type: :development
|
|
146
|
-
prerelease: false
|
|
147
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
-
requirements:
|
|
149
|
-
- - "~>"
|
|
150
|
-
- !ruby/object:Gem::Version
|
|
151
|
-
version: '0.6'
|
|
152
|
-
- !ruby/object:Gem::Dependency
|
|
153
|
-
name: webmock
|
|
153
|
+
name: polyrun
|
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
|
155
155
|
requirements:
|
|
156
|
-
- - "
|
|
156
|
+
- - ">="
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
|
-
version:
|
|
158
|
+
version: 2.2.9
|
|
159
159
|
type: :development
|
|
160
160
|
prerelease: false
|
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
|
162
162
|
requirements:
|
|
163
|
-
- - "
|
|
163
|
+
- - ">="
|
|
164
164
|
- !ruby/object:Gem::Version
|
|
165
|
-
version:
|
|
165
|
+
version: 2.2.9
|
|
166
166
|
- !ruby/object:Gem::Dependency
|
|
167
|
-
name:
|
|
167
|
+
name: prosopite
|
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
|
169
169
|
requirements:
|
|
170
170
|
- - "~>"
|
|
171
171
|
- !ruby/object:Gem::Version
|
|
172
|
-
version: '0
|
|
172
|
+
version: '2.0'
|
|
173
173
|
type: :development
|
|
174
174
|
prerelease: false
|
|
175
175
|
version_requirements: !ruby/object:Gem::Requirement
|
|
176
176
|
requirements:
|
|
177
177
|
- - "~>"
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0
|
|
179
|
+
version: '2.0'
|
|
180
180
|
- !ruby/object:Gem::Dependency
|
|
181
|
-
name:
|
|
181
|
+
name: webmock
|
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
|
184
184
|
- - "~>"
|
|
185
185
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '
|
|
186
|
+
version: '3'
|
|
187
187
|
type: :development
|
|
188
188
|
prerelease: false
|
|
189
189
|
version_requirements: !ruby/object:Gem::Requirement
|
|
190
190
|
requirements:
|
|
191
191
|
- - "~>"
|
|
192
192
|
- !ruby/object:Gem::Version
|
|
193
|
-
version: '
|
|
193
|
+
version: '3'
|
|
194
194
|
- !ruby/object:Gem::Dependency
|
|
195
|
-
name:
|
|
195
|
+
name: pry
|
|
196
196
|
requirement: !ruby/object:Gem::Requirement
|
|
197
197
|
requirements:
|
|
198
198
|
- - "~>"
|
|
199
199
|
- !ruby/object:Gem::Version
|
|
200
|
-
version: '
|
|
200
|
+
version: '0.15'
|
|
201
201
|
type: :development
|
|
202
202
|
prerelease: false
|
|
203
203
|
version_requirements: !ruby/object:Gem::Requirement
|
|
204
204
|
requirements:
|
|
205
205
|
- - "~>"
|
|
206
206
|
- !ruby/object:Gem::Version
|
|
207
|
-
version: '
|
|
207
|
+
version: '0.15'
|
|
208
208
|
- !ruby/object:Gem::Dependency
|
|
209
209
|
name: standard
|
|
210
210
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -356,6 +356,7 @@ files:
|
|
|
356
356
|
- LICENSE.md
|
|
357
357
|
- README.md
|
|
358
358
|
- action_reporter.gemspec
|
|
359
|
+
- bin/polyrun
|
|
359
360
|
- lib/action_reporter.rb
|
|
360
361
|
- lib/action_reporter/active_version_reporter.rb
|
|
361
362
|
- lib/action_reporter/audited_reporter.rb
|
|
@@ -386,14 +387,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
386
387
|
requirements:
|
|
387
388
|
- - ">="
|
|
388
389
|
- !ruby/object:Gem::Version
|
|
389
|
-
version:
|
|
390
|
+
version: '3.4'
|
|
390
391
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
392
|
requirements:
|
|
392
393
|
- - ">="
|
|
393
394
|
- !ruby/object:Gem::Version
|
|
394
395
|
version: '0'
|
|
395
396
|
requirements: []
|
|
396
|
-
rubygems_version:
|
|
397
|
+
rubygems_version: 4.0.6
|
|
397
398
|
specification_version: 4
|
|
398
399
|
summary: See description
|
|
399
400
|
test_files: []
|