datadog-notifications 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 299177adeebc9ed3fd6984f9725fb88ae46ab24b1582548976e8d4aa1a48f55a
4
- data.tar.gz: bdea7f81d306dbb4f45d77b1870475596a3b9e04ef4675ca7ef117c03066be9a
3
+ metadata.gz: 0fe55c10d1c135748c2a818187431d0f316a8cf0192cefdf7ab45d6245e6add9
4
+ data.tar.gz: f9449725f5768bb0e75eb02363f12eda4235e474d7fb00e6f7cc4c2b54c599d2
5
5
  SHA512:
6
- metadata.gz: 4c7a6359a6b6abc80be605d04dd8934d7460de1a16ec1f2c7d6018c7f37c5b036658b8fa022f459117ea2367157cdc1e601c6482b72ff5ecf85e6965835e4d4e
7
- data.tar.gz: f72472a2cfee96d1cb79f6ceddccdc8103ba8dffdd86465866dc17236ac95b59822558bad85cb40e848f4372a2ef588ba1bcd2fc7e3834a8e0415a2f23f0cbc7
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.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.4)
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.1.4
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 = event.payload[:job]
22
- name = job.class.name.sub(/Job$/, '').underscore
23
- tags = self.tags + %W[job:#{name} queue:#{job.queue_name}]
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
@@ -1,5 +1,5 @@
1
1
  module Datadog
2
2
  class Notifications
3
- VERSION = '0.6.6'.freeze
3
+ VERSION = '0.6.7'.freeze
4
4
  end
5
5
  end
@@ -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.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-03-02 00:00:00.000000000 Z
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.1.4
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