safely_block 0.5.0 → 1.0.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 -0
- data/LICENSE.txt +1 -1
- data/lib/safely/core.rb +4 -4
- data/lib/safely/services.rb +27 -17
- data/lib/safely/version.rb +1 -1
- 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: 41561aad94651ace9d75c8aa81d8dba46a0c07b2a9e180022719d3f575b3f90b
|
|
4
|
+
data.tar.gz: '08ee6e2e7d88734f9d9ca677a6bd31d3fc812ba261a34b9bc9459e35288fcba5'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e1b36ba993e278a61fbe59283e32e59b514b9202a35ef61ac47f7f56be265236774178b70b50c909bd2f265afa8014c1324c6960b8914029baf8a01fe41391f
|
|
7
|
+
data.tar.gz: 8f08c6ba30769717525cfd81e8a9645a975b765da819aae42287d6a75715b57a76fea0169c15ff31956ebad084c070fb4d70b3cc67599f6d545b77106985943a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 1.0.0 (2026-04-01)
|
|
2
|
+
|
|
3
|
+
- Dropped support for `appsignal` < 3 gem
|
|
4
|
+
- Dropped support for `ddtrace` gem (use `datadog` instead)
|
|
5
|
+
- Dropped support for `sentry-raven` gem (use `sentry-ruby` instead)
|
|
6
|
+
- Dropped support for Ruby < 3.3
|
|
7
|
+
|
|
1
8
|
## 0.5.0 (2025-05-26)
|
|
2
9
|
|
|
3
10
|
- Dropped support for Ruby < 3.2
|
data/LICENSE.txt
CHANGED
data/lib/safely/core.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
# stdlib
|
|
2
|
-
require "digest"
|
|
3
|
-
|
|
4
1
|
# modules
|
|
5
2
|
require_relative "services"
|
|
6
3
|
require_relative "version"
|
|
@@ -32,7 +29,10 @@ module Safely
|
|
|
32
29
|
|
|
33
30
|
def throttled?(e, options)
|
|
34
31
|
return false unless options
|
|
35
|
-
key =
|
|
32
|
+
key = [
|
|
33
|
+
options[:key] || [e.class.name, e.message, e.backtrace.join("\n")].hash,
|
|
34
|
+
(Time.now.to_i / options[:period]) * options[:period]
|
|
35
|
+
]
|
|
36
36
|
throttle_counter.clear if throttle_counter.size > 1000 # prevent from growing indefinitely
|
|
37
37
|
(throttle_counter[key] += 1) > options[:limit]
|
|
38
38
|
end
|
data/lib/safely/services.rb
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
module Safely
|
|
2
2
|
DEFAULT_EXCEPTION_METHOD = proc do |e, info|
|
|
3
3
|
begin
|
|
4
|
-
|
|
4
|
+
if defined?(Airbrake)
|
|
5
|
+
Airbrake.notify(e, info)
|
|
6
|
+
end
|
|
5
7
|
|
|
6
8
|
if defined?(Appsignal)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
transaction.set_tags(info)
|
|
10
|
-
end
|
|
11
|
-
else
|
|
12
|
-
Appsignal.send_error(e, info)
|
|
9
|
+
Appsignal.send_error(e) do |transaction|
|
|
10
|
+
transaction.set_tags(info)
|
|
13
11
|
end
|
|
14
12
|
end
|
|
15
13
|
|
|
@@ -24,20 +22,30 @@ module Safely
|
|
|
24
22
|
Datadog::Tracing.active_span&.set_error(e)
|
|
25
23
|
end
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Google::Cloud::ErrorReporting.report(e) if defined?(Google::Cloud::ErrorReporting)
|
|
25
|
+
if defined?(ExceptionNotifier)
|
|
26
|
+
ExceptionNotifier.notify_exception(e, data: info)
|
|
27
|
+
end
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
if defined?(Google::Cloud::ErrorReporting)
|
|
30
|
+
# TODO add info
|
|
31
|
+
Google::Cloud::ErrorReporting.report(e)
|
|
32
|
+
end
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
if defined?(Honeybadger)
|
|
35
|
+
Honeybadger.notify(e, context: info)
|
|
36
|
+
end
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
if defined?(NewRelic::Agent)
|
|
39
|
+
NewRelic::Agent.notice_error(e, custom_params: info)
|
|
40
|
+
end
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
if defined?(Raygun)
|
|
43
|
+
Raygun.track_exception(e, custom_data: info)
|
|
44
|
+
end
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
if defined?(Rollbar)
|
|
47
|
+
Rollbar.error(e, info)
|
|
48
|
+
end
|
|
41
49
|
|
|
42
50
|
if defined?(ScoutApm::Error)
|
|
43
51
|
# no way to add context for a single call
|
|
@@ -45,7 +53,9 @@ module Safely
|
|
|
45
53
|
ScoutApm::Error.capture(e)
|
|
46
54
|
end
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
if defined?(Sentry)
|
|
57
|
+
Sentry.capture_exception(e, extra: info)
|
|
58
|
+
end
|
|
49
59
|
rescue => e
|
|
50
60
|
$stderr.puts "[safely] Error reporting exception: #{e.class.name}: #{e.message}"
|
|
51
61
|
end
|
data/lib/safely/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: safely_block
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -32,14 +32,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
32
32
|
requirements:
|
|
33
33
|
- - ">="
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: '3.
|
|
35
|
+
version: '3.3'
|
|
36
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
requirements: []
|
|
42
|
-
rubygems_version:
|
|
42
|
+
rubygems_version: 4.0.6
|
|
43
43
|
specification_version: 4
|
|
44
44
|
summary: Rescue and report exceptions in non-critical code
|
|
45
45
|
test_files: []
|