Class: Logdash::Metrics

Inherits:
Object
  • Object
show all
Includes:
BaseMetrics
Defined in:
lib/logdash/metrics.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, host:, verbose:) ⇒ Metrics

Returns a new instance of Metrics.



26
27
28
29
30
# File 'lib/logdash/metrics.rb', line 26

def initialize(api_key:, host:, verbose:)
  @api_key = api_key
  @host = host
  @verbose = verbose
end

Instance Method Details

#mutate(name, value) ⇒ Object



37
38
39
40
# File 'lib/logdash/metrics.rb', line 37

def mutate(name, value)
  puts "[LogDash] Mutating metric #{name} by #{value}" if @verbose
  send_metric_async(name, value, MetricOperation::CHANGE)
end

#set(name, value) ⇒ Object



32
33
34
35
# File 'lib/logdash/metrics.rb', line 32

def set(name, value)
  puts "[LogDash] Setting metric #{name} to #{value}" if @verbose
  send_metric_async(name, value, MetricOperation::SET)
end