couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject ddoc-cache commit: updated refs/heads/windsor-merge to 4ffc6b0
Date Thu, 21 Aug 2014 06:49:53 GMT
Repository: couchdb-ddoc-cache
Updated Branches:
  refs/heads/windsor-merge d9bc36ff4 -> 4ffc6b000


Update to use couch_stats


Project: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/commit/4ffc6b00
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/tree/4ffc6b00
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/diff/4ffc6b00

Branch: refs/heads/windsor-merge
Commit: 4ffc6b00031a1dea42bd8b549fc32d6918c41396
Parents: d9bc36f
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu Aug 21 01:49:43 2014 -0500
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Thu Aug 21 01:49:43 2014 -0500

----------------------------------------------------------------------
 priv/stats_descriptions.cfg | 12 ++++++++++++
 src/ddoc_cache.app.src      |  3 ++-
 src/ddoc_cache.erl          |  9 +++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/blob/4ffc6b00/priv/stats_descriptions.cfg
----------------------------------------------------------------------
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
new file mode 100644
index 0000000..f769a97
--- /dev/null
+++ b/priv/stats_descriptions.cfg
@@ -0,0 +1,12 @@
+{[ddoc_cache, hit], [
+    {type, counter},
+    {desc, <<"number of design doc cache hits">>}
+]}.
+{[ddoc_cache, miss], [
+    {type, counter},
+    {desc, <<"number of design doc cache misses">>}
+]}.
+{[ddoc_cache, recovery], [
+    {type, counter},
+    {desc, <<"number of design doc cache recoveries">>}
+]}.

http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/blob/4ffc6b00/src/ddoc_cache.app.src
----------------------------------------------------------------------
diff --git a/src/ddoc_cache.app.src b/src/ddoc_cache.app.src
index 7d03bdf..a64b2f5 100644
--- a/src/ddoc_cache.app.src
+++ b/src/ddoc_cache.app.src
@@ -32,7 +32,8 @@
         ets_lru,
         mem3,
         fabric,
-        couch_log
+        couch_log,
+        couch_stats
     ]},
     {mod, {ddoc_cache_app, []}},
     {env, [

http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/blob/4ffc6b00/src/ddoc_cache.erl
----------------------------------------------------------------------
diff --git a/src/ddoc_cache.erl b/src/ddoc_cache.erl
index 40d9467..6aa3efd 100644
--- a/src/ddoc_cache.erl
+++ b/src/ddoc_cache.erl
@@ -37,10 +37,13 @@ open_doc(DbName, DocId) ->
     Key = {DbName, DocId, '_'},
     case ddoc_cache_opener:match_newest(Key) of
         {ok, _} = Resp ->
+            couch_stats:increment_counter([ddoc_cache, hit]),
             Resp;
         missing ->
+            couch_stats:increment_counter([ddoc_cache, miss]),
             ddoc_cache_opener:open_doc(DbName, DocId);
         recover ->
+            couch_stats:increment_counter([ddoc_cache, recovery]),
             ddoc_cache_opener:recover_doc(DbName, DocId)
     end.
 
@@ -48,10 +51,13 @@ open_doc(DbName, DocId, RevId) ->
     Key = {DbName, DocId, RevId},
     case ddoc_cache_opener:lookup(Key) of
         {ok, _} = Resp ->
+            couch_stats:increment_counter([ddoc_cache, hit]),
             Resp;
         missing ->
+            couch_stats:increment_counter([ddoc_cache, miss]),
             ddoc_cache_opener:open_doc(DbName, DocId, RevId);
         recover ->
+            couch_stats:increment_counter([ddoc_cache, recovery]),
             ddoc_cache_opener:recover_doc(DbName, DocId, RevId)
     end.
 
@@ -59,10 +65,13 @@ open_validation_funs(DbName) ->
     Key = {DbName, validation_funs},
     case ddoc_cache_opener:lookup(Key) of
         {ok, _} = Resp ->
+            couch_stats:increment_counter([ddoc_cache, hit]),
             Resp;
         missing ->
+            couch_stats:increment_counter([ddoc_cache, mis]),
             ddoc_cache_opener:open_validation_funs(DbName);
         recover ->
+            couch_stats:increment_counter([ddoc_cache, recovery]),
             ddoc_cache_opener:recover_validation_funs(DbName)
     end.
 


Mime
View raw message