Class: Cassandra::Utils::Statsd
- Inherits:
-
Object
- Object
- Cassandra::Utils::Statsd
- Defined in:
- lib/cassandra/utils/statsd.rb
Instance Attribute Summary collapse
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
-
#statsd ⇒ Object
readonly
Returns the value of attribute statsd.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(metric_name) ⇒ Statsd
constructor
A new instance of Statsd.
- #push!(value = @value) ⇒ Object
- #to_dd(value) ⇒ Object
Constructor Details
#initialize(metric_name) ⇒ Statsd
Returns a new instance of Statsd.
8 9 10 11 12 |
# File 'lib/cassandra/utils/statsd.rb', line 8 def initialize(metric_name) @statsd ||= ::Statsd.new('localhost', 8125) @metric_name = metric_name self end |
Instance Attribute Details
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
6 7 8 |
# File 'lib/cassandra/utils/statsd.rb', line 6 def metric_name @metric_name end |
#statsd ⇒ Object (readonly)
Returns the value of attribute statsd.
6 7 8 |
# File 'lib/cassandra/utils/statsd.rb', line 6 def statsd @statsd end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/cassandra/utils/statsd.rb', line 6 def value @value end |
Instance Method Details
#push!(value = @value) ⇒ Object
19 20 21 |
# File 'lib/cassandra/utils/statsd.rb', line 19 def push!(value = @value) statsd.gauge(metric_name, value) end |
#to_dd(value) ⇒ Object
14 15 16 17 |
# File 'lib/cassandra/utils/statsd.rb', line 14 def to_dd(value) @value = (value == true ? 1 : 0) self end |