sidekiq-datadog 0.3.5 → 0.4.0

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
- SHA1:
3
- metadata.gz: 434adf81e26d369fe73a8ade746e621987c91cdf
4
- data.tar.gz: 3555d4a780a1d8655aeafae3f90fe29f7da3b601
2
+ SHA256:
3
+ metadata.gz: 5f4d345b0e6b984519eca3a6e088f387649fc5bbc46d414fc3ed0165f8ca9db7
4
+ data.tar.gz: 0d9b85a785bea3e9ca60d2a62604c90eef649754a0f6377e32aa115eb0a0eb95
5
5
  SHA512:
6
- metadata.gz: 2ad97b9312251b01a17c5da6b1dc05922767f5197f4dde69b3c5c9c3c63a0f5a4b228cb2b6e12e0301524d490005ae7571ccadead8cc807a228bb0e5b57ed0a7
7
- data.tar.gz: a443d277c1e0ee3ea8789bf60ae0bf083cc93b4867351de2b80e4bdecaeff8455d35424eda17b03de51e2d204e926566c07e51d4832aec7993978e4231206201
6
+ metadata.gz: 5da1867bec33ef19c61ac30efe3f37aef687f77c509a1859d69028fbeade3f49ae4543604bbf21a6c16a2ed980f0f025dbc31f7f09f37119b8a39f554e1b4cfa
7
+ data.tar.gz: 62cff0b0830b3a3caba520257827524fc49f59f307abfb5476d67b96911bb96db3db21d6fbdeccef2586b7f10c7e2bd1925f76601ae85cf872ac1af197cb18c8
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
- sudo: false
3
2
  cache: bundler
4
3
  rvm:
5
- - 2.3.1
6
- - 2.2.5
4
+ - 2.5.1
5
+ - 2.4.4
data/Gemfile.lock CHANGED
@@ -1,40 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq-datadog (0.3.5)
5
- dogstatsd-ruby (>= 2.0.0)
4
+ sidekiq-datadog (0.4.0)
5
+ dogstatsd-ruby (>= 3.3.0)
6
6
  sidekiq
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  concurrent-ruby (1.0.5)
12
- connection_pool (2.2.1)
12
+ connection_pool (2.2.2)
13
13
  diff-lcs (1.3)
14
- dogstatsd-ruby (2.2.0)
15
- rack (2.0.1)
16
- rack-protection (1.5.3)
14
+ dogstatsd-ruby (3.3.0)
15
+ rack (2.0.5)
16
+ rack-protection (2.0.3)
17
17
  rack
18
- rake (12.0.0)
19
- redis (3.3.3)
20
- rspec (3.5.0)
21
- rspec-core (~> 3.5.0)
22
- rspec-expectations (~> 3.5.0)
23
- rspec-mocks (~> 3.5.0)
24
- rspec-core (3.5.4)
25
- rspec-support (~> 3.5.0)
26
- rspec-expectations (3.5.0)
18
+ rake (12.3.1)
19
+ redis (4.0.1)
20
+ rspec (3.7.0)
21
+ rspec-core (~> 3.7.0)
22
+ rspec-expectations (~> 3.7.0)
23
+ rspec-mocks (~> 3.7.0)
24
+ rspec-core (3.7.1)
25
+ rspec-support (~> 3.7.0)
26
+ rspec-expectations (3.7.0)
27
27
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.5.0)
29
- rspec-mocks (3.5.0)
28
+ rspec-support (~> 3.7.0)
29
+ rspec-mocks (3.7.0)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.5.0)
32
- rspec-support (3.5.0)
33
- sidekiq (4.2.10)
31
+ rspec-support (~> 3.7.0)
32
+ rspec-support (3.7.1)
33
+ sidekiq (5.1.3)
34
34
  concurrent-ruby (~> 1.0)
35
35
  connection_pool (~> 2.2, >= 2.2.0)
36
36
  rack-protection (>= 1.5.0)
37
- redis (~> 3.2, >= 3.2.1)
37
+ redis (>= 3.3.5, < 5)
38
38
 
39
39
  PLATFORMS
40
40
  ruby
@@ -46,4 +46,4 @@ DEPENDENCIES
46
46
  sidekiq-datadog!
47
47
 
48
48
  BUNDLED WITH
