Class: Honeybadger::Counter

Inherits:
Metric
  • Object
show all
Defined in:
lib/honeybadger/counter.rb

Instance Attribute Summary

Attributes inherited from Metric

#attributes, #name, #samples

Instance Method Summary collapse

Methods inherited from Metric

#base_payload, #event_payloads, #initialize, #metric_type, metric_type, register, signature, #signature

Constructor Details

This class inherits a constructor from Honeybadger::Metric

Instance Method Details

#count(by = 1) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/honeybadger/counter.rb', line 5

def count(by=1)
  return unless by

  @samples += 1

  @counter ||= 0
  @counter = @counter + by
end

#payloadsObject



14
15
16
# File 'lib/honeybadger/counter.rb', line 14

def payloads
  [{ counter: @counter }]
end