Class: Trashed::NewRelic::Sampler
- Inherits:
-
Object
- Object
- Trashed::NewRelic::Sampler
- Defined in:
- lib/trashed/new_relic.rb
Instance Attribute Summary collapse
-
#stats_engine ⇒ Object
Returns the value of attribute stats_engine.
Instance Method Summary collapse
-
#initialize(meter, options = {}) ⇒ Sampler
constructor
A new instance of Sampler.
- #poll ⇒ Object
- #record(data) ⇒ Object
Constructor Details
#initialize(meter, options = {}) ⇒ Sampler
Returns a new instance of Sampler.
10 11 12 13 14 |
# File 'lib/trashed/new_relic.rb', line 10 def initialize(meter, = {}) @meter = meter @label = [:label] || 'Custom/%s' @statsd = [:statsd] end |
Instance Attribute Details
#stats_engine ⇒ Object
Returns the value of attribute stats_engine.
8 9 10 |
# File 'lib/trashed/new_relic.rb', line 8 def stats_engine @stats_engine end |
Instance Method Details
#poll ⇒ Object
16 17 18 19 |
# File 'lib/trashed/new_relic.rb', line 16 def poll record @meter.count record @meter.gauge end |
#record(data) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/trashed/new_relic.rb', line 21 def record(data) data.each do |name, value| record_newrelic name, value record_statsd name, value if @statsd end end |