Class: KairosDB::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/kairosdb/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Config

Returns a new instance of Config.

Parameters:

  • (Hash)
  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :host (String)

    the host url of KairosDB.

  • :port (Integer)

    the port KairosDB is accessible on.

  • :initial_delay (Float)

    minimum delay before retrying an HTTP connection.

  • :max_delay (Float)

    maximum delay before retrying an HTTP connection.

  • :write_timeout (Float)
  • :read_timeout (Float)
  • :retry (Boolean)

    number of times to retry an HTTP connection, setting this to -1 will cause infinite retries



14
15
16
17
18
19
20
21
22
# File 'lib/kairosdb/config.rb', line 14

def initialize(opts = {})
  @host = opts.fetch(:host, 'localhost')
  @port = opts.fetch(:port, 8080)
  @initial_delay = opts.fetch(:initial_delay, 0.01)
  @max_delay = opts.fetch(:max_delay, 30)
  @open_timeout = opts.fetch(:write_timeout, 5)
  @read_timeout = opts.fetch(:read_timeout, 300)
  @retry = opts.fetch(:retry, 3)
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def host
  @host
end

#initial_delayObject

Returns the value of attribute initial_delay.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def initial_delay
  @initial_delay
end

#max_delayObject

Returns the value of attribute max_delay.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def max_delay
  @max_delay
end

#open_timeoutObject

Returns the value of attribute open_timeout.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def open_timeout
  @open_timeout
end

#portObject

Returns the value of attribute port.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def port
  @port
end

#read_timeoutObject

Returns the value of attribute read_timeout.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def read_timeout
  @read_timeout
end

#retryObject

Returns the value of attribute retry.



3
4
5
# File 'lib/kairosdb/config.rb', line 3

def retry
  @retry
end