resque-mods 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -8,3 +8,4 @@ gem 'rspec'
8
8
  gem 'resque'
9
9
  gem 'resque_spec'
10
10
  gem 'airbrake'
11
+ gem 'librato-logreporter'
@@ -14,6 +14,7 @@ module ResqueMods
14
14
  ResqueMods.logger.info "#{clazz} completed unsuccessfully in #{run_time.round unless run_time.nil?} seconds with #{e.class}:#{e.message}"
15
15
  raise
16
16
  end
17
+ Librato.measure("resque_mods.logged_job.#{clazz}.run_time", "%f" % run_time)
17
18
  ResqueMods.logger.info "#{clazz} completed successfully in #{run_time.round unless run_time.nil?} seconds"
18
19
  end
19
20
  end
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module Mods
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -17,10 +17,26 @@ describe ResqueMods::LoggedJob do
17
17
  def do_job
18
18
  Resque::Job.new(:jobs, {'class' => "LoggedDummy", 'args' => [1, 2, 3]}).perform
19
19
  end
20
+
21
+ def last_logged
22
+ Librato.log_reporter.log.rewind
23
+ Librato.log_reporter.log.readlines[-1].to_s.chomp
24
+ end
25
+
26
+ before do
27
+ Librato.log_reporter.log = StringIO.new
28
+ end
29
+
20
30
  it "should call the nested perform method" do
21
31
  LoggedDummy.should_receive(:perform).with(1, 2, 3)
22
32
  do_job
23
33
  end
34
+
35
+ it "should measure the run time with librato-logreporter" do
36
+ do_job
37
+ last_logged.should =~ /resque_mods\.logged_job\.LoggedDummy\.run_time=[-+]?([0-9]*\.[0-9]+|[0-9]+)/
38
+ end
39
+
24
40
  context "when an error occurs" do
25
41
  it "should not swallow the error" do
26
42
  LoggedDummy.stub(:perform).and_raise(DummyExcepion.new)
@@ -3,6 +3,7 @@ require 'bundler/setup'
3
3
  require 'resque-mods'
4
4
  require 'resque'
5
5
  require 'airbrake'
6
+ require 'librato-logreporter'
6
7
 
7
8
 
8
9
  RSpec.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-06 00:00:00.000000000 Z
12
+ date: 2013-08-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A set of extensions for resque jobs
15
15
  email: