anchor.diff:  %% @end
   %%--------------------------------------------------------------------
   init([]) ->
  +    %% We want a high priority so we don't get scheduled back and have false
  +    %% reporting.
  +    process_flag(priority, high),
       ets:new(?COUNTERS_MPS, [named_table, set, public, {write_concurrency, true}]),
       {ok, N} = application:get_env(dalmatiner_db, n),
       {ok, W} = application:get_env(dalmatiner_db, w),
       erlang:send_after(?INTERVAL, self(), tick),
       lager:info("[metrics] Initializing metric watcher with N: ~p, W: ~p at an "
                  "interval of ~pms.", [N, W, ?INTERVAL]),
  -    {ok, #state{n=N, w=W, prefix = list_to_binary(atom_to_list(node()))}}.
  +    PPF = metric:ppf(?BUCKET),
  +    {ok, #state{n=N, w=W, prefix = list_to_binary(atom_to_list(node())),
  +                ppf = PPF}}.
   
   
   %%--------------------------------------------------------------------
  
positive.code: %%% Internal functions
  %%%===================================================================
  
  %do_metrics(CBin, Time, Specs, Acc) ->
  do_metrics(_Prefix, _CBin, _Time, [], Acc) ->
      Acc;
  
  do_metrics(Prefix, CBin, Time, [{N, [{type, histogram}]} | Spec], Acc) ->
      Stats = folsom_metrics:get_histogram_statistics(N),
      Prefix1 = [Prefix, metric_name(N)],
      Acc1 = build_histogram(Stats, Prefix1, Time, CBin, Acc),
      do_metrics(Prefix, CBin, Time, Spec, Acc1);
  
  do_metrics(Prefix, CBin, Time, [{N, [{type, spiral}]} | Spec], Acc) ->
      [{count, Count}, {one, One}] = folsom_metrics:get_metric_value(N),
      K = metric_name(N),
      Acc1 = add_metric(Prefix, CBin, [K, <<"count">>], Time, Count, Acc),
      Acc2 = add_metric(Prefix, CBin, [K, <<"one">>], Time, One, Acc1),
      do_metrics(Prefix, CBin, Time, Spec, Acc2);
  
  
  do_metrics(Prefix, CBin, Time, [{N, [{type, counter}]} | Spec], Acc) ->
      Count = folsom_metrics:get_metric_value(N),
      Acc1 = add_metric(Prefix, CBin, N, Time, Count, Acc),
      do_metrics(Prefix, CBin, Time, Spec, Acc1);
  
  do_metrics(Prefix, CBin, Time, [{N, [{type, duration}]} | Spec], Acc) ->
      Stats = folsom_metrics:get_metric_value(N),
      Prefix1 = [Prefix, metric_name(N)],
      Acc1 = build_histogram(Stats, Prefix1, Time, CBin, Acc),
      do_metrics(Prefix, CBin, Time, Spec, Acc1);
  
  
  do_metrics(Prefix, CBin, Time, [{N, [{type, meter}]} | Spec], Acc) ->
      Prefix1 = [Prefix, metric_name(N)],
      [{count, Count},
       {one, One},
  
negative.code: -define(COUNTERS_MPS, ddb_counters_mps).
  
  
  -record(state, {n, w, prefix, ppf}).
  
  %%%===================================================================
  %%% API
  