Class: Heroku::Scalr::Metric::Ping

Inherits:
Abstract
  • Object
show all
Defined in:
lib/heroku/scalr/metric.rb

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from Heroku::Scalr::Metric::Abstract

Instance Method Details

#byObject

See Also:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/heroku/scalr/metric.rb', line 50

def by
  status = nil

  real = Benchmark.realtime do
    status = http_get.status
  end

  unless status == 200
    log :warn, "unable to ping, server responded with #{status}"
    return 0
  end

  ms = (real * 1000).floor
  log :debug, "current ping time: #{ms}ms"

  compare(ms, @app.ping_low, @app.ping_high)
end