anchor.diff:  register_stats() ->
       [(catch folsom_metrics:delete_metric(Stat)) || Stat <- folsom_metrics:get_metrics(),
                                                              is_tuple(Stat), element(1, Stat) == ?APP],
  -    [register_stat(stat_name(Name), Type) || {Name, Type} <- stats()],
  +    [do_register_stat(stat_name(Name), Type) || {Name, Type} <- stats()],
       riak_core_stat_cache:register_app(?APP, {?MODULE, produce_stats, []}).
   
   %% @spec get_stats() -> proplist()
  
positive.code:     register_stats(),
      {ok, ok}.
  
  handle_call(_Req, _From, State) ->
      {reply, ok, State}.
  
  handle_cast({update, Arg}, State) ->
      do_update(Arg),
  
negative.code:         Error -> Error
      end.
  
  %% Creation of a dynamic stat _must_ be serialized.
  register_stat(Name, Type) ->
      gen_server:call(?SERVER, {register, Name, Type}).
  
  update(Arg) ->
      %% Large message queues on heavily loaded nodes
      %% mean calling folsom direct, rather than casting here.
      %% We catch the update so a failed stat update
      %% does not fail a read / write to riak.
      try do_update(Arg) of
          _ ->
              ok
      catch
          ErrClass:Err ->
              lager:error("~p:~p updating stat ~p.", [ErrClass, Err, Arg])
      end.
  
  track_bucket(Bucket) when is_binary(Bucket) ->
      riak_core_bucket:set_bucket(Bucket, [{stat_tracked, true}]).
  