49
- 1.14.6
49
+ 1.16.2
data/README.md CHANGED
@@ -21,7 +21,45 @@ 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
+ ## Options
25
+
26
+ Options can be configured to be passed to the middleware constructor when it is added to the
27
+ chain
28
+
29
+ Sidekiq.configure_server do |config|
30
+ config.server_middleware do |chain|
31
+ chain.add(Sidekiq::Middleware::Server::Datadog, statsd_port: 3334)
32
+ end
33
+ end
34
+
35
+ Custom tags can be configured using the `tags:` property
36
+
37
+ Sidekiq.configure_server do |config|
38
+ config.server_middleware do |chain|
39
+ chain.add(Sidekiq::Middleware::Server::Datadog, tags: ['runtime:jruby'])
40
+ end
41
+ end
42
+
43
+ Dynamic tags can be configured by passing a lambda in the tags array. It is
44
+ executed at runtime when the job is processed
45
+
46
+ Sidekiq.configure_server do |config|
47
+ config.server_middleware do |chain|
48
+ chain.add(Sidekiq::Middleware::Server::Datadog, tags: [->(worker, job, queue, error){
49
+ "source:#{job['source']}"
50
+ }])
51
+ end
52
+ end
53
+
54
+ #### supported options
55
+ - *hostname* - the hostname used for instrumentation, defaults to system hostname. Can also be set with the `INSTRUMENTATION_HOSTNAME` env var.
56
+ - *metric_name* - the metric name (prefix) to use, defaults to "sidekiq.job".
57
+ - *tags* - array of custom tags. These can be plain strings or lambda blocks
58
+ - *statsd_host* - the statsD host, defaults to "localhost". Can also be set with the `STATSD_HOST` env var
59
+ - *statsd_port* - the statsD port, defaults to 8125. Can also be set with the `STATSD_PORT` env var
60
+ - *statsd* - custom statsd instance
61
+
62
+ For more detailed configuration options, please see the [Documentation](http://www.rubydoc.info/gems/sidekiq-datadog).
25
63
 
26
64
  ## Contributing
27
65
 
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Datadog
3
- VERSION = "0.3.5"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
 
20
20
  s.add_runtime_dependency(%q<sidekiq>)
21
- s.add_runtime_dependency(%q<dogstatsd-ruby>, ">= 2.0.0")
21
+ s.add_runtime_dependency(%q<dogstatsd-ruby>, ">= 3.3.0")
22
22
 
23
23
  s.add_development_dependency(%q<rake>)
24
24
  s.add_development_dependency(%q<bundler>)
@@ -5,12 +5,12 @@ describe Sidekiq::Middleware::Server::Datadog do
5
5
  let(:statsd) { Mock::Statsd.new(nil, nil, {}, 10000) }
6
6
  let(:worker) { Mock::Worker.new }
7
7
 
8
- before { statsd.buffer.clear }
8
+ before { statsd.written.clear }
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
12
  subject.call(worker, { 'enqueued_at' => 1461881794.9312189 }, 'default') { "ok" }
13
- expect(statsd.buffer).to eq([
13
+ expect(statsd.written).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
16
  "sidekiq.job.queued_time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:mock/worker,queue:default,status:ok",
@@ -19,7 +19,7 @@ describe Sidekiq::Middleware::Server::Datadog do
19
19
 
20
20
  it 'should support wrappers' do
21
21
  subject.call(worker, { 'enqueued_at' => 1461881794.9312189, 'wrapped' => 'wrap'}, nil) { "ok" }
22
- expect(statsd.buffer).to eq([
22
+ expect(statsd.written).to eq([
23
23
  "sidekiq.job:1|c|#custom:tag,worker:oc,host:test.host,env:test,name:wrap,status:ok",
24
24
  "sidekiq.job.time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:wrap,status:ok",
25
25
  "sidekiq.job.queued_time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:wrap,status:ok",
@@ -31,7 +31,7 @@ describe Sidekiq::Middleware::Server::Datadog do
31
31
  subject.call(worker, {}, nil) { raise RuntimeError, "doh!" }
32
32
  }).to raise_error("doh!")
33
33
 
34
- expect(statsd.buffer).to eq([
34
+ expect(statsd.written).to eq([
35
35
  "sidekiq.job:1|c|#custom:tag,worker:oc,host:test.host,env:test,name:mock/worker,status:error,error:runtime",
36
36
  "sidekiq.job.time:333|ms|#custom:tag,worker:oc,host:test.host,env:test,name:mock/worker,status:error,error:runtime",
37
37
  ])
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 flush_buffer; end
15
- alias :send_stat :send_to_buffer
14
+ def send_to_socket(message); written.push(message); end
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.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-27 00:00:00.000000000 Z
11
+ date: 2018-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
33
+ version: 3.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0
40
+ version: 3.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -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.6.8
123
+ rubygems_version: 2.7.7
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Datadog metrics for sidekiq