anchor.diff:  
   -spec init() -> atom() | ets:tid().
   init() ->
  -    folsom_metrics:new_histogram(?HEALTH_METRIC, slide, 20),
  -    folsom_metrics:new_histogram(?INTERVALS_METRIC, slide, 20),
  -    folsom_metrics:new_histogram(?HEARTBEATS_METRIC, slide, 20),
       ets:new(?MODULE, [set, public, named_table, {keypos, 2},
                         {write_concurrency, true}, {read_concurrency, true}]).
   
  
positive.code: -define(NOW_WEIGHT, (1.0/decay_window())).
  -define(HISTORY_WEIGHT, (1.0-?NOW_WEIGHT)).
  
  -define(HEALTH_METRIC, metric_for_name(<<"health">>)).
  -define(HEARTBEATS_METRIC, metric_for_name(<<"heartbeats">>)).
  -define(INTERVALS_METRIC, metric_for_name(<<"intervals">>)).
  
  -export([init/0,
           heartbeat/1,
           stop/0,
  
negative.code:     %% The first interval may have accumulated heartbeats. Later intervals will not and can be
      %% aggregated into one step using pow.
      NAvg = ((Avg * ?HISTORY_WEIGHT) + (Hb * ?NOW_WEIGHT)) * math:pow(?HISTORY_WEIGHT, ICount-1),
      folsom_metrics:notify(app_metric(<<"health">>), NAvg, histogram),
      folsom_metrics:notify(app_metric(<<"interval">>), ICount, histogram),
      folsom_metrics:notify(app_metric(<<"heartbeat">>), Hb, histogram),
      M#metric{avg=NAvg, interval_start=NextI, heartbeats=0}.
  
  app_metric(Name) ->
      pushy_metrics:app_metric(?MODULE, Name).
  