Update to use couch_stats
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
new file mode 100644
index 0000000..a564dd9
--- /dev/null
+++ b/priv/stats_descriptions.cfg
@@ -0,0 +1,12 @@
+{[dbcore, mem3, shard_cache, eviction], [
+ {type, counter},
+ {desc, <<"number of shard cache evictions">>}
+]}.
+{[dbcore, mem3, shard_cache, hit], [
+ {type, counter},
+ {desc, <<"number of shard cache hits">>}
+]}.
+{[dbcore, mem3, shard_cache, miss], [
+ {type, counter},
+ {desc, <<"number of shard cache misses">>}
+]}.
diff --git a/src/mem3.app.src b/src/mem3.app.src
index 79f2119..87eda0d 100644
--- a/src/mem3.app.src
+++ b/src/mem3.app.src
@@ -46,6 +46,7 @@
couch,
rexi,
couch_log,
- couch_event
+ couch_event,
+ couch_stats
]}
]}.
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index 4557e1c..b0d22ac 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -158,11 +158,14 @@
{noreply, St}.
handle_cast({cache_hit, DbName}, St) ->
+ couch_stats:increment_counter([dbcore, mem3, shard_cache, hit]),
cache_hit(DbName),
{noreply, St};
handle_cast({cache_insert, DbName, Shards}, St) ->
+ couch_stats:increment_counter([dbcore, mem3, shard_cache, miss]),
{noreply, cache_free(cache_insert(St, DbName, Shards))};
handle_cast({cache_remove, DbName}, St) ->
+ couch_stats:increment_counter([dbcore, mem3, shard_cache, eviction]),
{noreply, cache_remove(St, DbName)};
handle_cast(_Msg, St) ->
{noreply, St}.