You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/06/27 00:40:42 UTC
[3/3] couchdb-cassim git commit: Add stats for doc migrations and
metadata cache lookups
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/0d081d4d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/tree/0d081d4d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/diff/0d081d4d
Branch: refs/heads/add-manual-migration-logic
Commit: 0d081d4d7d9d6406fb489dc2d6b6557ead313347
Parents: 1e381e6
Author: Russell Branca <ch...@apache.org>
Authored: Fri Jun 26 22:18:38 2015 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Fri Jun 26 22:31:06 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/0d081d4d/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/0d081d4d/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/0d081d4d/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} ->