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.



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

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

Instance Attribute Details

#rejectedObject

Returns the value of attribute rejected.



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

def rejected
  @rejected
end

#sentObject

Returns the value of attribute sent.



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

def sent
  @sent
end

#unsentObject

Returns the value of attribute unsent.



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

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)


28
29
30
# File 'lib/wavefront-sdk/writers/summary.rb', line 28

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



19
20
21
# File 'lib/wavefront-sdk/writers/summary.rb', line 19

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:



36
37
38
# File 'lib/wavefront-sdk/writers/summary.rb', line 36

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