Class: Wavefront::Writer::Summary

Inherits:
Object
  • Object
show all
Defined in:
lib/wavefront-sdk/writers/summary.rb

Overview

Count and report on points we attempt to send to Wavefront.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSummary

Returns a new instance of Summary.



9
10
11
12
13
# File 'lib/wavefront-sdk/writers/summary.rb', line 9

def initialize
  @sent     = 0
  @rejected = 0
  @unsent   = 0
end

Instance Attribute Details

#rejectedObject

Returns the value of attribute rejected.



7
8
9
# File 'lib/wavefront-sdk/writers/summary.rb', line 7

def rejected
  @rejected
end

#sentObject

Returns the value of attribute sent.



7
8
9
# File 'lib/wavefront-sdk/writers/summary.rb', line 7

def sent
  @sent
end

#unsentObject

Returns the value of attribute unsent.



7
8
9
# File 'lib/wavefront-sdk/writers/summary.rb', line 7

def unsent
  @unsent
end

Instance Method Details

#ok?Bool

Were all points sent successfully? (This does not necessarily mean they were received – it depends on the writer class. Sockets are dumb, HTTP is smart.)

Returns:

  • (Bool)


26
27
28
# File 'lib/wavefront-sdk/writers/summary.rb', line 26

def ok?
  unsent.zero? && rejected.zero?
end

#resultString

Returns OK if all points were sent, ERROR if not.

Returns:

  • (String)

    OK if all points were sent, ERROR if not



17
18
19
# File 'lib/wavefront-sdk/writers/summary.rb', line 17

def result
  ok? ? 'OK' : 'ERROR'
end

#to_hHash

Representation of summary as it used to be when it was built into the Write class

Returns:



34
35
36
# File 'lib/wavefront-sdk/writers/summary.rb', line 34

def to_h
  { sent: sent, rejected: rejected, unsent: unsent }
end