Class: NewrelicSphinx::Metric
- Inherits:
-
Object
- Object
- NewrelicSphinx::Metric
- Defined in:
- lib/newrelic_sphinx/agent.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#last_value ⇒ Object
readonly
Returns the value of attribute last_value.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#units ⇒ Object
readonly
Returns the value of attribute units.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #incremental? ⇒ Boolean
-
#initialize(key, name, units, mode = :plain) ⇒ Metric
constructor
A new instance of Metric.
- #memorize ⇒ Object
- #plain? ⇒ Boolean
Constructor Details
#initialize(key, name, units, mode = :plain) ⇒ Metric
Returns a new instance of Metric.
11 12 13 14 15 |
# File 'lib/newrelic_sphinx/agent.rb', line 11 def initialize(key, name, units, mode = :plain) @key, @name, @units, @mode = key, name, units, mode @value = 0 @last_value = 0 end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/newrelic_sphinx/agent.rb', line 8 def key @key end |
#last_value ⇒ Object (readonly)
Returns the value of attribute last_value.
8 9 10 |
# File 'lib/newrelic_sphinx/agent.rb', line 8 def last_value @last_value end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
8 9 10 |
# File 'lib/newrelic_sphinx/agent.rb', line 8 def mode @mode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/newrelic_sphinx/agent.rb', line 8 def name @name end |
#units ⇒ Object (readonly)
Returns the value of attribute units.
8 9 10 |
# File 'lib/newrelic_sphinx/agent.rb', line 8 def units @units end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/newrelic_sphinx/agent.rb', line 9 def value @value end |
Instance Method Details
#incremental? ⇒ Boolean
25 26 27 |
# File 'lib/newrelic_sphinx/agent.rb', line 25 def incremental? mode == :incremental end |
#memorize ⇒ Object
17 18 19 |
# File 'lib/newrelic_sphinx/agent.rb', line 17 def memorize @last_value = value end |
#plain? ⇒ Boolean
21 22 23 |
# File 'lib/newrelic_sphinx/agent.rb', line 21 def plain? mode == :plain end |