couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/2] couch-stats commit: updated refs/heads/master to 20912b3
Date Mon, 12 Jan 2015 22:51:16 GMT
Repository: couchdb-couch-stats
Updated Branches:
  refs/heads/master 1bcffbdd2 -> 20912b3e0


Add couch_stats:reload()

Since couch_stats relies on application:loaded_applications/0 we need a
way to force reload of metrics' definitions. Ability to force reload is
used from a test suite to make sure we have all metrics' definitions
prior to test invocation.

COUCHDB-2540


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

Branch: refs/heads/master
Commit: 0be906a14dc8c2035c494032a7117921d1326308
Parents: 1bcffbd
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Fri Jan 9 14:27:08 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Fri Jan 9 14:27:08 2015 -0800

----------------------------------------------------------------------
 src/couch_stats.erl            | 4 ++++
 src/couch_stats_aggregator.erl | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/blob/0be906a1/src/couch_stats.erl
----------------------------------------------------------------------
diff --git a/src/couch_stats.erl b/src/couch_stats.erl
index 59854e2..d65ea6a 100644
--- a/src/couch_stats.erl
+++ b/src/couch_stats.erl
@@ -16,6 +16,7 @@
     start/0,
     stop/0,
     fetch/0,
+    reload/0,
     sample/1,
     new/2,
     delete/1,
@@ -40,6 +41,9 @@ stop() ->
 fetch() ->
     couch_stats_aggregator:fetch().
 
+reload() ->
+    couch_stats_aggregator:reload().
+
 -spec sample(any()) -> stat().
 sample(Name) ->
     [{Name, Info}] = folsom_metrics:get_metric_info(Name),

http://git-wip-us.apache.org/repos/asf/couchdb-couch-stats/blob/0be906a1/src/couch_stats_aggregator.erl
----------------------------------------------------------------------
diff --git a/src/couch_stats_aggregator.erl b/src/couch_stats_aggregator.erl
index da0cc2b..19b525c 100644
--- a/src/couch_stats_aggregator.erl
+++ b/src/couch_stats_aggregator.erl
@@ -16,7 +16,8 @@
 
 -export([
     fetch/0,
-    flush/0
+    flush/0,
+    reload/0
 ]).
 
 -export([
@@ -43,6 +44,9 @@ fetch() ->
 flush() ->
     gen_server:call(?MODULE, flush).
 
+reload() ->
+    gen_server:call(?MODULE, reload).
+
 start_link() ->
     gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
 
@@ -59,6 +63,9 @@ handle_call(fetch, _from, #st{stats = Stats}=State) ->
     {reply, {ok, Stats}, State};
 handle_call(flush, _From, State) ->
     {reply, ok, collect(State)};
+handle_call(reload, _from, #st{stats = Stats}=State) ->
+    {ok, Descriptions} = reload_metrics(),
+    {reply, ok, State#st{descriptions=Descriptions}};
 handle_call(Msg, _From, State) ->
     {stop, {unknown_call, Msg}, error, State}.
 


Mime
View raw message