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/12/04 21:09:48 UTC

[17/22] couch commit: updated refs/heads/2491-refactor-couch-httpd-auth to 3e8286d

Count the number of rejections by validate_doc_update functions


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

Branch: refs/heads/2491-refactor-couch-httpd-auth
Commit: 3e32256cf6922679a9ab3567fb84a83c25641073
Parents: 0c0b438
Author: Alexander Shorin <kx...@apache.org>
Authored: Fri Oct 31 22:13:19 2014 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Mon Nov 3 12:19:54 2014 +0300

----------------------------------------------------------------------
 priv/stats_descriptions.cfg |  4 ++++
 src/couch_query_servers.erl | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/3e32256c/priv/stats_descriptions.cfg
----------------------------------------------------------------------
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
index 53aca37..3f771d2 100644
--- a/priv/stats_descriptions.cfg
+++ b/priv/stats_descriptions.cfg
@@ -182,3 +182,7 @@
     {type, counter},
     {desc, <<"number of couch_server LRU operations skipped">>}
 ]}.
+{[couchdb, query_server, vdu_rejects], [
+    {type, counter},
+    {desc, <<"number of rejections by validate_doc_update function">>}
+]}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/3e32256c/src/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couch_query_servers.erl b/src/couch_query_servers.erl
index d38f040..c99f673 100644
--- a/src/couch_query_servers.erl
+++ b/src/couch_query_servers.erl
@@ -260,7 +260,16 @@ get_number(Key, Props) ->
 validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) ->
     JsonEditDoc = couch_doc:to_json_obj(EditDoc, [revs]),
     JsonDiskDoc = json_doc(DiskDoc),
-    case ddoc_prompt(DDoc, [<<"validate_doc_update">>], [JsonEditDoc, JsonDiskDoc, Ctx, SecObj]) of
+    Resp = ddoc_prompt(DDoc,
+                       [<<"validate_doc_update">>],
+                       [JsonEditDoc, JsonDiskDoc, Ctx, SecObj]),
+    case Resp of
+        _ when Resp /= 1 ->
+            couch_stats:increment_counter(
+                [couchdb, query_server, vdu_rejects], 1);
+        _ -> ok
+    end,
+    case Resp of
         1 ->
             ok;
         {[{<<"forbidden">>, Message}]} ->