Method: Wavefront::Write#initialize

Defined in:
lib/wavefront-sdk/write.rb

#initialize(creds = {}, opts = {}) ⇒ Write

Construct an object which gives the user an interface for writing points to Wavefront. The actual writing is handled by

a Wavefront::Writer

subclass.

Parameters:

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

    credentials: can contain keys: proxy [String] the address of the Wavefront proxy. (‘wavefront’) port [Integer] the port of the Wavefront proxy

  • options (Hash)

    can contain the following keys: tags [Hash] point tags which will be applied to every point noop [Bool] if true, no proxy connection will be made, and

    instead of sending the points, they will be printed in
    Wavefront wire format.
    

    novalidate [Bool] if true, points will not be validated.

    This might make things go marginally quicker if you have
    done point validation higher up in the chain. Invalid
    points are dropped, logged, and reported in the summary.
    

    verbose [Bool] debug [Bool] writer [Symbol, String] the name of the writer class to use.

    Defaults to :proxy
    

    noauto [Bool] if this is false, #write will automatically

    open a connection to Wavefront on each invocation. Set
    this to true to manually manage the connection.
    

    chunk_size [Integer] So as not to create unusable metric

    payloads, large batches of points will be broken into
    chunks. This property controls the number of metrics in a
    chunk. Defaults to 1,000.
    

    chunk_pause [Integer] pause this many seconds between

    writing chunks. Defaults to zero.
    


53
54
55
56
57
58
59
# File 'lib/wavefront-sdk/write.rb', line 53

def initialize(creds = {}, opts = {})
  @opts = setup_options(opts, defaults)
  @creds = creds
  wf_point_tags?(opts[:tags]) if opts[:tags]
  @logger = Wavefront::Logger.new(opts)
  @writer = setup_writer
end