couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikewall...@apache.org
Subject couch-stats commit: updated refs/heads/master to 39d5267
Date Thu, 04 Sep 2014 12:51:48 GMT
Repository: couchdb-couch-stats
Updated Branches:
  refs/heads/master 7de4f9549 -> 39d526753


Fix "Avoid recreating all metrics on reload"

This commit fixes the "fix" for reloading metrics every 10
minutes in ab8d36b3973364b3a87f90767b9fadab016ac38b by ensuring
we return the full output of load_metrics_for_applications/0 in
reload_metrics/0.


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

Branch: refs/heads/master
Commit: 39d5267535485b7db52a883d5d411483175ddcad
Parents: 7de4f95
Author: Mike Wallace <mikewallace@apache.org>
Authored: Thu Sep 4 13:12:06 2014 +0100
Committer: Mike Wallace <mikewallace1979@googlemail.com>
Committed: Thu Sep 4 13:17:14 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/blob/39d52675/src/couch_stats_aggregator.erl
----------------------------------------------------------------------
diff --git a/src/couch_stats_aggregator.erl b/src/couch_stats_aggregator.erl
index 456af76..da0cc2b 100644
--- a/src/couch_stats_aggregator.erl
+++ b/src/couch_stats_aggregator.erl
@@ -79,10 +79,16 @@ terminate(_Reason, _State) ->
 code_change(_OldVsn, State, _Extra) ->
     {ok, State}.
 
+comparison_set(Metrics) ->
+    sets:from_list(
+        [{Name, proplists:get_value(type, Props)} || {Name, Props} <- Metrics]
+    ).
+
 reload_metrics() ->
     Current = load_metrics_for_applications(),
-    CurrentSet = sets:from_list(Current),
-    ExistingSet = sets:from_list(couch_stats:list()),
+    CurrentSet = comparison_set(Current),
+    Existing = couch_stats:list(),
+    ExistingSet = comparison_set(Existing),
     ToDelete = sets:subtract(ExistingSet, CurrentSet),
     ToCreate = sets:subtract(CurrentSet, ExistingSet),
     sets:fold(
@@ -91,8 +97,7 @@ reload_metrics() ->
         ToDelete
     ),
     sets:fold(
-        fun({Name, Props}, _) ->
-            Type = proplists:get_value(type, Props),
+        fun({Name, Type}, _) ->
             couch_stats:new(Type, Name),
             nil
         end,


Mime
View raw message