lib/tabs/metrics/counter.rb in tabs-0.6.1 vs lib/tabs/metrics/counter.rb in tabs-0.6.2
- old
+ new
@@ -29,10 +29,14 @@
filtered_pairs = fill_missing_dates(period, filtered_pairs, resolution)
filtered_pairs.map { |p| Hash[[p]] }
end
def total
- get("stat:counter:#{key}:total").to_i
+ (get("stat:counter:#{key}:total") || 0).to_i
+ end
+
+ def drop!
+ del_by_prefix("stat:counter:#{key}")
end
private
def increment_resolution(resolution, timestamp)