couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [3/4] couchdb-cassim git commit: Add stats for doc migrations and metadata cache lookups
Date Tue, 21 Jul 2015 20:48:11 GMT
Add stats for doc migrations and metadata cache lookups


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

Branch: refs/heads/master
Commit: d21be8d7bded5c886b172f278bc9c955a3a25c89
Parents: 14c66b8
Author: Russell Branca <chewbranca@apache.org>
Authored: Fri Jun 26 22:18:38 2015 +0000
Committer: Russell Branca <chewbranca@apache.org>
Committed: Tue Jul 21 20:45:41 2015 +0000

----------------------------------------------------------------------
 priv/stat_descriptions.cfg    | 17 +++++++++++++++++
 src/cassim_metadata_cache.erl |  3 +++
 src/cassim_security.erl       |  4 ++++
 3 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/d21be8d7/priv/stat_descriptions.cfg
----------------------------------------------------------------------
diff --git a/priv/stat_descriptions.cfg b/priv/stat_descriptions.cfg
new file mode 100644
index 0000000..a007f7a
--- /dev/null
+++ b/priv/stat_descriptions.cfg
@@ -0,0 +1,17 @@
+{[cassim, metadata_cache, hit], [
+    {type, counter},
+    {desc, <<"number of cassim metadata cache lookup hits">>}
+]}.
+{[cassim, metadata_cache, miss], [
+    {type, counter},
+    {desc, <<"number of cassim metadata cache lookup misses">>}
+]}.
+{[cassim, security_migration, success], [
+    {type, counter},
+    {desc, <<"number of successful cassim security doc migrations">>}
+]}.
+{[cassim, security_migration, conflict], [
+    {type, counter},
+    {desc, <<"number of conflicted cassim security doc migrations">>}
+]}.
+

http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/d21be8d7/src/cassim_metadata_cache.erl
----------------------------------------------------------------------
diff --git a/src/cassim_metadata_cache.erl b/src/cassim_metadata_cache.erl
index 35b5dad..920f748 100644
--- a/src/cassim_metadata_cache.erl
+++ b/src/cassim_metadata_cache.erl
@@ -240,11 +240,14 @@ load_meta(MetaId, _UseCache=false, Db) ->
 fetch_cached_meta(MetaId) ->
     try ets:lookup(?META_TABLE, MetaId) of
         [{MetaId, Props}] ->
+            couch_stats:increment_counter([cassim, metadata_cache, hit]),
             Props;
         [] ->
+            couch_stats:increment_counter([cassim, metadata_cache, miss]),
             couch_log:notice("cache miss on metadata ~s", [MetaId]),
             undefined
         catch error:badarg ->
+            couch_stats:increment_counter([cassim, metadata_cache, miss]),
             couch_log:notice("cache miss on metadata ~s", [MetaId]),
             undefined
     end.

http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/d21be8d7/src/cassim_security.erl
----------------------------------------------------------------------
diff --git a/src/cassim_security.erl b/src/cassim_security.erl
index b9e5e0f..6afada2 100644
--- a/src/cassim_security.erl
+++ b/src/cassim_security.erl
@@ -71,8 +71,12 @@ get_security_doc(DbName0, RetryCnt) ->
             SecProps = fabric:get_security(DbName),
             try migrate_security_props(DbName, SecProps) of
                 {ok, SecDoc} ->
+                    couch_stats:increment_counter(
+                        [cassim, security_migration, success]),
                     SecDoc
             catch conflict ->
+                couch_stats:increment_counter(
+                    [cassim, security_migration, conflict]),
                 get_security_doc(DbName0, RetryCnt-1)
             end;
         {error, Error} ->


Mime
View raw message