You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/09/03 22:54:06 UTC

couch-stats commit: updated refs/heads/master to 7de4f95

Repository: couchdb-couch-stats
Updated Branches:
  refs/heads/master ab8d36b39 -> 7de4f9549


Revert "Avoid recreating all metrics on reload"

This reverts commit ab8d36b3973364b3a87f90767b9fadab016ac38b.


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/7de4f954
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/tree/7de4f954
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/diff/7de4f954

Branch: refs/heads/master
Commit: 7de4f9549f71b540899a6e9683ca75cc07b1fcfa
Parents: ab8d36b
Author: Robert Newson <rn...@apache.org>
Authored: Wed Sep 3 21:53:58 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Sep 3 21:53:58 2014 +0100

----------------------------------------------------------------------
 src/couch_stats_aggregator.erl | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/blob/7de4f954/src/couch_stats_aggregator.erl
----------------------------------------------------------------------
diff --git a/src/couch_stats_aggregator.erl b/src/couch_stats_aggregator.erl
index 64e7fa9..456af76 100644
--- a/src/couch_stats_aggregator.erl
+++ b/src/couch_stats_aggregator.erl
@@ -79,14 +79,10 @@ terminate(_Reason, _State) ->
 code_change(_OldVsn, State, _Extra) ->
     {ok, State}.
 
-props_to_type({Name, Props}) ->
-    {Name, proplists:get_value(type, Props)}.
-
 reload_metrics() ->
-    Current = lists:map(fun props_to_type/1, load_metrics_for_applications()),
+    Current = load_metrics_for_applications(),
     CurrentSet = sets:from_list(Current),
-    Existing = lists:map(fun props_to_type/1, couch_stats:list()),
-    ExistingSet = sets:from_list(Existing),
+    ExistingSet = sets:from_list(couch_stats:list()),
     ToDelete = sets:subtract(ExistingSet, CurrentSet),
     ToCreate = sets:subtract(CurrentSet, ExistingSet),
     sets:fold(
@@ -95,7 +91,8 @@ reload_metrics() ->
         ToDelete
     ),
     sets:fold(
-        fun({Name, Type}, _) ->
+        fun({Name, Props}, _) ->
+            Type = proplists:get_value(type, Props),
             couch_stats:new(Type, Name),
             nil
         end,