Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make safer the production of a unified stat list

The `/stats` endpoint joins the output of riak_kv_stat and
riak_core_stat into a single list. If either fails, no-stats are
returned. This commit simply gets both sets of stats in isolation
and only returns those that did not error.
  • Loading branch information...
commit f8c6cc4cb3933e7cd0d8b620be4283dbe9ca14f2 1 parent 0779788
@russelldb russelldb authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/riak_kv_wm_stats.erl
View
13 src/riak_kv_wm_stats.erl
@@ -85,5 +85,14 @@ pretty_print(RD1, C1=#ctx{}) ->
{json_pp:print(binary_to_list(list_to_binary(Json))), RD2, C2}.
get_stats() ->
- proplists:delete(disk, riak_kv_stat:get_stats()) ++
- riak_core_stat:get_stats().
+ proplists:delete(disk, get_stats(riak_kv_stat)) ++
+ get_stats(riak_core_stat).
+
+get_stats(Mod) ->
+ case Mod:get_stats() of
+ {error, Reason} ->
+ lager:error("Failed to get ~p stats~p", [Mod, Reason]),
+ [];
+ Stats ->
+ Stats
+ end.
Please sign in to comment.
Something went wrong with that request. Please try again.