Module: NeetoMonitorRuby::MonitorUtils

Included in:
Monitor
Defined in:
lib/neeto_monitor_ruby/monitor_utils.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

MONITOR_TYPES =
{
  check: "check",
  job: "job",
  heartbeat: "heartbeat"
}.freeze
JOB_STATES =
{
  run: "run",
  complete: "complete",
  fail: "fail"
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



17
18
19
# File 'lib/neeto_monitor_ruby/monitor_utils.rb', line 17

def self.included(klass)
  klass.extend(ClassMethods)
end

Instance Method Details

#generate_seriesObject



39
40
41
# File 'lib/neeto_monitor_ruby/monitor_utils.rb', line 39

def generate_series
  "#{generate_stamp}-#{random_string}"
end

#generate_stampObject



35
36
37
# File 'lib/neeto_monitor_ruby/monitor_utils.rb', line 35

def generate_stamp
  Time.now.utc.to_f
end

#random_stringObject



43
44
45
# File 'lib/neeto_monitor_ruby/monitor_utils.rb', line 43

def random_string
  rand(2**256).to_s(36)[0..7]
end