Module: Cosmo::API::Stats

Defined in:
lib/cosmo/api/stats.rb,
sig/cosmo/api/stats.rbs

Class Method Summary collapse

Class Method Details

.busy::Integer

Returns:

  • (::Integer)


23
24
25
# File 'lib/cosmo/api/stats.rb', line 23

def busy
  Busy.instance.size
end

.dead::Integer

Returns:

  • (::Integer)


39
40
41
# File 'lib/cosmo/api/stats.rb', line 39

def dead
  Stream.new("dead").size
end

.enqueued::Integer

Returns:

  • (::Integer)


27
28
29
# File 'lib/cosmo/api/stats.rb', line 27

def enqueued
  Stream.jobs.sum(&:size)
end

.failed::Integer

Returns:

  • (::Integer)


19
20
21
# File 'lib/cosmo/api/stats.rb', line 19

def failed
  Counter.instance.get(:failed)
end

.processed::Integer

Returns:

  • (::Integer)


15
16
17
# File 'lib/cosmo/api/stats.rb', line 15

def processed
  Counter.instance.get(:processed)
end

.retries::Integer

Returns:

  • (::Integer)


31
32
33
# File 'lib/cosmo/api/stats.rb', line 31

def retries
  Stream.jobs.sum(&:retries)
end

.scheduled::Integer

Returns:

  • (::Integer)


35
36
37
# File 'lib/cosmo/api/stats.rb', line 35

def scheduled
  Stream.new("scheduled").size
end

.summaryHash[Symbol, ::Integer]

Returns:

  • (Hash[Symbol, ::Integer])


11
12
13
# File 'lib/cosmo/api/stats.rb', line 11

def summary
  { processed:, failed:, busy:, enqueued:, retries:, scheduled:, dead: }
end