datadog-notifications 0.6.2 → 0.6.3

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: 38a9e7c3163df4e1427b18ea7216e1b014d7bd3ba51a1aa0ff133de1990a6227
4
- data.tar.gz: 0e1f66f6fea54e0934dd85d3e0ac351070ebd7652c6e0577e55aee10b887c067
3
+ metadata.gz: c2373f5f441b07227d05a8b6835726b0ce9df3eaf7b3329019814ad2b389dc0f
4
+ data.tar.gz: 52973ed82c2720bc02da8c6337de4efa242ac91f5021dad4913cef1842203b45
5
5
  SHA512:
6
- metadata.gz: 5362759bfa74f7cc6878861099b77eca4e933221f1f7eec74bff99a40551a21ed1bc5366895d1896ff79cc048d3e3fe00001a6fea20587b7ef4483caf45b220b
7
- data.tar.gz: b58dc570f252838b4ad991345652218cd9026d3d78a70ef25d1dfca91577836267a054bbe56b42d45fb2ddb07c269ba10f369e28431fa899a6453db7abdfbe0d
6
+ metadata.gz: c0603c9150fbd6ec40ed62c0b4ea1261e81b869c803a34531bdca51f19df41379fb908d3c2ddfa3661e458e3ae34f9ba01305ce4e4d9dba3cfab972334a29284
7
+ data.tar.gz: 8c5902469f500ffe2dbe7c245fdbb530d97e7b4f3f50123aa91d0e80c9ebb56c68e93d91cee25b2cfdaad5bdf94a8fa2057e5dac6e8a3339ca207f89d5a919c6
@@ -1,95 +1,107 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datadog-notifications (0.6.2)
4
+ datadog-notifications (0.6.3)
5
5
  activesupport
6
6
  dogstatsd-ruby (>= 4.2, < 5.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.0.2.1)
12
- activesupport (= 6.0.2.1)
13
- activerecord (6.0.2.1)
14
- activemodel (= 6.0.2.1)
15
- activesupport (= 6.0.2.1)
16
- activesupport (6.0.2.1)
11
+ activemodel (6.0.3.1)
12
+ activesupport (= 6.0.3.1)
13
+ activerecord (6.0.3.1)
14
+ activemodel (= 6.0.3.1)
15
+ activesupport (= 6.0.3.1)
16
+ activesupport (6.0.3.1)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
20
20
  tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2)
21
+ zeitwerk (~> 2.2, >= 2.2.2)
22
22
  ast (2.4.0)
23
- axiom-types (0.1.1)
24
- descendants_tracker (~> 0.0.4)
25
- ice_nine (~> 0.11.0)
26
- thread_safe (~> 0.3, >= 0.3.1)
27
23
  builder (3.2.4)
28
- coercible (1.0.0)
29
- descendants_tracker (~> 0.0.1)
30
- concurrent-ruby (1.1.5)
31
- descendants_tracker (0.0.4)
32
- thread_safe (~> 0.3, >= 0.3.1)
24
+ concurrent-ruby (1.1.6)
33
25
  diff-lcs (1.3)
34
- dogstatsd-ruby (4.5.0)
35
- equalizer (0.0.11)
36
- grape (1.2.5)
26
+ dogstatsd-ruby (4.8.1)
27
+ dry-configurable (0.11.5)
28
+ concurrent-ruby (~> 1.0)
29
+ dry-core (~> 0.4, >= 0.4.7)
30
+ dry-equalizer (~> 0.2)
31
+ dry-container (0.7.2)
32
+ concurrent-ruby (~> 1.0)
33
+ dry-configurable (~> 0.1, >= 0.1.3)
34
+ dry-core (0.4.9)
35
+ concurrent-ruby (~> 1.0)
36
+ dry-equalizer (0.3.0)
37
+ dry-inflector (0.2.0)
38
+ dry-logic (1.0.6)
39
+ concurrent-ruby (~> 1.0)
40
+ dry-core (~> 0.2)
41
+ dry-equalizer (~> 0.2)
42
+ dry-types (1.4.0)
43
+ concurrent-ruby (~> 1.0)
44
+ dry-container (~> 0.3)
45
+ dry-core (~> 0.4, >= 0.4.4)
46
+ dry-equalizer (~> 0.3)
47
+ dry-inflector (~> 0.1, >= 0.1.2)
48
+ dry-logic (~> 1.0, >= 1.0.2)
49
+ grape (1.3.3)
37
50
  activesupport
38
51
  builder
52
+ dry-types (>= 1.1)
39
53
  mustermann-grape (~> 1.0.0)
40
54
  rack (>= 1.3.0)
41
55
  rack-accept
42
- virtus (>= 1.0.0)
43
- i18n (1.7.0)
56
+ i18n (1.8.2)
44
57
  concurrent-ruby (~> 1.0)
