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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 345526c76633d08822fec4f5aae85d96ddae55f7ad72182fac5da280063278fa
4
- data.tar.gz: 3847746070513a8e12a89853821a300579f416be6e9d1f1cc80e2492c5cf7f33
3
+ metadata.gz: d641654b7aff4ab4206fd82919704ed0c0ec1046b89ce57f30d886b28b52a8b1
4
+ data.tar.gz: 9b6b94fe108c905bb43386f22fd7882a1b8aac22f36e6f46c1e8da70923bdbc6
5
5
  SHA512:
6
- metadata.gz: a87a4ad5a16f0f9fe28426318a3c7979dfa6d3c0ae4381f5971a4d31cec48863af9e5474f093fd9e00690cd05e610cba10e79f6a444092a623428637a1b06fc2
7
- data.tar.gz: 8e4a5d81b898650f16eb1bc296c75b36f38d596fb82e94f2cb6f8615cdde94ed4f31c424a89b99db1f07cd8524faede84e115ea616bfa191a0e21f19fd5ca04f
6
+ metadata.gz: 156cef00e47ac3bedb24a6a81c16c6567b9ce4fcdb101e0651347244a71b4a0cc1f66d6821af6649540edffdbb92511bbe497ad5216f74e8f737ebb8afcd7ddc
7
+ data.tar.gz: dcb2bbe6a3f977ac76c74b280a6a773440a8d367141df4466996a40bf72e94547a0fb29063d7676b89d4cf341cf5310cdb307953e0046c806dcf5161d1405ca0
@@ -14,6 +14,8 @@ jobs:
14
14
  - 2.7
15
15
  - 3.0
16
16
  - 3.1
17
+ - 3.2
18
+ - 3.3
17
19
  steps:
18
20
  - name: Checkout code
19
21
  uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,24 +1,28 @@
1
1
  # Next Release
2
2
 
3
- # 1.16.0 (03/24/2022)
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
- # 1.15.0 (03/21/2022)
12
+ ## 1.15.0 (03/21/2022)
9
13
 
10
14
  * Fix bugsnag notifications
11
15
  * Improve appsignal message
12
16
 
13
- # 1.14.2 (03/24/2021)
17
+ ## 1.14.2 (03/24/2021)
14
18
 
15
19
  * Fix `capture_exception` signature
16
20
 
17
- # 1.14.1 (02/28/2021)
21
+ ## 1.14.1 (02/28/2021)
18
22
 
19
23
  * Fix uninitialized constant ``UniformNotifier::SentryNotifier::Raven`` error
20
24
 
21
- # 1.14.0 (02/26/2021)
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}" }.join(' ')
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class UniformNotifier
4
- VERSION = '1.16.0'
4
+ VERSION = '1.17.0'
5
5
  end
@@ -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') }.to raise_error(
13
- UniformNotifier::Exception,
14
- 'notification'
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') }.to raise_error(klass, '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') }.not_to raise_error
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 = {} }.to raise_error(UniformNotifier::NotificationError)
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.16.0
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: 2022-03-24 00:00:00.000000000 Z
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.3.7
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