diff --git a/Gemfile.lock b/Gemfile.lock index 3d3ce390..f89ba70a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,6 @@ PATH remote: . specs: qless (0.11.0) - metriks (~> 0.9) redis (>= 2.2, < 4.0.0.rc1) rusage (~> 0.2.0) sentry-raven (~> 0.15.6) @@ -16,9 +15,6 @@ GEM remote: http://rubygems.org/ specs: ast (2.3.0) - atomic (1.1.99) - avl_tree (1.2.1) - atomic (~> 1.1) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) byebug (2.7.0) @@ -55,10 +51,6 @@ GEM hitimes (1.2.6) http_parser.rb (0.5.3) method_source (0.8.2) - metriks (0.9.9.8) - atomic (~> 1.0) - avl_tree (~> 1.2.0) - hitimes (~> 1.1) mime-types (1.25) mini_portile (0.5.1) multi_json (1.12.2) diff --git a/lib/qless/middleware/metriks.rb b/lib/qless/middleware/metriks.rb index 10d347fc..eb429125 100644 --- a/lib/qless/middleware/metriks.rb +++ b/lib/qless/middleware/metriks.rb @@ -1,6 +1,7 @@ # Encoding: utf-8 -require 'metriks' +# This middleware is now a no-op because +# the metriks dependency breaks builds. module Qless module Middleware @@ -9,9 +10,7 @@ module Metriks # Tracks the time jobs take, grouping the timings by the job class. module TimeJobsByClass def around_perform(job) - ::Metriks.timer("qless.job-times.#{job.klass_name}").time do - super - end + super end end @@ -31,11 +30,6 @@ def initialize(class_to_event_map) module_eval do # eval the block within the module instance define_method :around_perform do |job| super(job) - return unless job.state == 'complete' - return unless event_name = class_to_event_map[job.klass] - - counter = ::Metriks.counter("qless.job-events.#{event_name}") - counter.increment end end end diff --git a/qless.gemspec b/qless.gemspec index c49419dd..797edee7 100644 --- a/qless.gemspec +++ b/qless.gemspec @@ -36,7 +36,6 @@ language-specific extension will also remain up to date. s.test_files = s.files.grep(/^(test|spec|features)\//) s.require_paths = ['lib'] - s.add_dependency 'metriks', '~> 0.9' s.add_dependency 'redis', ['>= 2.2', '< 4.0.0.rc1'] s.add_dependency 'rusage', '~> 0.2.0' s.add_dependency 'sentry-raven', '~> 0.15.6' diff --git a/spec/unit/middleware/metriks_spec.rb b/spec/unit/middleware/metriks_spec.rb deleted file mode 100644 index d1dd187c..00000000 --- a/spec/unit/middleware/metriks_spec.rb +++ /dev/null @@ -1,91 +0,0 @@ -# Encoding: utf-8 - -require 'spec_helper' -require 'qless/middleware/metriks' -require 'qless/worker' - -module Qless - module Middleware - module Metriks - shared_context 'isolate metriks' do - before { ::Metriks::Registry.default.clear } - end - - describe TimeJobsByClass do - include_context 'isolate metriks' - - it 'tracks the time taken by the job, grouped by the class name' do - stub_const('JobABC', Class.new) - job = Qless::Job.build(double, JobABC, {}) - - base_class = Class.new do - def around_perform(job) - sleep 0.05 - end - end - - worker = Class.new(base_class) do - include TimeJobsByClass - end - - worker.new.around_perform(job) - - timer = ::Metriks.timer('qless.job-times.JobABC') - expect(timer.max).to be_within(10).percent_of(0.05) - end - end - - describe CountEvents do - include_context 'isolate metriks' - - before do - stub_const('Class1', Class.new) - stub_const('Class2', Class.new) - stub_const('Class3', Class.new) - end - - def worker(result = :complete) - base_class = Class.new do - define_method :around_perform do |job| - job.instance_variable_set(:@state, result.to_s) - end - end - - Class.new(base_class) do - include CountEvents.new( - Class1 => 'foo', - Class2 => 'bar' - ) - end - end - - def create_job_and_perform(klass, job_result = :complete) - job = Qless::Job.build(double, klass, {}) - worker(job_result).new.around_perform(job) - end - - it 'increments an event counter when a particular job completes' do - create_job_and_perform(Class1) - - expect(::Metriks.counter('qless.job-events.foo').count).to eq(1) - expect(::Metriks.counter('qless.job-events.bar').count).to eq(0) - - create_job_and_perform(Class2) - - expect(::Metriks.counter('qless.job-events.foo').count).to eq(1) - expect(::Metriks.counter('qless.job-events.bar').count).to eq(1) - end - - it 'does not increment the counter if the job fails' do - create_job_and_perform(Class1, :failed) - expect(::Metriks.counter('qless.job-events.foo').count).to eq(0) - end - - it 'does not increment a counter if it is not in the given map' do - create_job_and_perform(Class3) - expect(::Metriks::Registry.default.each.to_a).to eq([]) - end - end - end - end -end