datadog-notifications 0.6.0 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/.travis.yml +3 -2
- data/Gemfile.lock +74 -62
- data/datadog-notifications.gemspec +11 -11
- data/lib/datadog/notifications/config.rb +6 -7
- data/lib/datadog/notifications/plugins/action_controller.rb +2 -4
- data/lib/datadog/notifications/plugins/active_job.rb +2 -4
- data/lib/datadog/notifications/plugins/active_record.rb +3 -4
- data/lib/datadog/notifications/plugins/base.rb +2 -3
- data/lib/datadog/notifications/plugins/grape.rb +7 -6
- data/lib/datadog/notifications/plugins/grpc.rb +2 -4
- data/lib/datadog/notifications/version.rb +1 -1
- data/spec/datadog/notifications/config_spec.rb +0 -2
- data/spec/datadog/notifications/plugins/active_record_spec.rb +0 -2
- data/spec/datadog/notifications/plugins/grape_spec.rb +0 -2
- data/spec/datadog/notifications_spec.rb +0 -2
- data/spec/spec_helper.rb +13 -13
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22dc145596f1b9ff7ce13aa1d288721b1b91b2b7de2a3ca79eefcc0d9608735b
|
4
|
+
data.tar.gz: 0470ffefc29242921d54223a46459f9324c55cc4d8ccf970deb7989dcc0576d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f4692ee83c9af8255074edf39e3957bc98bc0ff514d595f83a52e0c704488088b81c0f51e72c10a40c2ca66f59e9776b5d134fc79cb1f4e70cb7eb4079da2e2
|
7
|
+
data.tar.gz: 75624cd42572dd722293c4432f6b456b1a5ad42e977e5d98cf1932c804d9d95b1316779019ffedab6383fd2d8ee3930771715d22bd73cffad3201236ac7dc2e2
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,97 +1,109 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
datadog-notifications (0.6.
|
4
|
+
datadog-notifications (0.6.5)
|
5
5
|
activesupport
|
6
|
-
dogstatsd-ruby (
|
6
|
+
dogstatsd-ruby (>= 4.2, < 5.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
activerecord (
|
14
|
-
activemodel (=
|
15
|
-
activesupport (=
|
16
|
-
|
17
|
-
activesupport (5.2.2)
|
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)
|
18
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
18
|
i18n (>= 0.7, < 2)
|
20
19
|
minitest (~> 5.1)
|
21
20
|
tzinfo (~> 1.1)
|
22
|
-
|
21
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
23
22
|
ast (2.4.0)
|
24
|
-
|
25
|
-
|
26
|
-
ice_nine (~> 0.11.0)
|
27
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
28
|
-
builder (3.2.3)
|
29
|
-
coercible (1.0.0)
|
30
|
-
descendants_tracker (~> 0.0.1)
|
31
|
-
concurrent-ruby (1.1.4)
|
32
|
-
descendants_tracker (0.0.4)
|
33
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
23
|
+
builder (3.2.4)
|
24
|
+
concurrent-ruby (1.1.6)
|
34
25
|
diff-lcs (1.3)
|
35
|
-
dogstatsd-ruby (4.
|
36
|
-
|
37
|
-
|
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)
|
38
50
|
activesupport
|
39
51
|
builder
|
52
|
+
dry-types (>= 1.1)
|
40
53
|
mustermann-grape (~> 1.0.0)
|
41
54
|
rack (>= 1.3.0)
|
42
55
|
rack-accept
|
43
|
-
|
44
|
-
i18n (1.5.2)
|
56
|
+
i18n (1.8.3)
|
45
57
|
concurrent-ruby (~> 1.0)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
mustermann (1.0.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
parser (2.5.3.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)
|
63
|
+
parallel (1.19.1)
|
64
|
+
parser (2.7.1.3)
|
54
65
|
ast (~> 2.4.0)
|
55
|
-
|
56
|
-
rack (2.0.6)
|
66
|
+
rack (2.2.2)
|
57
67
|
rack-accept (0.4.5)
|
58
68
|
rack (>= 0.4)
|
59
69
|
rack-test (1.1.0)
|
60
70
|
rack (>= 1.0, < 3)
|
61
71
|
rainbow (3.0.0)
|
62
|
-
rake (
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
rspec-
|
67
|
-
|
68
|
-
rspec-
|
69
|
-
rspec-
|
72
|
+
rake (13.0.1)
|
73
|
+
regexp_parser (1.7.0)
|
74
|
+
rexml (3.2.4)
|
75
|
+
rspec (3.9.0)
|
76
|
+
rspec-core (~> 3.9.0)
|
77
|
+
rspec-expectations (~> 3.9.0)
|
78
|
+
rspec-mocks (~> 3.9.0)
|
79
|
+
rspec-core (3.9.2)
|
80
|
+
rspec-support (~> 3.9.3)
|
81
|
+
rspec-expectations (3.9.2)
|
70
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
-
rspec-support (~> 3.
|
72
|
-
rspec-mocks (3.
|
83
|
+
rspec-support (~> 3.9.0)
|
84
|
+
rspec-mocks (3.9.1)
|
73
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
-
rspec-support (~> 3.
|
75
|
-
rspec-support (3.
|
76
|
-
rubocop (0.
|
77
|
-
jaro_winkler (~> 1.5.1)
|
86
|
+
rspec-support (~> 3.9.0)
|
87
|
+
rspec-support (3.9.3)
|
88
|
+
rubocop (0.85.0)
|
78
89
|
parallel (~> 1.10)
|
79
|
-
parser (>= 2.
|
80
|
-
powerpack (~> 0.1)
|
90
|
+
parser (>= 2.7.0.1)
|
81
91
|
rainbow (>= 2.2.2, < 4.0)
|
92
|
+
regexp_parser (>= 1.7)
|
93
|
+
rexml
|
94
|
+
rubocop-ast (>= 0.0.3)
|
82
95
|
ruby-progressbar (~> 1.7)
|
83
|
-
unicode-display_width (
|
84
|
-
|
85
|
-
|
96
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
97
|
+
rubocop-ast (0.0.3)
|
98
|
+
parser (>= 2.7.0.1)
|
99
|
+
ruby-progressbar (1.10.1)
|
100
|
+
ruby2_keywords (0.0.2)
|
101
|
+
sqlite3 (1.4.2)
|
86
102
|
thread_safe (0.3.6)
|
87
|
-
tzinfo (1.2.
|
103
|
+
tzinfo (1.2.7)
|
88
104
|
thread_safe (~> 0.1)
|
89
|
-
unicode-display_width (1.
|
90
|
-
|
91
|
-
axiom-types (~> 0.1)
|
92
|
-
coercible (~> 1.0)
|
93
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
94
|
-
equalizer (~> 0.0, >= 0.0.9)
|
105
|
+
unicode-display_width (1.7.0)
|
106
|
+
zeitwerk (2.3.0)
|
95
107
|
|
96
108
|
PLATFORMS
|
97
109
|
ruby
|
@@ -108,4 +120,4 @@ DEPENDENCIES
|
|
108
120
|
sqlite3
|
109
121
|
|
110
122
|
BUNDLED WITH
|
111
|
-
1.
|
123
|
+
2.1.4
|
@@ -14,17 +14,17 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
15
|
s.test_files = s.files.grep(%r{^(spec)/})
|
16
16
|
s.require_paths = ['lib']
|
17
|
-
s.required_ruby_version = '>= 2.
|
17
|
+
s.required_ruby_version = '>= 2.5'
|
18
18
|
|
19
|
-
s.add_runtime_dependency
|
20
|
-
s.add_runtime_dependency
|
19
|
+
s.add_runtime_dependency 'activesupport'
|
20
|
+
s.add_runtime_dependency 'dogstatsd-ruby', '>= 4.2', '< 5.0'
|
21
21
|
|
22
|
-
s.add_development_dependency
|
23
|
-
s.add_development_dependency
|
24
|
-
s.add_development_dependency
|
25
|
-
s.add_development_dependency
|
26
|
-
s.add_development_dependency
|
27
|
-
s.add_development_dependency
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency
|
22
|
+
s.add_development_dependency 'activerecord'
|
23
|
+
s.add_development_dependency 'bundler'
|
24
|
+
s.add_development_dependency 'grape', '>= 1.0.2'
|
25
|
+
s.add_development_dependency 'rack-test'
|
26
|
+
s.add_development_dependency 'rake'
|
27
|
+
s.add_development_dependency 'rspec'
|
28
|
+
s.add_development_dependency 'rubocop'
|
29
|
+
s.add_development_dependency 'sqlite3'
|
30
30
|
end
|
@@ -5,8 +5,8 @@ module Datadog
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@hostname = ENV['INSTRUMENTATION_HOSTNAME'] || Socket.gethostname
|
8
|
-
@statsd_host = ENV['STATSD_HOST']
|
9
|
-
@statsd_port =
|
8
|
+
@statsd_host = ENV['STATSD_HOST']
|
9
|
+
@statsd_port = ENV['STATSD_PORT']
|
10
10
|
@socket_path = ENV['SOCKET_PATH']
|
11
11
|
@reporter = Datadog::Notifications::Reporter
|
12
12
|
@tags = []
|
@@ -14,22 +14,21 @@ 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
|
22
22
|
|
23
23
|
def connect!
|
24
24
|
env = ENV['RAILS_ENV'] || ENV['RACK_ENV']
|
25
|
-
tags.push("env:#{env}") if env && tags.none? {|t| t =~ /^env
|
25
|
+
tags.push("env:#{env}") if env && tags.none? {|t| t =~ /^env:/ }
|
26
26
|
|
27
27
|
enable_hostname = hostname && hostname != 'false'
|
28
|
-
tags.push("host:#{hostname}") if enable_hostname && tags.none? {|t| t =~ /^host
|
28
|
+
tags.push("host:#{hostname}") if enable_hostname && tags.none? {|t| t =~ /^host:/ }
|
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
|
-
|
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
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Datadog::Notifications::Plugins
|
2
2
|
class Grape < Base
|
3
|
+
DEFAULT_EXCEPTION_HANDLER = ->(e) { Grape.exception_status(e) }
|
3
4
|
|
4
5
|
def self.exception_status(err)
|
5
6
|
err.respond_to?(:status) ? err.status : 500
|
@@ -12,10 +13,11 @@ module Datadog::Notifications::Plugins
|
|
12
13
|
# *<tt>:metric_name</tt> - the metric name, defaults to "grape.request"
|
13
14
|
# *<tt>:exception_handler</tt> - a custom exception handler proc which accepts an exception object and returns a status
|
14
15
|
# *<tt>:tags</tt> - additional tags
|
15
|
-
def initialize(opts
|
16
|
+
def initialize(metric_name: 'grape.request', exception_handler: DEFAULT_EXCEPTION_HANDLER, **opts)
|
16
17
|
super
|
17
|
-
|
18
|
-
@
|
18
|
+
|
19
|
+
@metric_name = metric_name
|
20
|
+
@exception_handler = exception_handler
|
19
21
|
|
20
22
|
Datadog::Notifications.subscribe 'endpoint_run.grape' do |reporter, event|
|
21
23
|
record reporter, event
|
@@ -33,7 +35,7 @@ module Datadog::Notifications::Plugins
|
|
33
35
|
status = exception_handler.call(payload[:exception_object]) if payload[:exception_object]
|
34
36
|
|
35
37
|
path = extract_path(endpoint)
|
36
|
-
path.gsub!(%r{[^\w
|
38
|
+
path.gsub!(%r{[^\w/\-]+}, '_')
|
37
39
|
|
38
40
|
tags = self.tags + %W[method:#{method} status:#{status}]
|
39
41
|
tags.push "path:#{path}" if path
|
@@ -54,11 +56,10 @@ module Datadog::Notifications::Plugins
|
|
54
56
|
return endpoint.request.path unless route
|
55
57
|
|
56
58
|
path = endpoint.route.path.dup
|
57
|
-
path.sub!(/\(
|
59
|
+
path.sub!(/\(\.:format\)$/, '')
|
58
60
|
path.sub!(':version/', '') if endpoint.version
|
59
61
|
path.gsub!(/:(\w+)/) {|m| m[1..-1].upcase }
|
60
62
|
path
|
61
63
|
end
|
62
|
-
|
63
64
|
end
|
64
65
|
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,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
|
data/spec/spec_helper.rb
CHANGED
@@ -10,7 +10,7 @@ require 'sqlite3'
|
|
10
10
|
|
11
11
|
### Active-record test preparation
|
12
12
|
|
13
|
-
ActiveRecord::Base.configurations
|
13
|
+
ActiveRecord::Base.configurations = { 'test' => { 'adapter' => 'sqlite3', 'database' => ':memory:' } }
|
14
14
|
ActiveRecord::Base.establish_connection(:test)
|
15
15
|
ActiveRecord::Base.connection.create_table :posts do |t|
|
16
16
|
t.string :title
|
@@ -22,8 +22,8 @@ end
|
|
22
22
|
|
23
23
|
module Mock
|
24
24
|
class Reporter < Datadog::Notifications::Reporter
|
25
|
-
def timing(stat,
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: dogstatsd-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.2'
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
36
|
+
version: '5.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.2'
|
44
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '5.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: activerecord
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,14 +202,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
202
|
requirements:
|
197
203
|
- - ">="
|
198
204
|
- !ruby/object:Gem::Version
|
199
|
-
version: '2.
|
205
|
+
version: '2.5'
|
200
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
207
|
requirements:
|
202
208
|
- - ">="
|
203
209
|
- !ruby/object:Gem::Version
|
204
210
|
version: '0'
|
205
211
|
requirements: []
|
206
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.1.4
|
207
213
|
signing_key:
|
208
214
|
specification_version: 4
|
209
215
|
summary: Generic ActiveSupport::Notifications Datadog handler
|