Class: Metrux::Commands::Meter

Inherits:
Base
  • Object
show all
Defined in:
lib/metrux/commands/meter.rb

Constant Summary collapse

METER_MEASUREMENT_PREFIX_KEY =
'meters/'.freeze

Constants inherited from Base

Base::DEFAULT_TAGS

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Metrux::Commands::Base

Instance Method Details

#execute(key, params = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/metrux/commands/meter.rb', line 6

def execute(key, params = {})
  key = "#{METER_MEASUREMENT_PREFIX_KEY}#{key}"

  value = params.fetch(:value, 1).to_i

  write(key, format_data(value, params), format_write_options(params))
end