You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/08/21 09:04:33 UTC

couch-mrview commit: updated refs/heads/windsor-merge to 2c41c9d

Repository: couchdb-couch-mrview
Updated Branches:
  refs/heads/windsor-merge ad72dc84b -> 2c41c9d31


Update to use couch_stats


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/2c41c9d3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/2c41c9d3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/2c41c9d3

Branch: refs/heads/windsor-merge
Commit: 2c41c9d31a287f037fde00181525ddd9570f2634
Parents: ad72dc8
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Aug 21 02:04:07 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Thu Aug 21 02:04:28 2014 -0500

----------------------------------------------------------------------
 src/couch_mrview.app.src     | 2 +-
 src/couch_mrview_http.erl    | 9 +++++----
 src/couch_mrview_updater.erl | 1 +
 3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2c41c9d3/src/couch_mrview.app.src
----------------------------------------------------------------------
diff --git a/src/couch_mrview.app.src b/src/couch_mrview.app.src
index 99c52f0..4da46f9 100644
--- a/src/couch_mrview.app.src
+++ b/src/couch_mrview.app.src
@@ -24,5 +24,5 @@
         couch_mrview_util
     ]},
     {registered, []},
-    {applications, [kernel, stdlib, couch_index]}
+    {applications, [kernel, stdlib, couch_index, couch_stats]}
 ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2c41c9d3/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 4c7355d..4ae72f3 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -49,7 +49,7 @@ handle_all_docs_req(Req, _Db) ->
 
 handle_view_req(#httpd{method='GET'}=Req, Db, DDoc) ->
     [_, _, _, _, ViewName] = Req#httpd.path_parts,
-    couch_stats_collector:increment({httpd, view_reads}),
+    couch_stats:increment_counter([httpd, view_reads]),
     design_doc_view(Req, Db, DDoc, ViewName, undefined);
 handle_view_req(#httpd{method='POST'}=Req, Db, DDoc) ->
     [_, _, _, _, ViewName] = Req#httpd.path_parts,
@@ -58,10 +58,11 @@ handle_view_req(#httpd{method='POST'}=Req, Db, DDoc) ->
     Queries = couch_mrview_util:get_view_queries(Props),
     case {Queries, Keys} of
         {Queries, undefined} when is_list(Queries) ->
-            [couch_stats_collector:increment({httpd, view_reads}) || _I <- Queries],
+            IncrBy = length(Queries),
+            couch_stats:increment_counter([couchdb, httpd, view_reads], IncrBy),
             multi_query_view(Req, Db, DDoc, ViewName, Queries);
         {undefined, Keys} when is_list(Keys) ->
-            couch_stats_collector:increment({httpd, view_reads}),
+            couch_stats:increment_counter([couchdb, httpd, view_reads]),
             design_doc_view(Req, Db, DDoc, ViewName, Keys);
         {undefined, undefined} ->
             throw({
@@ -81,7 +82,7 @@ handle_temp_view_req(#httpd{method='POST'}=Req, Db) ->
     {Body} = couch_httpd:json_body_obj(Req),
     DDoc = couch_mrview_util:temp_view_to_ddoc({Body}),
     Keys = couch_mrview_util:get_view_keys({Body}),
-    couch_stats_collector:increment({httpd, temporary_view_reads}),
+    couch_stats:increment_counter([couchdb, httpd, temporary_view_reads]),
     design_doc_view(Req, Db, DDoc, <<"temp">>, Keys);
 handle_temp_view_req(Req, _Db) ->
     couch_httpd:send_method_not_allowed(Req, "POST").

http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2c41c9d3/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index 7aee110..362df0e 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -241,6 +241,7 @@ insert_results(DocId, [KVs | RKVs], [{Id, VKVs} | RVKVs], VKVAcc, VIdKeys) ->
             {[KV | Rest], [{Id, Key} | IdKeys]}
     end,
     InitAcc = {[], VIdKeys},
+    couch_stats:increment_counter([couchdb, couchjs, emits], length(KVs)),
     {Duped, VIdKeys0} = lists:foldl(CombineDupesFun, InitAcc, lists:sort(KVs)),
     FinalKVs = [{{Key, DocId}, Val} || {Key, Val} <- Duped] ++ VKVs,
     insert_results(DocId, RKVs, RVKVs, [{Id, FinalKVs} | VKVAcc], VIdKeys0).