Class: Chillout::ServerSide
- Inherits:
-
Object
- Object
- Chillout::ServerSide
- Defined in:
- lib/chillout/server_side/server_side.rb
Instance Method Summary collapse
-
#initialize(config, http_client) ⇒ ServerSide
constructor
A new instance of ServerSide.
- #send_check ⇒ Object
- #send_measurements(measurements) ⇒ Object
- #send_metric(data) ⇒ Object
- #send_startup_message ⇒ Object
Constructor Details
#initialize(config, http_client) ⇒ ServerSide
Returns a new instance of ServerSide.
6 7 8 9 |
# File 'lib/chillout/server_side/server_side.rb', line 6 def initialize(config, http_client) @http_client = http_client @config = config end |
Instance Method Details
#send_check ⇒ Object
26 27 28 |
# File 'lib/chillout/server_side/server_side.rb', line 26 def send_check @http_client.get('/check') end |
#send_measurements(measurements) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/chillout/server_side/server_side.rb', line 11 def send_measurements(measurements) send_metric( :measurements => measurements.map(&:as_measurements).flatten, :notifier => { name: @config.notifier_name, version: @config.version, url: @config.notifier_url, } ) end |
#send_metric(data) ⇒ Object
22 23 24 |
# File 'lib/chillout/server_side/server_side.rb', line 22 def send_metric(data) @http_client.post('/metrics', data) end |
#send_startup_message ⇒ Object
30 31 32 33 34 |
# File 'lib/chillout/server_side/server_side.rb', line 30 def @http_client.post('/clients', { :message => 'worker started' }) end |