Class: Wavefront::Writer::Summary
- Inherits:
-
Object
- Object
- Wavefront::Writer::Summary
- Defined in:
- lib/wavefront-sdk/writers/summary.rb
Overview
Count and report on points we attempt to send to Wavefront.
Instance Attribute Summary collapse
-
#rejected ⇒ Object
Returns the value of attribute rejected.
-
#sent ⇒ Object
Returns the value of attribute sent.
-
#unsent ⇒ Object
Returns the value of attribute unsent.
Instance Method Summary collapse
-
#initialize ⇒ Summary
constructor
A new instance of Summary.
-
#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.).
-
#result ⇒ String
OK if all points were sent, ERROR if not.
-
#to_h ⇒ Hash
Representation of summary as it used to be when it was built into the Write class.
Constructor Details
#initialize ⇒ Summary
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
#rejected ⇒ Object
Returns the value of attribute rejected.
9 10 11 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 9 def rejected @rejected end |
#sent ⇒ Object
Returns the value of attribute sent.
9 10 11 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 9 def sent @sent end |
#unsent ⇒ Object
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.)
28 29 30 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 28 def ok? unsent.zero? && rejected.zero? end |
#result ⇒ String
Returns 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_h ⇒ Hash
Representation of summary as it used to be when it was built into the Write class
36 37 38 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 36 def to_h { sent: sent, rejected: rejected, unsent: unsent } end |