module GreenHat::Sidekiq

Sidekiq Log Helpers

Public Class Methods

errors() click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 24
def self.errors
  logs.select { |x| x.severity == 'ERROR' }
end
fast_stats() click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 4
def self.fast_stats
  things.each do |thing|
    puts `fast-stats #{thing.file}`
  end

  :ok!
end
logs() click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 12
def self.logs
  @logs ||= things.map(&:data).flatten.compact
end
pages() click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 28
def self.pages
  show logs
end
queue_duration(data = nil) click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 32
def self.queue_duration(data = nil)
  data ||= logs
  data.select { |x| x.key? :enqueued_at }.each do |row|
    next if row.key? :queue_duration

    row[:queue_duration] = row.enqueued_at - row.created_at
  end
end
raw() click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 16
def self.raw
  @raw ||= things.map(&:raw).flatten.compact
end
things() click to toggle source
# File lib/greenhat/accessors/logs/sidekiq.rb, line 20
def self.things
  Thing.where(name: 'sidekiq_current')
end