45
- ice_nine (0.11.2)
46
- jaro_winkler (1.5.4)
47
- minitest (5.13.0)
48
- mustermann (1.0.3)
49
- mustermann-grape (1.0.0)
50
- mustermann (~> 1.0.0)
58
+ minitest (5.14.1)
59
+ mustermann (1.1.1)
60
+ ruby2_keywords (~> 0.0.1)
61
+ mustermann-grape (1.0.1)
62
+ mustermann (>= 1.0.0)
51
63
  parallel (1.19.1)
52
- parser (2.7.0.1)
64
+ parser (2.7.1.3)
53
65
  ast (~> 2.4.0)
54
- rack (2.0.8)
66
+ rack (2.2.2)
55
67
  rack-accept (0.4.5)
56
68
  rack (>= 0.4)
57
69
  rack-test (1.1.0)
58
70
  rack (>= 1.0, < 3)
59
71
  rainbow (3.0.0)
60
72
  rake (13.0.1)
73
+ rexml (3.2.4)
61
74
  rspec (3.9.0)
62
75
  rspec-core (~> 3.9.0)
63
76
  rspec-expectations (~> 3.9.0)
64
77
  rspec-mocks (~> 3.9.0)
65
- rspec-core (3.9.1)
66
- rspec-support (~> 3.9.1)
67
- rspec-expectations (3.9.0)
78
+ rspec-core (3.9.2)
79
+ rspec-support (~> 3.9.3)
80
+ rspec-expectations (3.9.2)
68
81
  diff-lcs (>= 1.2.0, < 2.0)
69
82
  rspec-support (~> 3.9.0)
70
83
  rspec-mocks (3.9.1)
71
84
  diff-lcs (>= 1.2.0, < 2.0)
72
85
  rspec-support (~> 3.9.0)
73
- rspec-support (3.9.2)
74
- rubocop (0.78.0)
75
- jaro_winkler (~> 1.5.1)
86
+ rspec-support (3.9.3)
87
+ rubocop (0.84.0)
76
88
  parallel (~> 1.10)
77
- parser (>= 2.6)
89
+ parser (>= 2.7.0.1)
78
90
  rainbow (>= 2.2.2, < 4.0)
91
+ rexml
92
+ rubocop-ast (>= 0.0.3)
79
93
  ruby-progressbar (~> 1.7)
80
- unicode-display_width (>= 1.4.0, < 1.7)
94
+ unicode-display_width (>= 1.4.0, < 2.0)
95
+ rubocop-ast (0.0.3)
96
+ parser (>= 2.7.0.1)
81
97
  ruby-progressbar (1.10.1)
98
+ ruby2_keywords (0.0.2)
82
99
  sqlite3 (1.4.2)
83
100
  thread_safe (0.3.6)
84
- tzinfo (1.2.6)
101
+ tzinfo (1.2.7)
85
102
  thread_safe (~> 0.1)
86
- unicode-display_width (1.6.0)
87
- virtus (1.0.5)
88
- axiom-types (~> 0.1)
89
- coercible (~> 1.0)
90
- descendants_tracker (~> 0.0, >= 0.0.3)
91
- equalizer (~> 0.0, >= 0.0.9)
92
- zeitwerk (2.2.2)
103
+ unicode-display_width (1.7.0)
104
+ zeitwerk (2.3.0)
93
105
 
94
106
  PLATFORMS
95
107
  ruby
@@ -14,8 +14,8 @@ module Datadog
14
14
  end
15
15
 
16
16
  # Use a plugin
17
- def use(klass, opts={})
18
- @plugins.push klass.new(opts)
17
+ def use(klass, **opts)
18
+ @plugins.push klass.new(**opts)
19
19
  end
20
20
 
21
21
  protected
@@ -29,7 +29,6 @@ module Datadog
29
29
 
30
30
  reporter.new statsd_host, statsd_port, namespace: namespace, tags: tags, socket_path: socket_path
31
31
  end
32
-
33
32
  end
34
33
  end
35
34
  end
@@ -1,16 +1,15 @@
1
1
  module Datadog::Notifications::Plugins
2
2
  class ActionController < Base
3
-
4
3
  attr_reader :metric_name
5
4
 
6
5
  # Options:
7
6
  #
8
7
  # *<tt>:metric_name</tt> - the metric name, defaults to "rails.request"
9
8
  # *<tt>:tags</tt> - additional tags
10
- def initialize(opts={})
9
+ def initialize(metric_name: 'rails.request', **opts)
11
10
  super
12
- @metric_name = opts[:metric_name] || 'rails.request'
13
11
 
12
+ @metric_name = metric_name
14
13
  Datadog::Notifications.subscribe 'process_action.action_controller' do |reporter, event|
