Module: GreenHat::Production
- Defined in:
- lib/greenhat/accessors/logs/production.rb
Overview
Sidekiq Log Helpers
Class Method Summary collapse
- .errors ⇒ Object
- .fast_stats ⇒ Object
- .logs ⇒ Object
- .pages ⇒ Object
- .queue_duration(data = nil) ⇒ Object
- .raw ⇒ Object
- .things ⇒ Object
Class Method Details
.errors ⇒ Object
24 25 26 |
# File 'lib/greenhat/accessors/logs/production.rb', line 24 def self.errors logs.select { |x| x.severity == 'ERROR' } end |
.fast_stats ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/greenhat/accessors/logs/production.rb', line 4 def self.fast_stats things.each do |thing| puts `fast-stats #{thing.file}` end :ok! end |
.logs ⇒ Object
12 13 14 |
# File 'lib/greenhat/accessors/logs/production.rb', line 12 def self.logs @logs ||= things.map(&:data).flatten.compact end |
.pages ⇒ Object
28 29 30 |
# File 'lib/greenhat/accessors/logs/production.rb', line 28 def self.pages show logs end |
.queue_duration(data = nil) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/greenhat/accessors/logs/production.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 ⇒ Object
16 17 18 |
# File 'lib/greenhat/accessors/logs/production.rb', line 16 def self.raw @raw ||= things.map(&:raw).flatten.compact end |
.things ⇒ Object
20 21 22 |
# File 'lib/greenhat/accessors/logs/production.rb', line 20 def self.things Thing.where(name: 'gitlab_rails_production_json_log') end |