sidekiq-datadog 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -19
- data/lib/sidekiq/datadog/version.rb +1 -1
- data/lib/sidekiq/middleware/server/datadog.rb +1 -1
- data/spec/sidekiq/middleware/server/datadog_spec.rb +21 -2
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587cd9c94eb2d0018ddc31e367990f2f0121c40061e8437e6ed0d1491f16a499
|
4
|
+
data.tar.gz: b9e3cf7e254ecb3f26c1df1969f5d40cd20113fed85d69de13792001ec02be87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3abe152091c7c6cce17d943b830f37cf1954a0151c9662fd562d5d4f64fc5d7df87118bcdd8d4e211e1398a2fa9b9af24f0f9f7644c3f20135c93a7825778c54
|
7
|
+
data.tar.gz: f0eb0e04d485c4d915d7c9a1198946725ed9e99be82b2130f4fb39fa19fb04a205a64576f5353f0a907f5ddc608f1baeb643dd21046554ce192e5ebe76b76936
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sidekiq-datadog (0.4.
|
4
|
+
sidekiq-datadog (0.4.1)
|
5
5
|
dogstatsd-ruby (>= 3.3.0)
|
6
6
|
sidekiq
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
concurrent-ruby (1.0.5)
|
12
11
|
connection_pool (2.2.2)
|
13
12
|
diff-lcs (1.3)
|
14
|
-
dogstatsd-ruby (
|
13
|
+
dogstatsd-ruby (4.0.0)
|
15
14
|
rack (2.0.5)
|
16
15
|
rack-protection (2.0.3)
|
17
16
|
rack
|
18
17
|
rake (12.3.1)
|
19
|
-
redis (4.0.
|
20
|
-
rspec (3.
|
21
|
-
rspec-core (~> 3.
|
22
|
-
rspec-expectations (~> 3.
|
23
|
-
rspec-mocks (~> 3.
|
24
|
-
rspec-core (3.
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-expectations (3.
|
18
|
+
redis (4.0.2)
|
19
|
+
rspec (3.8.0)
|
20
|
+
rspec-core (~> 3.8.0)
|
21
|
+
rspec-expectations (~> 3.8.0)
|
22
|
+
rspec-mocks (~> 3.8.0)
|
23
|
+
rspec-core (3.8.0)
|
24
|
+
rspec-support (~> 3.8.0)
|
25
|
+
rspec-expectations (3.8.1)
|
27
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-mocks (3.
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-mocks (3.8.0)
|
30
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-support (3.
|
33
|
-
sidekiq (5.1
|
34
|
-
|
35
|
-
connection_pool (~> 2.2, >= 2.2.0)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-support (3.8.0)
|
32
|
+
sidekiq (5.2.1)
|
33
|
+
connection_pool (~> 2.2, >= 2.2.2)
|
36
34
|
rack-protection (>= 1.5.0)
|
37
35
|
redis (>= 3.3.5, < 5)
|
38
36
|
|
@@ -46,4 +44,4 @@ DEPENDENCIES
|
|
46
44
|
sidekiq-datadog!
|
47
45
|
|
48
46
|
BUNDLED WITH
|
49
|
-
1.16.
|
47
|
+
1.16.4
|
@@ -61,7 +61,7 @@ module Sidekiq
|
|
61
61
|
queued_ms = ((start - Time.at(job["enqueued_at"])) * 1000).round
|
62
62
|
end
|
63
63
|
name = underscore(job['wrapped'] || worker.class.to_s)
|
64
|
-
tags = @tags.
|
64
|
+
tags = @tags.flat_map do |tag|
|
65
65
|
case tag when String then tag when Proc then tag.call(worker, job, queue, error) end
|
66
66
|
end
|
67
67
|
|
@@ -2,11 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Sidekiq::Middleware::Server::Datadog do
|
4
4
|
|
5
|
-
let(:statsd) { Mock::Statsd.new(
|
5
|
+
let(:statsd) { Mock::Statsd.new('localhost', 55555) }
|
6
6
|
let(:worker) { Mock::Worker.new }
|
7
|
+
let(:tags) {
|
8
|
+
["custom:tag", lambda{|w, *| "worker:#{w.class.name[1..2]}" }]
|
9
|
+
}
|
7
10
|
|
8
11
|
before { statsd.written.clear }
|
9
|
-
subject { described_class.new hostname: "test.host", statsd: statsd, tags:
|
12
|
+
subject { described_class.new hostname: "test.host", statsd: statsd, tags: tags }
|
10
13
|
|
11
14
|
it 'should send an increment and timing event for each job run' do
|
12
15
|
subject.call(worker, { 'enqueued_at' => 1461881794.9312189 }, 'default') { "ok" }
|
@@ -37,4 +40,20 @@ describe Sidekiq::Middleware::Server::Datadog do
|
|
37
40
|
])
|
38
41
|
end
|
39
42
|
|
43
|
+
context 'with a dynamic tag list' do
|
44
|
+
let(:tags) {
|
45
|
+
["custom:tag", lambda {|w, j, *| j['args'].map { |n| "arg:#{n}"} }]
|
46
|
+
}
|
47
|
+
|
48
|
+
it 'should generate the correct tags' do
|
49
|
+
subject.call(worker, { 'enqueued_at' => 1461881794.9312189, 'args' => [1, 2] }, 'default') { "ok" }
|
50
|
+
|
51
|
+
expect(statsd.written).to eq([
|
52
|
+
"sidekiq.job:1|c|#custom:tag,arg:1,arg:2,host:test.host,env:test,name:mock/worker,queue:default,status:ok",
|
53
|
+
"sidekiq.job.time:333|ms|#custom:tag,arg:1,arg:2,host:test.host,env:test,name:mock/worker,queue:default,status:ok",
|
54
|
+
"sidekiq.job.queued_time:333|ms|#custom:tag,arg:1,arg:2,host:test.host,env:test,name:mock/worker,queue:default,status:ok"
|
55
|
+
])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
40
59
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ module Mock
|
|
11
11
|
|
12
12
|
class Statsd < ::Datadog::Statsd
|
13
13
|
def timing(stat, ms, opts={}); super(stat, 333, opts); end
|
14
|
-
def
|
14
|
+
def send_stat(message); written.push(message); end
|
15
15
|
def written; @written ||= []; end
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-datadog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.7.
|
123
|
+
rubygems_version: 2.7.6
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Datadog metrics for sidekiq
|