Simplify stat reloading functionality
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/commit/870e2849 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/tree/870e2849 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/diff/870e2849 Branch: refs/heads/master Commit: 870e28498cf4699ba3633c4a5998c10e8cb3c930 Parents: dfc415c Author: Benjamin Anderson <b...@banjiewen.net> Authored: Tue Feb 4 16:02:25 2014 -0800 Committer: Robert Newson <rnew...@apache.org> Committed: Tue Aug 19 14:48:31 2014 +0100 ---------------------------------------------------------------------- src/couch_stats_aggregator.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/blob/870e2849/src/couch_stats_aggregator.erl ---------------------------------------------------------------------- diff --git a/src/couch_stats_aggregator.erl b/src/couch_stats_aggregator.erl index fae59f1..9615bf7 100644 --- a/src/couch_stats_aggregator.erl +++ b/src/couch_stats_aggregator.erl @@ -71,11 +71,11 @@ reload_metrics() -> Existing = couch_stats:list(), Current = load_metrics_for_applications(), ToDelete = lists:foldl( - fun({_, {Name, [{type, Type}, _]}}, Acc) -> - E = {Name, [{type, Type}]}, - case sets:is_element(E, Acc) of + fun({Name, Props}=Stat, Acc) -> + Type = proplists:get_value(type, Props), + case sets:is_element(Stat, Acc) of true -> - sets:del_element(E, Acc); + sets:del_element(Stat, Acc); false -> couch_stats:new(Type, Name), Acc