Class: SnowAgent::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/snowagent/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



21
22
23
24
25
26
27
28
29
30
# File 'lib/snowagent/configuration.rb', line 21

def initialize
  self.server        = ENV['SNOWMANIO_SERVER']
  self.secret_token  = ENV['SNOWMANIO_SECRET_TOKEN']
  self.send_interval = 15

  self.read_timeout = 30
  self.open_timeout = 30

  self.async        = false
end

Instance Attribute Details

#asyncObject

Whether send metrics asynchronously or not



19
20
21
# File 'lib/snowagent/configuration.rb', line 19

def async
  @async
end

#open_timeoutObject

Timout when opening connection to the server



16
17
18
# File 'lib/snowagent/configuration.rb', line 16

def open_timeout
  @open_timeout
end

#read_timeoutObject

Timeout when waiting for the server to return data in seconds



13
14
15
# File 'lib/snowagent/configuration.rb', line 13

def read_timeout
  @read_timeout
end

#secret_tokenObject

Secret access token for authentication with SnowmanIO



7
8
9
# File 'lib/snowagent/configuration.rb', line 7

def secret_token
  @secret_token
end

#send_intervalObject

Interval for reporting data to the server



10
11
12
# File 'lib/snowagent/configuration.rb', line 10

def send_interval
  @send_interval
end

#serverObject

Base URL of the SnowmanIO server



4
5
6
# File 'lib/snowagent/configuration.rb', line 4

def server
  @server
end

Instance Method Details

#configured?Boolean

Determines if the agent confiured to send metrics.

Returns:

  • (Boolean)


33
34
35
# File 'lib/snowagent/configuration.rb', line 33

def configured?
  !server.nil? # TODO: also check secret_token token
end