15
14
  record reporter, event
16
15
  end
@@ -34,6 +33,5 @@ module Datadog::Notifications::Plugins
34
33
  reporter.timing "#{metric_name}.time.view", payload[:view_runtime], tags: tags
35
34
  end
36
35
  end
37
-
38
36
  end
39
37
  end
@@ -1,16 +1,15 @@
1
1
  module Datadog::Notifications::Plugins
2
2
  class ActiveJob < Base
3
-
4
3
  attr_reader :metric_name
5
4
 
6
5
  # Options:
7
6
  #
8
7
  # *<tt>:metric_name</tt> - the metric name, defaults to "activejob.perform"
9
8
  # *<tt>:tags</tt> - additional tags
10
- def initialize(opts={})
9
+ def initialize(metric_name: 'activejob.perform', **opts)
11
10
  super
12
- @metric_name = opts[:metric_name] || 'activejob.perform'
13
11
 
12
+ @metric_name = metric_name
14
13
  Datadog::Notifications.subscribe 'perform.active_job' do |reporter, event|
15
14
  record reporter, event
16
15
  end
@@ -28,6 +27,5 @@ module Datadog::Notifications::Plugins
28
27
  reporter.timing "#{metric_name}.time", event.duration, tags: tags
29
28
  end
30
29
  end
31
-
32
30
  end
33
31
  end
@@ -1,6 +1,5 @@
1
1
  module Datadog::Notifications::Plugins
2
2
  class ActiveRecord < Base
3
-
4
3
  attr_reader :metric_name
5
4
 
6
5
  # Options:
@@ -9,9 +8,10 @@ module Datadog::Notifications::Plugins
9
8
  # *<tt>:include_schema</tt> - record schema queries, off by default
10
9
  # *<tt>:include_generic</tt> - record general (nameless) queries, off by default
11
10
  # *<tt>:tags</tt> - additional tags
12
- def initialize(opts={})
11
+ def initialize(metric_name: 'activerecord.sql', **opts)
13
12
  super
14
- @metric_name = opts[:metric_name] || 'activerecord.sql'
13
+
14
+ @metric_name = metric_name
15
15
  @include_schema = opts[:include_schema] == true
16
16
  @include_generic = opts[:include_generic] == true
17
17
  @include_raw = opts[:include_raw] == true
@@ -38,6 +38,5 @@ module Datadog::Notifications::Plugins
38
38
  reporter.timing "#{metric_name}.time", event.duration, tags: tags
39
39
  end
40
40
  end
41
-
42
41
  end
43
42
  end
@@ -5,9 +5,8 @@ module Datadog::Notifications::Plugins
5
5
  # Options:
6
6
  #
7
7
  # *<tt>:tags</tt> - additional tags
8
- def initialize(opts={})
9
- @tags = opts[:tags] || []
8
+ def initialize(tags: [], **_opts)
9
+ @tags = tags
10
10
  end
11
-
12
11
  end
13
12
  end
@@ -1,6 +1,5 @@
1
1
  module Datadog::Notifications::Plugins
2
2
  class Grape < Base
3
-
4
3
  def self.exception_status(err)
5
4
  err.respond_to?(:status) ? err.status : 500
6
5
  end
@@ -12,10 +11,11 @@ module Datadog::Notifications::Plugins
12
11
  # *<tt>:metric_name</tt> - the metric name, defaults to "grape.request"
13
12
  # *<tt>:exception_handler</tt> - a custom exception handler proc which accepts an exception object and returns a status
14
13
  # *<tt>:tags</tt> - additional tags
15
- def initialize(opts={})
14
+ def initialize(metric_name: 'grape.request', exception_handler:, **opts)
16
15
  super
17
- @metric_name = opts[:metric_name] || 'grape.request'
18
- @exception_handler = opts[:exception_handler] || ->(e) { self.class.exception_status(e) }
16
+
17
+ @metric_name = metric_name
18
+ @exception_handler = exception_handler || ->(e) { self.class.exception_status(e) }
19
19
 
20
20
  Datadog::Notifications.subscribe 'endpoint_run.grape' do |reporter, event|
21
21
  record reporter, event
@@ -59,6 +59,5 @@ module Datadog::Notifications::Plugins
59
59
  path.gsub!(/:(\w+)/) {|m| m[1..-1].upcase }
60
60
  path
61
61
  end
62
-
63
62
  end
64
63
  end
@@ -1,6 +1,5 @@
1
1
  module Datadog::Notifications::Plugins
2
2
  class GRPC < Base
3
-
4
3
  # Options:
5
4
  #
6
5
  # *<tt>:metric_name</tt> - the metric name, defaults to 'grpc.request'
