Replace cache miss log with metrics This also adds metrics for cache hits and evictions as well as the miss.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/20087f2b Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/20087f2b Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/20087f2b Branch: refs/heads/import Commit: 20087f2b686fb590cec0781c30607a8dd7271f9f Parents: 755759e Author: Paul J. Davis <paul.joseph.da...@gmail.com> Authored: Sun Feb 10 15:30:49 2013 -0600 Committer: Paul J. Davis <paul.joseph.da...@gmail.com> Committed: Thu Feb 21 00:05:50 2013 -0600 ---------------------------------------------------------------------- src/mem3_shards.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/20087f2b/src/mem3_shards.erl ---------------------------------------------------------------------- diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl index 5ef575e..9443a00 100644 --- a/src/mem3_shards.erl +++ b/src/mem3_shards.erl @@ -129,11 +129,14 @@ handle_call(_Call, _From, St) -> {noreply, St}. handle_cast({cache_hit, DbName}, St) -> + margaret_counter:increment([dbcore, mem3, shard_cache, hit]), cache_hit(DbName), {noreply, St}; handle_cast({cache_insert, DbName, Shards}, St) -> + margaret_counter:increment([dbcore, mem3, shard_cache, miss]), {noreply, cache_free(cache_insert(St, DbName, Shards))}; handle_cast({cache_remove, DbName}, St) -> + margaret_counter:increment([dbcore, mem3, shard_cache, eviction]), {noreply, cache_remove(St, DbName)}; handle_cast(_Msg, St) -> {noreply, St}. @@ -236,7 +239,6 @@ load_shards_from_disk(DbName) when is_binary(DbName) -> load_shards_from_db(#db{} = ShardDb, DbName) -> case couch_db:open_doc(ShardDb, DbName, []) of {ok, #doc{body = {Props}}} -> - twig:log(notice, "dbs cache miss for ~s", [DbName]), Shards = mem3_util:build_shards(DbName, Props), gen_server:cast(?MODULE, {cache_insert, DbName, Shards}), Shards;