Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

somewhat shaped up

  • Loading branch information...
commit b0c30c4b65728d7d8b88ad9f2861042e7c03be35 1 parent 9db75b2
@jamster authored
View
6 Gemfile
@@ -6,9 +6,11 @@ source "http://rubygems.org"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "rspec", "~> 2.3.0"
+ # gem "rspec", "~> 2.3.0"
gem "yard", "~> 0.6.0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
- gem "rcov", ">= 0"
+ # gem "rcov", ">= 0"
end
+
+gem 'jamster-statsd'
View
20 Gemfile.lock
@@ -0,0 +1,20 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ git (1.2.5)
+ jamster-statsd (0.1.0)
+ jeweler (1.5.2)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
+ rake (0.8.7)
+ yard (0.6.5)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ jamster-statsd
+ jeweler (~> 1.5.2)
+ yard (~> 0.6.0)
View
28 Rakefile
@@ -15,8 +15,8 @@ Jeweler::Tasks.new do |gem|
gem.name = "resque-statsd"
gem.homepage = "http://github.com/jamster/resque-statsd"
gem.license = "MIT"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
+ gem.summary = %Q{Adds simple counters and timers for statsd into your Resque jobs}
+ gem.description = %Q{Will add a counter for enqueuing, performing, failing and timing Jobs}
gem.email = "jayamster@gmail.com"
gem.authors = ["Jason Amster"]
# Include your dependencies below. Runtime dependencies are required when using your gem,
@@ -26,18 +26,18 @@ Jeweler::Tasks.new do |gem|
end
Jeweler::RubygemsDotOrgTasks.new
-require 'rspec/core'
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
- spec.pattern = FileList['spec/**/*_spec.rb']
-end
-
-RSpec::Core::RakeTask.new(:rcov) do |spec|
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
-end
-
-task :default => :spec
+# require 'rspec/core'
+# require 'rspec/core/rake_task'
+# RSpec::Core::RakeTask.new(:spec) do |spec|
+# spec.pattern = FileList['spec/**/*_spec.rb']
+# end
+#
+# RSpec::Core::RakeTask.new(:rcov) do |spec|
+# spec.pattern = 'spec/**/*_spec.rb'
+# spec.rcov = true
+# end
+#
+# task :default => :spec
require 'yard'
YARD::Rake::YardocTask.new
View
13 lib/resque-statsd.rb
@@ -0,0 +1,13 @@
+require 'rubygems'
+require 'statsd' # Really Jnunemakers's mine branch of statsd
+$statsd = Statsd.new('graphite.beenverified.com', 8125)
+$statsd.namespace="beenverified_#{ENV['RAILS_ENV']}.resque"
+
+module Resque
+ module Plugins
+ module Loner
+ VERSION = "0.0.1"
+ end
+ end
+end
+
View
25 lib/resque/plugins/statsd.rb
@@ -0,0 +1,25 @@
+module Resque
+ module Plugins
+ module Statsd
+
+ def after_enqueue_statsd(*args)
+ $statsd.increment("#{queue}.enqueued")
+ end
+
+ def after_perform_statsd(*args)
+ $statsd.increment("#{queue}.finished")
+ end
+
+ def on_failure_statsd(*args)
+ $statsd.increment("#{queue}.failed")
+ end
+
+ def around_perform_statsd(*args)
+ $statsd.time("#{queue}.failed") do
+ yield
+ end
+ end
+
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.