uniform_notifier 1.16.0 → 1.17.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/.github/workflows/ci.yml +2 -0
- data/CHANGELOG.md +9 -5
- data/lib/uniform_notifier/base.rb +2 -1
- data/lib/uniform_notifier/opentelemetry.rb +21 -0
- data/lib/uniform_notifier/version.rb +1 -1
- data/lib/uniform_notifier.rb +4 -1
- data/spec/uniform_notifier/bugsnag_spec.rb +2 -6
- data/spec/uniform_notifier/opentelemetry_spec.rb +33 -0
- data/spec/uniform_notifier/raise_spec.rb +9 -6
- data/spec/uniform_notifier/slack_spec.rb +2 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d641654b7aff4ab4206fd82919704ed0c0ec1046b89ce57f30d886b28b52a8b1
|
4
|
+
data.tar.gz: 9b6b94fe108c905bb43386f22fd7882a1b8aac22f36e6f46c1e8da70923bdbc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 156cef00e47ac3bedb24a6a81c16c6567b9ce4fcdb101e0651347244a71b4a0cc1f66d6821af6649540edffdbb92511bbe497ad5216f74e8f737ebb8afcd7ddc
|
7
|
+
data.tar.gz: dcb2bbe6a3f977ac76c74b280a6a773440a8d367141df4466996a40bf72e94547a0fb29063d7676b89d4cf341cf5310cdb307953e0046c806dcf5161d1405ca0
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,24 +1,28 @@
|
|
1
1
|
# Next Release
|
2
2
|
|
3
|
-
|
3
|
+
## 1.17.0 (05/07/2025)
|
4
|
+
|
5
|
+
* Introduce opentelemetry notifier
|
6
|
+
|
7
|
+
## 1.16.0 (03/24/2022)
|
4
8
|
|
5
9
|
* Drop Growl support
|
6
10
|
* Move CI from travis to github actions
|
7
11
|
|
8
|
-
|
12
|
+
## 1.15.0 (03/21/2022)
|
9
13
|
|
10
14
|
* Fix bugsnag notifications
|
11
15
|
* Improve appsignal message
|
12
16
|
|
13
|
-
|
17
|
+
## 1.14.2 (03/24/2021)
|
14
18
|
|
15
19
|
* Fix `capture_exception` signature
|
16
20
|
|
17
|
-
|
21
|
+
## 1.14.1 (02/28/2021)
|
18
22
|
|
19
23
|
* Fix uninitialized constant ``UniformNotifier::SentryNotifier::Raven`` error
|
20
24
|
|
21
|
-
|
25
|
+
## 1.14.0 (02/26/2021)
|
22
26
|
|
23
27
|
* Add AppSignal integration
|
24
28
|
* Fix `UniformNotifier::Raise.active?` when `.rails=` receives a false value
|
@@ -33,7 +33,8 @@ class UniformNotifier
|
|
33
33
|
|
34
34
|
def wrap_js_association(code, attributes = {})
|
35
35
|
attributes = { type: 'text/javascript' }.merge(attributes || {})
|
36
|
-
attributes_string = attributes.map { |k, v| "#{k}=#{v.to_s.inspect}" }
|
36
|
+
attributes_string = attributes.map { |k, v| "#{k}=#{v.to_s.inspect}" }
|
37
|
+
.join(' ')
|
37
38
|
|
38
39
|
<<~CODE
|
39
40
|
<script #{attributes_string}>/*<![CDATA[*/
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UniformNotifier
|
4
|
+
class OpenTelemetryNotifier < Base
|
5
|
+
class << self
|
6
|
+
def active?
|
7
|
+
!!UniformNotifier.opentelemetry
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def _out_of_channel_notify(data)
|
13
|
+
message = data.values.compact.join("\n")
|
14
|
+
|
15
|
+
exception = Exception.new(message)
|
16
|
+
current_span = OpenTelemetry::Trace.current_span
|
17
|
+
current_span.record_exception(exception)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/uniform_notifier.rb
CHANGED
@@ -16,6 +16,7 @@ require 'uniform_notifier/appsignal'
|
|
16
16
|
require 'uniform_notifier/slack'
|
17
17
|
require 'uniform_notifier/raise'
|
18
18
|
require 'uniform_notifier/terminal_notifier'
|
19
|
+
require 'uniform_notifier/opentelemetry'
|
19
20
|
|
20
21
|
class UniformNotifier
|
21
22
|
AVAILABLE_NOTIFIERS = %i[
|
@@ -33,6 +34,7 @@ class UniformNotifier
|
|
33
34
|
sentry
|
34
35
|
appsignal
|
35
36
|
terminal_notifier
|
37
|
+
opentelemetry
|
36
38
|
].freeze
|
37
39
|
|
38
40
|
NOTIFIERS = [
|
@@ -49,7 +51,8 @@ class UniformNotifier
|
|
49
51
|
Slack,
|
50
52
|
SentryNotifier,
|
51
53
|
AppsignalNotifier,
|
52
|
-
TerminalNotifier
|
54
|
+
TerminalNotifier,
|
55
|
+
OpenTelemetryNotifier
|
53
56
|
].freeze
|
54
57
|
|
55
58
|
class NotificationError < StandardError
|
@@ -22,9 +22,7 @@ RSpec.describe UniformNotifier::BugsnagNotifier do
|
|
22
22
|
let(:notification_data) { 'notify bugsnag' }
|
23
23
|
|
24
24
|
it 'should notify bugsnag' do
|
25
|
-
expect(Bugsnag).to receive(:notify).with(
|
26
|
-
UniformNotifier::Exception.new(notification_data)
|
27
|
-
).and_yield(report)
|
25
|
+
expect(Bugsnag).to receive(:notify).with(UniformNotifier::Exception.new(notification_data)).and_yield(report)
|
28
26
|
expect(report).to receive(:severity=).with('warning')
|
29
27
|
expect(report).to receive(:add_tab).with(:bullet, { title: notification_data })
|
30
28
|
expect(report).to receive(:grouping_hash=).with(notification_data)
|
@@ -34,9 +32,7 @@ RSpec.describe UniformNotifier::BugsnagNotifier do
|
|
34
32
|
end
|
35
33
|
|
36
34
|
it 'should notify bugsnag with additional report configuration' do
|
37
|
-
expect(Bugsnag).to receive(:notify).with(
|
38
|
-
UniformNotifier::Exception.new(notification_data)
|
39
|
-
).and_yield(report)
|
35
|
+
expect(Bugsnag).to receive(:notify).with(UniformNotifier::Exception.new(notification_data)).and_yield(report)
|
40
36
|
expect(report).to receive(:meta_data=).with({ foo: :bar })
|
41
37
|
|
42
38
|
UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
class OpenTelemetry
|
6
|
+
class Trace
|
7
|
+
# mock OpenTelemetry
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.describe UniformNotifier::OpenTelemetryNotifier do
|
12
|
+
it 'should not notify OpenTelemetry' do
|
13
|
+
expect(UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')).to be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should notify OpenTelemetry' do
|
17
|
+
span = double('span')
|
18
|
+
expect(span).to receive(:record_exception).with(UniformNotifier::Exception.new('notify otel'))
|
19
|
+
expect(OpenTelemetry::Trace).to receive(:current_span).and_return(span)
|
20
|
+
|
21
|
+
UniformNotifier.opentelemetry = true
|
22
|
+
UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should notify OpenTelemetry' do
|
26
|
+
span = double('span')
|
27
|
+
expect(span).to receive(:record_exception).with(UniformNotifier::Exception.new('notify otel'))
|
28
|
+
expect(OpenTelemetry::Trace).to receive(:current_span).and_return(span)
|
29
|
+
|
30
|
+
UniformNotifier.opentelemetry = { foo: :bar }
|
31
|
+
UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify('notify otel')
|
32
|
+
end
|
33
|
+
end
|
@@ -9,22 +9,25 @@ RSpec.describe UniformNotifier::Raise do
|
|
9
9
|
|
10
10
|
it 'should raise error of the default class' do
|
11
11
|
UniformNotifier.raise = true
|
12
|
-
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
13
|
+
.to raise_error(
|
14
|
+
UniformNotifier::Exception,
|
15
|
+
'notification'
|
16
|
+
)
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'allows the user to override the default exception class' do
|
19
20
|
klass = Class.new(RuntimeError)
|
20
21
|
UniformNotifier.raise = klass
|
21
|
-
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
22
|
+
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
23
|
+
.to raise_error(klass, 'notification')
|
22
24
|
end
|
23
25
|
|
24
26
|
it 'can be turned from on to off again' do
|
25
27
|
UniformNotifier.raise = true
|
26
28
|
UniformNotifier.raise = false
|
27
29
|
|
28
|
-
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
30
|
+
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
31
|
+
.not_to raise_error
|
29
32
|
end
|
30
33
|
end
|
@@ -13,7 +13,8 @@ RSpec.describe UniformNotifier::Slack do
|
|
13
13
|
context 'configuration' do
|
14
14
|
context 'no webhook_url is given' do
|
15
15
|
it 'should raise an error' do
|
16
|
-
expect { UniformNotifier.slack = {} }
|
16
|
+
expect { UniformNotifier.slack = {} }
|
17
|
+
.to raise_error(UniformNotifier::NotificationError)
|
17
18
|
end
|
18
19
|
|
19
20
|
it 'should not notify slack' do
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniform_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rspec
|
@@ -77,6 +76,7 @@ files:
|
|
77
76
|
- lib/uniform_notifier/honeybadger.rb
|
78
77
|
- lib/uniform_notifier/javascript_alert.rb
|
79
78
|
- lib/uniform_notifier/javascript_console.rb
|
79
|
+
- lib/uniform_notifier/opentelemetry.rb
|
80
80
|
- lib/uniform_notifier/rails_logger.rb
|
81
81
|
- lib/uniform_notifier/raise.rb
|
82
82
|
- lib/uniform_notifier/rollbar.rb
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- spec/uniform_notifier/honeybadger_spec.rb
|
95
95
|
- spec/uniform_notifier/javascript_alert_spec.rb
|
96
96
|
- spec/uniform_notifier/javascript_console_spec.rb
|
97
|
+
- spec/uniform_notifier/opentelemetry_spec.rb
|
97
98
|
- spec/uniform_notifier/rails_logger_spec.rb
|
98
99
|
- spec/uniform_notifier/raise_spec.rb
|
99
100
|
- spec/uniform_notifier/rollbar_spec.rb
|
@@ -109,7 +110,6 @@ metadata:
|
|
109
110
|
changelog_uri: https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md
|
110
111
|
source_code_uri: https://github.com/flyerhzm/uniform_notifier
|
111
112
|
bug_tracker_uri: https://github.com/flyerhzm/uniform_notifier/issues
|
112
|
-
post_install_message:
|
113
113
|
rdoc_options: []
|
114
114
|
require_paths:
|
115
115
|
- lib
|
@@ -124,8 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
128
|
-
signing_key:
|
127
|
+
rubygems_version: 3.6.7
|
129
128
|
specification_version: 4
|
130
129
|
summary: uniform notifier for rails logger, customized logger, javascript alert, javascript
|
131
130
|
console and xmpp
|
@@ -139,6 +138,7 @@ test_files:
|
|
139
138
|
- spec/uniform_notifier/honeybadger_spec.rb
|
140
139
|
- spec/uniform_notifier/javascript_alert_spec.rb
|
141
140
|
- spec/uniform_notifier/javascript_console_spec.rb
|
141
|
+
- spec/uniform_notifier/opentelemetry_spec.rb
|
142
142
|
- spec/uniform_notifier/rails_logger_spec.rb
|
143
143
|
- spec/uniform_notifier/raise_spec.rb
|
144
144
|
- spec/uniform_notifier/rollbar_spec.rb
|