module Resque::Plugins::Logstash
Constants
- VERSION
Public Class Methods
config()
click to toggle source
# File lib/resque/logstash.rb, line 22 def config @config ||= Config.new end
configure() { |config| ... }
click to toggle source
# File lib/resque/logstash.rb, line 18 def configure yield config end
Public Instance Methods
around_perform_logstash_measure(*args) { || ... }
click to toggle source
# File lib/resque/logstash.rb, line 27 def around_perform_logstash_measure(*args) started_at = Time.now yield rescue Exception => e raise ensure logstash_push_duration Time.now - started_at, args, e end
logstash_create_event(duration, args, exception)
click to toggle source
# File lib/resque/logstash.rb, line 41 def logstash_create_event(duration, args, exception) if exception.nil? params = {'status' => 'success'} verb = 'finished' else params = { 'status' => 'failure', 'exception' => "#{exception.class}: #{exception.message}" } verb = 'failed' end params = params.merge "message" => "Job #{self.name} #{verb} in #{duration}s", "job" => self.name, "duration" => duration, "job_arguments" => args.map { |a| a.to_s }, "tags" => Logstash.config.tags LogStash::Event.new params end
logstash_push_duration(duration, args, exception)
click to toggle source
# File lib/resque/logstash.rb, line 36 def logstash_push_duration(duration, args, exception) return if Logstash.config.disabled? Logstash.config.transport.push logstash_create_event(duration, args, exception) end