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.
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
#rejected ⇒ Object
Returns the value of attribute rejected.
7 8 9 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 7 def rejected @rejected end |
#sent ⇒ Object
Returns the value of attribute sent.
7 8 9 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 7 def sent @sent end |
#unsent ⇒ Object
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.)
26 27 28 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 26 def ok? unsent.zero? && rejected.zero? end |
#result ⇒ String
Returns 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_h ⇒ Hash
Representation of summary as it used to be when it was built into the Write class
34 35 36 |
# File 'lib/wavefront-sdk/writers/summary.rb', line 34 def to_h { sent: sent, rejected: rejected, unsent: unsent } end |