Class: KairosDB::Client

Inherits:
Object
  • Object
show all
Includes:
HTTP, Logging, Query::Core, Query::Metrics
Defined in:
lib/kairosdb/client.rb

Constant Summary

Constants included from Query::Core

Query::Core::KAIROSDB_DELETE_PATH, Query::Core::KAIROSDB_QUERY_PATH, Query::Core::KAIROSDB_WRITE_PATH

Constants included from Logging

Logging::PREFIX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Query::Metrics

#delete_metric

Methods included from Query::Core

#query, #write_data

Methods included from Logging

#log

Methods included from HTTP

#delete, #post

Constructor Details

#initialize(opts = {}) ⇒ Object

Examples:

params = {
  host: '172.0.0.1',
  port: 8086
}
KairosDB::Client.new(params)

Parameters:

  • (Hash)

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



17
18
19
20
21
22
23
# File 'lib/kairosdb/client.rb', line 17

def initialize(opts = {})
  @config = KairosDB::Config.new(opts)
  @writer = self
  @stopped = false

  at_exit { stop! } if config.retry > 0
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#writerObject (readonly)

Returns the value of attribute writer.



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

def writer
  @writer
end