Skip to content

Commit

Permalink
Add no-op metriks middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
sistawendy committed Jul 21, 2020
1 parent 0260a68 commit 2ed0a21
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lib/qless/middleware/metriks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Encoding: utf-8

# This middleware is now a no-op because
# the metriks dependency breaks builds.

module Qless
module Middleware
module Metriks

# Tracks the time jobs take, grouping the timings by the job class.
module TimeJobsByClass
def around_perform(job)
super
end
end

# Increments a counter each time an instance of a particular job class
# completes.
#
# Usage:
#
# Qless::Worker.class_eval do
# include Qless::Middleware::CountEvents.new(
# SomeJobClass => "event_name",
# SomeOtherJobClass => "some_other_event"
# )
# end
class CountEvents < Module
def initialize(class_to_event_map)
module_eval do # eval the block within the module instance
define_method :around_perform do |job|
super(job)
end
end
end
end
end
end
end

0 comments on commit 2ed0a21

Please sign in to comment.