sidekiq-datadog 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 5aea86eaa87d26b2fa592d8ca714c4fffec52f3a
4
- data.tar.gz: 34498e1f66cc33ac85f6056a803c625ddc7a5524
3
+ metadata.gz: a8043891b229caf308e08b902fade3f2ae4bf959
4
+ data.tar.gz: 0f12bab2a9ab38efc1d77742b74dfb700ffad439
5
5
  SHA512:
6
- metadata.gz: 84c2b8fa2b0504fd69b67314b4f55b6ae32678fb07c29db9ba0526bb33bd8302293efe78961e77c7ff67d6587d61c4ec01834a88ea952b5603997328f91225f1
7
- data.tar.gz: 8bc0124d01c54c5a76428ec09099e092cc504c964501b65254ad14ede5c7aa74e02d460454e6da08503e526f7c6d8ff9edbae3af7217564342925ebc88be00b9
6
+ metadata.gz: 19c3f2ee20b3a66ef3eab88abddbfe32709c594a72db5d87b79e3096ddbdcb6540cfe76a606fbf97c06cf3b56ad0bc8925779553905847b09aa320aa3b1610c2
7
+ data.tar.gz: be99a4d3b34abed38c26e0f7745bd8919b0faa050091368e23bb60890b21f6d9b38e7d3d0aff7c13c5766c5cc67d23a810369426c89bb0f985ed3312370c7eb8
data/.gitignore CHANGED
@@ -3,15 +3,4 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
6
  pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  rvm:
3
5
  - 2.2.2
4
6
  - 2.1.1
5
7
  - 2.0.0
6
- - 1.9.3
data/Gemfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sidekiq-datadog (0.3.1)
5
+ dogstatsd-ruby
6
+ sidekiq
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ concurrent-ruby (1.0.1)
12
+ connection_pool (2.2.0)
13
+ diff-lcs (1.2.5)
14
+ dogstatsd-ruby (1.6.0)
15
+ rake (11.1.2)
16
+ redis (3.3.0)
17
+ rspec (3.4.0)
18
+ rspec-core (~> 3.4.0)
19
+ rspec-expectations (~> 3.4.0)
20
+ rspec-mocks (~> 3.4.0)
21
+ rspec-core (3.4.4)
22
+ rspec-support (~> 3.4.0)
23
+ rspec-expectations (3.4.0)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.4.0)
26
+ rspec-mocks (3.4.1)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.4.0)
29
+ rspec-support (3.4.1)
30
+ sidekiq (4.1.1)
31
+ concurrent-ruby (~> 1.0)
32
+ connection_pool (~> 2.2, >= 2.2.0)
33
+ redis (~> 3.2, >= 3.2.1)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ bundler
40
+ rake
41
+ rspec (~> 3.0)
42
+ sidekiq-datadog!
43
+
44
+ BUNDLED WITH
45
+ 1.11.2
data/README.md CHANGED
@@ -21,7 +21,7 @@ Configure it in an initializer:
21
21
  end
22
22
  end
23
23
 
24
- For full configuration options, please see the [Documentation][http://www.rubydoc.info/gems/sidekiq-datadog].
24
+ For full configuration options, please see the [Documentation](http://www.rubydoc.info/gems/sidekiq-datadog).
25
25
 
26
26
  ## Contributing
27
27
 
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Datadog
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -57,6 +57,9 @@ module Sidekiq
57
57
 
58
58
  def record(worker, job, queue, start, error = nil)
59
59
  ms = ((Time.now - start) * 1000).round
60
+ if job["created_at"]
61
+ queued_ms = start - Time.at(job["created_at"])
62
+ end
60
63
  name = underscore(job['wrapped'] || worker.class.to_s)
61
64
  tags = @tags.map do |tag|
62
65
  case tag when String then tag when Proc then tag.call(worker, job, queue, error) end
@@ -74,6 +77,9 @@ module Sidekiq
74
77
 
75
78
  @statsd.increment @metric_name, :tags => tags
76
79
  @statsd.timing "#{@metric_name}.time", ms, :tags => tags
80
+ if queued_ms
81
+ @statsd.timing "#{@metric_name}.queued_time", queued_ms, :tags => tags
82
+ end
77
83
  end
78
84
 
79
85
  def underscore(word)
@@ -9,18 +9,20 @@ describe Sidekiq::Middleware::Server::Datadog do
9
9
  subject { described_class.new hostname: "test.host", statsd: statsd, tags: ["custom:tag", lambda{|w, *| "worker:#{w.class.name[1..2]}" }] }
10
10
 
11
11
  it 'should send an increment and timing event for each job run' do
12
- subject.call(worker, {}, 'default') { "ok" }
12
+ subject.call(worker, { "created_at" => 1461881794.9312189 }, 'default') { "ok" }
13
13
  expect(statsd.buffer).to eq([
14
14
  "sidekiq.job:1|c|#custom:tag,worker:oc,host:test.host,env:test,name:mock/worker,queue:default,status:ok",
15
15
  "sidekiq.job.time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:mock/worker,queue:default,status:ok",
16
+ "sidekiq.job.queued_time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:mock/worker,queue:default,status:ok",
16
17
  ])
17
18
  end
18
19
 
19
20
  it 'should support wrappers' do
20
- subject.call(worker, {'wrapped' => 'wrap'}, nil) { "ok" }
21
+ subject.call(worker, { 'created_at' => 1461881794.9312189, 'wrapped' => 'wrap'}, nil) { "ok" }
21
22
  expect(statsd.buffer).to eq([
22
23
  "sidekiq.job:1|c|#custom:tag,worker:oc,host:test.host,env:test,name:wrap,status:ok",
23
24
  "sidekiq.job.time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:wrap,status:ok",
25
+ "sidekiq.job.queued_time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:wrap,status:ok",
24
26
  ])
25
27
  end
26
28
 
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.3.0
4
+ version: 0.3.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: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -90,6 +90,7 @@ files:
90
90
  - ".gitignore"
91
91
  - ".travis.yml"
92
92
  - Gemfile
93
+ - Gemfile.lock
93
94
  - LICENSE.txt
94
95
  - README.md
95
96
  - Rakefile
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  version: '0'
120
121
  requirements: []
121
122
  rubyforge_project:
122
- rubygems_version: 2.4.7
123
+ rubygems_version: 2.5.1
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: Datadog metrics for sidekiq
@@ -127,4 +128,3 @@ test_files:
127
128
  - spec/sidekiq/datadog/version_spec.rb
128
129
  - spec/sidekiq/middleware/server/datadog_spec.rb
129
130
  - spec/spec_helper.rb
130
- has_rdoc: