datadog-notifications 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +21 -0
- data/.rubocop.yml +7 -3
- data/Gemfile.lock +75 -62
- data/datadog-notifications.gemspec +3 -3
- data/lib/datadog/notifications/plugins/grape.rb +5 -5
- data/lib/datadog/notifications/version.rb +1 -1
- data/spec/datadog/notifications/config_spec.rb +3 -3
- data/spec/datadog/notifications/plugins/active_record_spec.rb +2 -2
- data/spec/datadog/notifications/plugins/grape_spec.rb +6 -6
- data/spec/datadog/notifications_spec.rb +3 -2
- metadata +7 -8
- data/.rake_tasks~ +0 -9
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299177adeebc9ed3fd6984f9725fb88ae46ab24b1582548976e8d4aa1a48f55a
|
4
|
+
data.tar.gz: bdea7f81d306dbb4f45d77b1870475596a3b9e04ef4675ca7ef117c03066be9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c7a6359a6b6abc80be605d04dd8934d7460de1a16ec1f2c7d6018c7f37c5b036658b8fa022f459117ea2367157cdc1e601c6482b72ff5ecf85e6965835e4d4e
|
7
|
+
data.tar.gz: f72472a2cfee96d1cb79f6ceddccdc8103ba8dffdd86465866dc17236ac95b59822558bad85cb40e848f4372a2ef588ba1bcd2fc7e3834a8e0415a2f23f0cbc7
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [main]
|
6
|
+
pull_request:
|
7
|
+
branches: [main]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ["2.6", "2.7", "3.0"]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true
|
21
|
+
- run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
|
2
|
-
-
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-bsm:
|
3
|
+
- default.yml
|
4
|
+
inherit_mode:
|
5
|
+
merge:
|
6
|
+
- Exclude
|
3
7
|
|
4
8
|
AllCops:
|
5
|
-
TargetRubyVersion: "2.
|
9
|
+
TargetRubyVersion: "2.6"
|
6
10
|
|
7
11
|
Naming/FileName:
|
8
12
|
Exclude:
|
data/Gemfile.lock
CHANGED
@@ -1,109 +1,122 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
datadog-notifications (0.6.
|
4
|
+
datadog-notifications (0.6.6)
|
5
5
|
activesupport
|
6
|
-
dogstatsd-ruby (>= 4.
|
6
|
+
dogstatsd-ruby (>= 4.8, < 5.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (6.
|
12
|
-
activesupport (= 6.
|
13
|
-
activerecord (6.
|
14
|
-
activemodel (= 6.
|
15
|
-
activesupport (= 6.
|
16
|
-
activesupport (6.
|
11
|
+
activemodel (6.1.3)
|
12
|
+
activesupport (= 6.1.3)
|
13
|
+
activerecord (6.1.3)
|
14
|
+
activemodel (= 6.1.3)
|
15
|
+
activesupport (= 6.1.3)
|
16
|
+
activesupport (6.1.3)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>=
|
19
|
-
minitest (
|
20
|
-
tzinfo (~>
|
21
|
-
zeitwerk (~> 2.
|
22
|
-
ast (2.4.
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
tzinfo (~> 2.0)
|
21
|
+
zeitwerk (~> 2.3)
|
22
|
+
ast (2.4.2)
|
23
23
|
builder (3.2.4)
|
24
|
-
concurrent-ruby (1.1.
|
25
|
-
diff-lcs (1.
|
26
|
-
dogstatsd-ruby (4.8.
|
27
|
-
dry-configurable (0.
|
24
|
+
concurrent-ruby (1.1.8)
|
25
|
+
diff-lcs (1.4.4)
|
26
|
+
dogstatsd-ruby (4.8.3)
|
27
|
+
dry-configurable (0.12.1)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
dry-core (~> 0.
|
30
|
-
dry-equalizer (~> 0.2)
|
29
|
+
dry-core (~> 0.5, >= 0.5.0)
|
31
30
|
dry-container (0.7.2)
|
32
31
|
concurrent-ruby (~> 1.0)
|
33
32
|
dry-configurable (~> 0.1, >= 0.1.3)
|
34
|
-
dry-core (0.
|
33
|
+
dry-core (0.5.0)
|
35
34
|
concurrent-ruby (~> 1.0)
|
36
|
-
dry-equalizer (0.3.0)
|
37
35
|
dry-inflector (0.2.0)
|
38
|
-
dry-logic (1.0
|
36
|
+
dry-logic (1.1.0)
|
39
37
|
concurrent-ruby (~> 1.0)
|
40
|
-
dry-core (~> 0.
|
41
|
-
|
42
|
-
dry-types (1.4.0)
|
38
|
+
dry-core (~> 0.5, >= 0.5)
|
39
|
+
dry-types (1.5.1)
|
43
40
|
concurrent-ruby (~> 1.0)
|
44
41
|
dry-container (~> 0.3)
|
45
|
-
dry-core (~> 0.
|
46
|
-
dry-equalizer (~> 0.3)
|
42
|
+
dry-core (~> 0.5, >= 0.5)
|
47
43
|
dry-inflector (~> 0.1, >= 0.1.2)
|
48
44
|
dry-logic (~> 1.0, >= 1.0.2)
|
49
|
-
grape (1.
|
45
|
+
grape (1.5.2)
|
50
46
|
activesupport
|
51
47
|
builder
|
52
48
|
dry-types (>= 1.1)
|
53
49
|
mustermann-grape (~> 1.0.0)
|
54
50
|
rack (>= 1.3.0)
|
55
51
|
rack-accept
|
56
|
-
i18n (1.8.
|
52
|
+
i18n (1.8.9)
|
57
53
|
concurrent-ruby (~> 1.0)
|
58
|
-
minitest (5.14.
|
54
|
+
minitest (5.14.4)
|
59
55
|
mustermann (1.1.1)
|
60
56
|
ruby2_keywords (~> 0.0.1)
|
61
57
|
mustermann-grape (1.0.1)
|
62
58
|
mustermann (>= 1.0.0)
|
63
|
-
parallel (1.
|
64
|
-
parser (
|
65
|
-
ast (~> 2.4.
|
66
|
-
rack (2.2.
|
59
|
+
parallel (1.20.1)
|
60
|
+
parser (3.0.0.0)
|
61
|
+
ast (~> 2.4.1)
|
62
|
+
rack (2.2.3)
|
67
63
|
rack-accept (0.4.5)
|
68
64
|
rack (>= 0.4)
|
69
65
|
rack-test (1.1.0)
|
70
66
|
rack (>= 1.0, < 3)
|
71
67
|
rainbow (3.0.0)
|
72
|
-
rake (13.0.
|
73
|
-
regexp_parser (1.
|
68
|
+
rake (13.0.3)
|
69
|
+
regexp_parser (2.1.1)
|
74
70
|
rexml (3.2.4)
|
75
|
-
rspec (3.
|
76
|
-
rspec-core (~> 3.
|
77
|
-
rspec-expectations (~> 3.
|
78
|
-
rspec-mocks (~> 3.
|
79
|
-
rspec-core (3.
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-expectations (3.
|
71
|
+
rspec (3.10.0)
|
72
|
+
rspec-core (~> 3.10.0)
|
73
|
+
rspec-expectations (~> 3.10.0)
|
74
|
+
rspec-mocks (~> 3.10.0)
|
75
|
+
rspec-core (3.10.1)
|
76
|
+
rspec-support (~> 3.10.0)
|
77
|
+
rspec-expectations (3.10.1)
|
82
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-mocks (3.
|
79
|
+
rspec-support (~> 3.10.0)
|
80
|
+
rspec-mocks (3.10.2)
|
85
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
88
|
-
rubocop (
|
82
|
+
rspec-support (~> 3.10.0)
|
83
|
+
rspec-support (3.10.2)
|
84
|
+
rubocop (1.11.0)
|
89
85
|
parallel (~> 1.10)
|
90
|
-
parser (>=
|
86
|
+
parser (>= 3.0.0.0)
|
91
87
|
rainbow (>= 2.2.2, < 4.0)
|
92
|
-
regexp_parser (>= 1.
|
88
|
+
regexp_parser (>= 1.8, < 3.0)
|
93
89
|
rexml
|
94
|
-
rubocop-ast (>= 0.0
|
90
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
95
91
|
ruby-progressbar (~> 1.7)
|
96
|
-
unicode-display_width (>= 1.4.0, <
|
97
|
-
rubocop-ast (
|
98
|
-
parser (>= 2.7.
|
99
|
-
|
100
|
-
|
92
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
93
|
+
rubocop-ast (1.4.1)
|
94
|
+
parser (>= 2.7.1.5)
|
95
|
+
rubocop-bsm (0.5.4)
|
96
|
+
rubocop (~> 1.0)
|
97
|
+
rubocop-performance
|
98
|
+
rubocop-rails
|
99
|
+
rubocop-rake
|
100
|
+
rubocop-rspec
|
101
|
+
rubocop-performance (1.10.1)
|
102
|
+
rubocop (>= 0.90.0, < 2.0)
|
103
|
+
rubocop-ast (>= 0.4.0)
|
104
|
+
rubocop-rails (2.9.1)
|
105
|
+
activesupport (>= 4.2.0)
|
106
|
+
rack (>= 1.1)
|
107
|
+
rubocop (>= 0.90.0, < 2.0)
|
108
|
+
rubocop-rake (0.5.1)
|
109
|
+
rubocop
|
110
|
+
rubocop-rspec (2.2.0)
|
111
|
+
rubocop (~> 1.0)
|
112
|
+
rubocop-ast (>= 1.1.0)
|
113
|
+
ruby-progressbar (1.11.0)
|
114
|
+
ruby2_keywords (0.0.4)
|
101
115
|
sqlite3 (1.4.2)
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
zeitwerk (2.3.0)
|
116
|
+
tzinfo (2.0.4)
|
117
|
+
concurrent-ruby (~> 1.0)
|
118
|
+
unicode-display_width (2.0.0)
|
119
|
+
zeitwerk (2.4.2)
|
107
120
|
|
108
121
|
PLATFORMS
|
109
122
|
ruby
|
@@ -116,7 +129,7 @@ DEPENDENCIES
|
|
116
129
|
rack-test
|
117
130
|
rake
|
118
131
|
rspec
|
119
|
-
rubocop
|
132
|
+
rubocop-bsm
|
120
133
|
sqlite3
|
121
134
|
|
122
135
|
BUNDLED WITH
|
@@ -14,10 +14,10 @@ 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.6'
|
18
18
|
|
19
19
|
s.add_runtime_dependency 'activesupport'
|
20
|
-
s.add_runtime_dependency 'dogstatsd-ruby', '>= 4.
|
20
|
+
s.add_runtime_dependency 'dogstatsd-ruby', '>= 4.8', '< 5.0'
|
21
21
|
|
22
22
|
s.add_development_dependency 'activerecord'
|
23
23
|
s.add_development_dependency 'bundler'
|
@@ -25,6 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency 'rack-test'
|
26
26
|
s.add_development_dependency 'rake'
|
27
27
|
s.add_development_dependency 'rspec'
|
28
|
-
s.add_development_dependency 'rubocop'
|
28
|
+
s.add_development_dependency 'rubocop-bsm'
|
29
29
|
s.add_development_dependency 'sqlite3'
|
30
30
|
end
|
@@ -49,16 +49,16 @@ module Datadog::Notifications::Plugins
|
|
49
49
|
|
50
50
|
def extract_path(endpoint)
|
51
51
|
route = begin
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
endpoint.route
|
53
|
+
rescue NoMethodError
|
54
|
+
nil
|
55
|
+
end
|
56
56
|
return endpoint.request.path unless route
|
57
57
|
|
58
58
|
path = endpoint.route.path.dup
|
59
59
|
path.sub!(/\(\.:format\)$/, '')
|
60
60
|
path.sub!(':version/', '') if endpoint.version
|
61
|
-
path.gsub!(/:(\w+)/) {|m| m[1
|
61
|
+
path.gsub!(/:(\w+)/) {|m| m[1..].upcase }
|
62
62
|
path
|
63
63
|
end
|
64
64
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Datadog::Notifications::Config do
|
4
|
-
it '
|
4
|
+
it 'is connect!' do
|
5
5
|
subject.reporter = Mock::Reporter
|
6
6
|
subject.hostname = 'test.host'
|
7
7
|
subject.tags = ['custom:tag']
|
@@ -12,7 +12,7 @@ describe Datadog::Notifications::Config do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
RSpec.shared_examples 'host tag is not picked up' do |hostname|
|
15
|
-
it '
|
15
|
+
it 'does not pick up the host tag' do
|
16
16
|
subject.reporter = Mock::Reporter
|
17
17
|
subject.hostname = hostname
|
18
18
|
subject.tags = ['custom:tag']
|
@@ -26,7 +26,7 @@ describe Datadog::Notifications::Config do
|
|
26
26
|
include_examples 'host tag is not picked up', false
|
27
27
|
include_examples 'host tag is not picked up', 'false'
|
28
28
|
|
29
|
-
it '
|
29
|
+
it 'instantiates plugins on use' do
|
30
30
|
subject.use Datadog::Notifications::Plugins::ActionController
|
31
31
|
expect(subject.plugins.size).to eq(1)
|
32
32
|
expect(subject.plugins.first).to be_instance_of(Datadog::Notifications::Plugins::ActionController)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Datadog::Notifications::Plugins::ActiveRecord do
|
4
|
-
it '
|
4
|
+
it 'sends an increment and timing event for each query' do
|
5
5
|
Post.all.to_a
|
6
6
|
expect(buffered).to eq [
|
7
7
|
'activerecord.sql:1|c|#custom:tag,env:test,host:test.host,query:post.load',
|
@@ -9,7 +9,7 @@ describe Datadog::Notifications::Plugins::ActiveRecord do
|
|
9
9
|
]
|
10
10
|
end
|
11
11
|
|
12
|
-
it '
|
12
|
+
it 'supports custom queries' do
|
13
13
|
Post.find_by_sql('SELECT * FROM posts LIMIT 1').to_a
|
14
14
|
expect(buffered).to eq [
|
15
15
|
'activerecord.sql:1|c|#custom:tag,env:test,host:test.host,query:post.load',
|
@@ -36,7 +36,7 @@ describe Datadog::Notifications::Plugins::Grape do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
it '
|
39
|
+
it 'sends an increment and timing event for each request' do
|
40
40
|
get '/echo/1/1234'
|
41
41
|
expect(last_response.status).to eq(200)
|
42
42
|
expect(last_response.body).to eq('1 1234')
|
@@ -47,7 +47,7 @@ describe Datadog::Notifications::Plugins::Grape do
|
|
47
47
|
])
|
48
48
|
end
|
49
49
|
|
50
|
-
it '
|
50
|
+
it 'supports namespaces and versioning' do
|
51
51
|
get '/api/v1/sub/versioned.txt'
|
52
52
|
expect(last_response.status).to eq(200)
|
53
53
|
expect(last_response.body).to eq('OK')
|
@@ -58,7 +58,7 @@ describe Datadog::Notifications::Plugins::Grape do
|
|
58
58
|
])
|
59
59
|
end
|
60
60
|
|
61
|
-
it '
|
61
|
+
it 'supports deep nesting' do
|
62
62
|
get '/sub/secure/resource'
|
63
63
|
expect(last_response.status).to eq(403)
|
64
64
|
expect(last_response.body).to eq('forbidden')
|
@@ -69,7 +69,7 @@ describe Datadog::Notifications::Plugins::Grape do
|
|
69
69
|
])
|
70
70
|
end
|
71
71
|
|
72
|
-
it '
|
72
|
+
it 'handles rescued errors' do
|
73
73
|
get '/rescued'
|
74
74
|
expect(last_response.status).to eq(401)
|
75
75
|
|
@@ -79,7 +79,7 @@ describe Datadog::Notifications::Plugins::Grape do
|
|
79
79
|
])
|
80
80
|
end
|
81
81
|
|
82
|
-
it '
|
82
|
+
it 'handles invalid method' do
|
83
83
|
post '/rescued'
|
84
84
|
|
85
85
|
expect(last_response.status).to eq(405)
|
@@ -89,7 +89,7 @@ describe Datadog::Notifications::Plugins::Grape do
|
|
89
89
|
])
|
90
90
|
end
|
91
91
|
|
92
|
-
it '
|
92
|
+
it 'does not report paths on 404s' do
|
93
93
|
get '/sub/missing'
|
94
94
|
expect(last_response.status).to eq(404)
|
95
95
|
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Datadog::Notifications do
|
4
4
|
subject { described_class.instance }
|
5
|
+
|
5
6
|
after { ActiveSupport::Notifications.unsubscribe(subscription) }
|
6
7
|
|
7
8
|
let!(:subscription) do
|
@@ -17,11 +18,11 @@ describe Datadog::Notifications do
|
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
it '
|
21
|
+
it 'has a reporter' do
|
21
22
|
expect(subject.send(:reporter)).to be_instance_of(Mock::Reporter)
|
22
23
|
end
|
23
24
|
|
24
|
-
it '
|
25
|
+
it 'subscribes and report' do
|
25
26
|
Mock::Instrumentable.new(method: 'GET').perform
|
26
27
|
expect(buffered).to eq([
|
27
28
|
'web.render:1|c|#custom:tag,env:test,host:test.host,status:200,method:GET',
|
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.6
|
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: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4.
|
33
|
+
version: '4.8'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '5.0'
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '4.
|
43
|
+
version: '4.8'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '5.0'
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name: rubocop
|
132
|
+
name: rubocop-bsm
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - ">="
|
@@ -164,10 +164,9 @@ extensions: []
|
|
164
164
|
extra_rdoc_files: []
|
165
165
|
files:
|
166
166
|
- ".editorconfig"
|
167
|
+
- ".github/workflows/ruby.yml"
|
167
168
|
- ".gitignore"
|
168
|
-
- ".rake_tasks~"
|
169
169
|
- ".rubocop.yml"
|
170
|
-
- ".travis.yml"
|
171
170
|
- Gemfile
|
172
171
|
- Gemfile.lock
|
173
172
|
- MIT-LICENCE
|
@@ -202,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
201
|
requirements:
|
203
202
|
- - ">="
|
204
203
|
- !ruby/object:Gem::Version
|
205
|
-
version: '2.
|
204
|
+
version: '2.6'
|
206
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
206
|
requirements:
|
208
207
|
- - ">="
|
data/.rake_tasks~
DELETED