datadog-notifications 0.6.6 → 0.6.7
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/Gemfile.lock +9 -3
- data/datadog-notifications.gemspec +1 -0
- data/lib/datadog/notifications/plugins/active_job.rb +4 -3
- data/lib/datadog/notifications/version.rb +1 -1
- data/spec/datadog/notifications/plugins/active_job_spec.rb +11 -0
- data/spec/spec_helper.rb +10 -0
- metadata +19 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fe55c10d1c135748c2a818187431d0f316a8cf0192cefdf7ab45d6245e6add9
|
|
4
|
+
data.tar.gz: f9449725f5768bb0e75eb02363f12eda4235e474d7fb00e6f7cc4c2b54c599d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e649e3040acec1a88eb92075b555ed4ba7c2c7533544ba2c4da01d41627dcd570bede8315c1759018351803eca2b9f00e84b95533ebb5d6412f7ada6705dac3d
|
|
7
|
+
data.tar.gz: 1077d3018207521015a4f4c5025c032b84405377d43a789a27b1153154eafac83e955abc75a5d4cb558073242caed193e3a018ae8251058ce88379a5c7e078ec
|
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
datadog-notifications (0.6.
|
|
4
|
+
datadog-notifications (0.6.7)
|
|
5
5
|
activesupport
|
|
6
6
|
dogstatsd-ruby (>= 4.8, < 5.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
+
activejob (6.1.3)
|
|
12
|
+
activesupport (= 6.1.3)
|
|
13
|
+
globalid (>= 0.3.6)
|
|
11
14
|
activemodel (6.1.3)
|
|
12
15
|
activesupport (= 6.1.3)
|
|
13
16
|
activerecord (6.1.3)
|
|
@@ -42,6 +45,8 @@ GEM
|
|
|
42
45
|
dry-core (~> 0.5, >= 0.5)
|
|
43
46
|
dry-inflector (~> 0.1, >= 0.1.2)
|
|
44
47
|
dry-logic (~> 1.0, >= 1.0.2)
|
|
48
|
+
globalid (0.4.2)
|
|
49
|
+
activesupport (>= 4.2.0)
|
|
45
50
|
grape (1.5.2)
|
|
46
51
|
activesupport
|
|
47
52
|
builder
|
|
@@ -67,7 +72,7 @@ GEM
|
|
|
67
72
|
rainbow (3.0.0)
|
|
68
73
|
rake (13.0.3)
|
|
69
74
|
regexp_parser (2.1.1)
|
|
70
|
-
rexml (3.2.
|
|
75
|
+
rexml (3.2.5)
|
|
71
76
|
rspec (3.10.0)
|
|
72
77
|
rspec-core (~> 3.10.0)
|
|
73
78
|
rspec-expectations (~> 3.10.0)
|
|
@@ -122,6 +127,7 @@ PLATFORMS
|
|
|
122
127
|
ruby
|
|
123
128
|
|
|
124
129
|
DEPENDENCIES
|
|
130
|
+
activejob
|
|
125
131
|
activerecord
|
|
126
132
|
bundler
|
|
127
133
|
datadog-notifications!
|
|
@@ -133,4 +139,4 @@ DEPENDENCIES
|
|
|
133
139
|
sqlite3
|
|
134
140
|
|
|
135
141
|
BUNDLED WITH
|
|
136
|
-
2.
|
|
142
|
+
2.2.16
|
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.add_runtime_dependency 'activesupport'
|
|
20
20
|
s.add_runtime_dependency 'dogstatsd-ruby', '>= 4.8', '< 5.0'
|
|
21
21
|
|
|
22
|
+
s.add_development_dependency 'activejob'
|
|
22
23
|
s.add_development_dependency 'activerecord'
|
|
23
24
|
s.add_development_dependency 'bundler'
|
|
24
25
|
s.add_development_dependency 'grape', '>= 1.0.2'
|
|
@@ -18,9 +18,10 @@ module Datadog::Notifications::Plugins
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
20
|
def record(reporter, event)
|
|
21
|
-
job
|
|
22
|
-
name
|
|
23
|
-
|
|
21
|
+
job = event.payload[:job]
|
|
22
|
+
name = job.class.name.sub(/Job$/, '').underscore
|
|
23
|
+
queue = job.queue_name.tr(':', '_')
|
|
24
|
+
tags = self.tags + %W[job:#{name} queue:#{queue}]
|
|
24
25
|
|
|
25
26
|
reporter.batch do
|
|
26
27
|
reporter.increment metric_name, tags: tags
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Datadog::Notifications::Plugins::ActiveJob do
|
|
4
|
+
it 'sanitizes tags' do
|
|
5
|
+
NoopJob.perform_now
|
|
6
|
+
expect(buffered).to eq [
|
|
7
|
+
'activejob.perform:1|c|#custom:tag,env:test,host:test.host,job:noop,queue:test_queue',
|
|
8
|
+
'activejob.perform.time:333|ms|#custom:tag,env:test,host:test.host,job:noop,queue:test_queue',
|
|
9
|
+
]
|
|
10
|
+
end
|
|
11
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -6,6 +6,7 @@ require 'rspec'
|
|
|
6
6
|
require 'rack/test'
|
|
7
7
|
require 'grape'
|
|
8
8
|
require 'active_record'
|
|
9
|
+
require 'active_job'
|
|
9
10
|
require 'sqlite3'
|
|
10
11
|
|
|
11
12
|
### Active-record test preparation
|
|
@@ -18,6 +19,14 @@ end
|
|
|
18
19
|
class Post < ActiveRecord::Base
|
|
19
20
|
end
|
|
20
21
|
|
|
22
|
+
### Active-job test preparation
|
|
23
|
+
|
|
24
|
+
ActiveJob::Base.queue_adapter = :inline
|
|
25
|
+
class NoopJob < ActiveJob::Base
|
|
26
|
+
self.queue_name = 'test:queue'
|
|
27
|
+
def perform; end
|
|
28
|
+
end
|
|
29
|
+
|
|
21
30
|
### Mocks
|
|
22
31
|
|
|
23
32
|
module Mock
|
|
@@ -70,6 +79,7 @@ Datadog::Notifications.configure do |c|
|
|
|
70
79
|
c.tags = ['custom:tag']
|
|
71
80
|
|
|
72
81
|
c.use Datadog::Notifications::Plugins::ActiveRecord
|
|
82
|
+
c.use Datadog::Notifications::Plugins::ActiveJob
|
|
73
83
|
c.use Datadog::Notifications::Plugins::Grape,
|
|
74
84
|
tags: ['more:tags'],
|
|
75
85
|
metric_name: 'api.request',
|
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.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dimitrij Denissenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -44,6 +44,20 @@ dependencies:
|
|
|
44
44
|
- - "<"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '5.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: activejob
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
47
61
|
- !ruby/object:Gem::Dependency
|
|
48
62
|
name: activerecord
|
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -186,6 +200,7 @@ files:
|
|
|
186
200
|
- lib/datadog/notifications/reporter.rb
|
|
187
201
|
- lib/datadog/notifications/version.rb
|
|
188
202
|
- spec/datadog/notifications/config_spec.rb
|
|
203
|
+
- spec/datadog/notifications/plugins/active_job_spec.rb
|
|
189
204
|
- spec/datadog/notifications/plugins/active_record_spec.rb
|
|
190
205
|
- spec/datadog/notifications/plugins/grape_spec.rb
|
|
191
206
|
- spec/datadog/notifications_spec.rb
|
|
@@ -208,12 +223,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
223
|
- !ruby/object:Gem::Version
|
|
209
224
|
version: '0'
|
|
210
225
|
requirements: []
|
|
211
|
-
rubygems_version: 3.
|
|
226
|
+
rubygems_version: 3.2.15
|
|
212
227
|
signing_key:
|
|
213
228
|
specification_version: 4
|
|
214
229
|
summary: Generic ActiveSupport::Notifications Datadog handler
|
|
215
230
|
test_files:
|
|
216
231
|
- spec/datadog/notifications/config_spec.rb
|
|
232
|
+
- spec/datadog/notifications/plugins/active_job_spec.rb
|
|
217
233
|
- spec/datadog/notifications/plugins/active_record_spec.rb
|
|
218
234
|
- spec/datadog/notifications/plugins/grape_spec.rb
|
|
219
235
|
- spec/datadog/notifications_spec.rb
|