Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix stat names so delete of stats on restart works

Folsom can get inconsistent. When it does stat updates will fail.
When a stat update fails the stat server crashes. Deleting on
start up is a way to get folsom consistent again.

This commit fixes a bug where the api stats were not all
deleted due to using the wrong stat name format.
  • Loading branch information...
commit cb04457db960a05c19a96e1dc5759772813bdd28 1 parent 916251e
@russelldb russelldb authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/riak_api_stat.erl
7 src/riak_api_stat.erl
@@ -45,8 +45,11 @@ start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
register_stats() ->
- [(catch folsom_metrics:delete_metric({?APP, Name})) || {Name, _Type} <- stats()],
- [register_stat(stat_name(Stat), Type) || {Stat, Type} <- stats()],
+ [begin
+ StatName = stat_name(Name),
+ (catch folsom_metrics:delete_metric(StatName)),
+ register_stat(StatName, Type)
+ end || {Name, Type} <- stats()],
riak_core_stat_cache:register_app(?APP, {?MODULE, produce_stats, []}).
%% @doc Return current aggregation of all stats.

5 comments on commit cb04457


This is unrelated to this one change, but the function clause in stat_name that handles a list input (which we never pass to it currently since there are no string names returned by stats()) seems wrong. If you were to pass an string, it would create a tuple with each character as an element because of list_to_tuple([?APP] ++ Name). Maybe remove if not used or clarify what it expects?


There a list stat names, see

It is just to save going list_to_tuple([?APP] ++ tuple_to_list(Name))


Hmmm... disregard the comment above. I see that you intend to use it only with list of atoms, which works. A note might be nice for the next set of eyes on this code, but it's very minor.


Ohai, what are you doing still around? :)
This small change looks good and obvious besides that distracting comment of mine above :+1: :dancer:


Just popped in. Heading off again, thanks.

Please sign in to comment.
Something went wrong with that request. Please try again.