sidekiq-statsd 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +15 -15
- data/lib/sidekiq/statsd/server_middleware.rb +4 -3
- data/lib/sidekiq/statsd/version.rb +1 -1
- data/spec/sidekiq/statsd/server_middleware_spec.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e33d3802f9cdc7d435e1e4338f7828f96534f4e
|
4
|
+
data.tar.gz: b9db8a5236e5a708fd89af15fdd2c8308afe0214
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 362cd5bdb3f38aae086478fd7068f1cd525959f31dad78ab8eaed707f593055894575c284b1e24e7f2f6fa094d1b7928d35c9af3c86aee31646af79c2cd3de47
|
7
|
+
data.tar.gz: da265304addf998d858dded40984207f6819a376d40a423217eb0e5e625e7dae324698e2b89c87ccba4895a76021256e5b136410491fd072a5da5cc12202ef88
|
data/Gemfile
CHANGED
@@ -4,21 +4,21 @@ gemspec
|
|
4
4
|
gem 'sidekiq', ENV['SIDEKIQ_VERSION'] if ENV['SIDEKIQ_VERSION']
|
5
5
|
|
6
6
|
group :development do
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
7
|
+
gem 'rake'
|
8
|
+
gem 'pry'
|
9
|
+
gem 'yard'
|
10
|
+
gem 'redcarpet', platforms: [:ruby]
|
11
11
|
|
12
|
-
gem
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
gem
|
12
|
+
gem 'rspec', '~> 2.14.1'
|
13
|
+
gem 'rspec-redis_helper'
|
14
|
+
gem 'timecop'
|
15
|
+
gem 'simplecov'
|
16
16
|
|
17
|
-
gem
|
18
|
-
gem
|
19
|
-
gem
|
20
|
-
gem
|
21
|
-
gem
|
22
|
-
gem
|
23
|
-
gem
|
17
|
+
gem 'guard'
|
18
|
+
gem 'guard-bundler'
|
19
|
+
gem 'guard-rspec'
|
20
|
+
gem 'guard-yard'
|
21
|
+
gem 'rb-fsevent'
|
22
|
+
gem 'rb-inotify'
|
23
|
+
gem 'growl'
|
24
24
|
end
|
@@ -34,12 +34,13 @@ module Sidekiq::Statsd
|
|
34
34
|
def call worker, msg, queue
|
35
35
|
@statsd.batch do |b|
|
36
36
|
begin
|
37
|
-
|
37
|
+
worker_name = worker.class.name.gsub("::", ".")
|
38
|
+
b.time prefix(worker_name, 'processing_time') do
|
38
39
|
yield
|
39
40
|
end
|
40
|
-
b.increment prefix(
|
41
|
+
b.increment prefix(worker_name, 'success')
|
41
42
|
rescue => e
|
42
|
-
b.increment prefix(
|
43
|
+
b.increment prefix(worker_name, 'failure')
|
43
44
|
raise e
|
44
45
|
ensure
|
45
46
|
# Queue sizes
|
@@ -8,6 +8,8 @@ describe Sidekiq::Statsd::ServerMiddleware do
|
|
8
8
|
let(:queue) { nil }
|
9
9
|
let(:client) { double(::Statsd).as_null_object }
|
10
10
|
|
11
|
+
let(:worker_name) { worker.class.name.gsub("::", ".") }
|
12
|
+
|
11
13
|
let(:clean_job) { ->{} }
|
12
14
|
let(:broken_job) { ->{ raise 'error' } }
|
13
15
|
|
@@ -37,7 +39,7 @@ describe Sidekiq::Statsd::ServerMiddleware do
|
|
37
39
|
it "uses the custom metric name prefix options" do
|
38
40
|
expect(client)
|
39
41
|
.to receive(:time)
|
40
|
-
.with("development.application.sidekiq.#{
|
42
|
+
.with("development.application.sidekiq.#{worker_name}.processing_time", &clean_job)
|
41
43
|
.once
|
42
44
|
|
43
45
|
described_class
|
@@ -54,7 +56,7 @@ describe Sidekiq::Statsd::ServerMiddleware do
|
|
54
56
|
it "increments success counter" do
|
55
57
|
expect(client)
|
56
58
|
.to receive(:increment)
|
57
|
-
.with("production.worker.#{
|
59
|
+
.with("production.worker.#{worker_name}.success")
|
58
60
|
.once
|
59
61
|
|
60
62
|
middleware.call(worker, msg, queue, &job)
|
@@ -63,7 +65,7 @@ describe Sidekiq::Statsd::ServerMiddleware do
|
|
63
65
|
it "times the process execution" do
|
64
66
|
expect(client)
|
65
67
|
.to receive(:time)
|
66
|
-
.with("production.worker.#{
|
68
|
+
.with("production.worker.#{worker_name}.processing_time", &job)
|
67
69
|
.once
|
68
70
|
|
69
71
|
middleware.call(worker, msg, queue, &job)
|
@@ -80,13 +82,13 @@ describe Sidekiq::Statsd::ServerMiddleware do
|
|
80
82
|
before do
|
81
83
|
allow(client)
|
82
84
|
.to receive(:time)
|
83
|
-
.with("production.worker.#{
|
85
|
+
.with("production.worker.#{worker_name}.processing_time", &job)
|
84
86
|
end
|
85
87
|
|
86
88
|
it "increments failure counter" do
|
87
89
|
expect(client)
|
88
90
|
.to receive(:increment)
|
89
|
-
.with("production.worker.#{
|
91
|
+
.with("production.worker.#{worker_name}.failure")
|
90
92
|
.once
|
91
93
|
|
92
94
|
expect{ middleware.call(worker, msg, queue, &job) }.to raise_error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-statsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Cantero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|