@@ -10,10 +9,10 @@ module Datadog::Notifications::Plugins
10
9
  # Notification payload should have :service (service name, string) and :action (service action/method name, string) keys.
11
10
  #
12
11
  # Compatible instrumentation is implemented in grpcx gem: https://github.com/bsm/grpcx (>= 0.2.0)
13
- def initialize(opts={})
12
+ def initialize(metric_name: 'grpc.request', **opts)
14
13
  super
15
- @metric_name = opts[:metric_name] || 'grpc.request'
16
14
 
15
+ @metric_name = metric_name
17
16
  Datadog::Notifications.subscribe 'process_action.grpc' do |reporter, event|
18
17
  record reporter, event
19
18
  end
@@ -34,6 +33,5 @@ module Datadog::Notifications::Plugins
34
33
  reporter.timing "#{@metric_name}.time", event.duration, tags: tags
35
34
  end
36
35
  end
37
-
38
36
  end
39
37
  end
@@ -1,5 +1,5 @@
1
1
  module Datadog
2
2
  class Notifications
3
- VERSION = '0.6.2'.freeze
3
+ VERSION = '0.6.3'.freeze
4
4
  end
5
5
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Datadog::Notifications::Config do
4
-
5
4
  it 'should be connect!' do
6
5
  subject.reporter = Mock::Reporter
7
6
  subject.hostname = 'test.host'
@@ -32,5 +31,4 @@ describe Datadog::Notifications::Config do
32
31
  expect(subject.plugins.size).to eq(1)
33
32
  expect(subject.plugins.first).to be_instance_of(Datadog::Notifications::Plugins::ActionController)
34
33
  end
35
-
36
34
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Datadog::Notifications::Plugins::ActiveRecord do
4
-
5
4
  it 'should send an increment and timing event for each query' do
6
5
  Post.all.to_a
7
6
  expect(buffered).to eq [
@@ -17,5 +16,4 @@ describe Datadog::Notifications::Plugins::ActiveRecord do
17
16
  'activerecord.sql.time:333|ms|#custom:tag,env:test,host:test.host,query:post.load',
18
17
  ]
19
18
  end
20
-
21
19
  end
@@ -14,7 +14,6 @@ describe Datadog::Notifications::Plugins::Grape do
14
14
  end
15
15
 
16
16
  Class.new(Grape::API) do
17
-
18
17
  rescue_from unauthorized do |_e|
19
18
  error!({ message: 'unauthorized', error: '401 Unauthorized' }, 401)
20
19
  end
@@ -96,5 +95,4 @@ describe Datadog::Notifications::Plugins::Grape do
96
95
 
97
96
  expect(buffered).to eq([])
98
97
  end
99
-
100
98
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Datadog::Notifications do
4
-
5
4
  subject { described_class.instance }
6
5
  after { ActiveSupport::Notifications.unsubscribe(subscription) }
7
6
 
@@ -29,5 +28,4 @@ describe Datadog::Notifications do
29
28
  'web.render.time:333|ms|#custom:tag,env:test,host:test.host,status:200,method:GET',
30
29
  ])
31
30
  end
32
-
33
31
  end
@@ -22,8 +22,8 @@ end
22
22
 
23
23
  module Mock
24
24
  class Reporter < Datadog::Notifications::Reporter
25
- def timing(stat, _millis, opts={})
26
- super(stat, 333, opts)
25
+ def timing(stat, _millis, **opts)
26
+ super(stat, 333, **opts)
27
27
  end
28
28
 
29
29
  def send_stat(message)
@@ -36,7 +36,7 @@ module Mock
36
36
  end
37
37
 
38
38
  class Instrumentable
39
- def initialize(opts={})
39
+ def initialize(**opts)
40
40
  @opts = opts
41
41
  end
42
42
 
@@ -71,13 +71,13 @@ Datadog::Notifications.configure do |c|
71
71
 
72
72
  c.use Datadog::Notifications::Plugins::ActiveRecord
73
73
  c.use Datadog::Notifications::Plugins::Grape,
74
- tags: ['more:tags'],
75
- metric_name: 'api.request',
76
- exception_handler: lambda {|e|
77
- if e.message.include?('unauthorized')
78
- 401
79
- else
80
- Datadog::Notifications::Plugins::Grape.exception_status(e)
81
- end
82
- }
74
+ tags: ['more:tags'],
75
+ metric_name: 'api.request',
76
+ exception_handler: lambda {|e|
77
+ if e.message.include?('unauthorized')
78
+ 401
79
+ else
80
+ Datadog::Notifications::Plugins::Grape.exception_status(e)
81
+ end
82
+ }
83
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-notifications
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2020-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -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.0.6
212
+ rubygems_version: 3.1.2
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Generic ActiveSupport::Notifications Datadog handler