couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [07/50] folsom commit: updated refs/heads/import-master to 4824aec
Date Thu, 31 Jul 2014 21:24:55 GMT
Remove counters from folsom counters table on delete operation


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

Branch: refs/heads/import-master
Commit: 01eb3958b73c9cd4a3a2773ebd142ccba0256ec3
Parents: 600dd78
Author: Diana Corbacho <diana.corbacho@erlang-solutions.com>
Authored: Wed May 1 15:31:01 2013 +0100
Committer: Diana Corbacho <diana.corbacho@erlang-solutions.com>
Committed: Wed May 1 15:31:01 2013 +0100

----------------------------------------------------------------------
 src/folsom_ets.erl             | 2 +-
 src/folsom_metrics_counter.erl | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-folsom/blob/01eb3958/src/folsom_ets.erl
----------------------------------------------------------------------
diff --git a/src/folsom_ets.erl b/src/folsom_ets.erl
index 8a223c5..8c1e66d 100644
--- a/src/folsom_ets.erl
+++ b/src/folsom_ets.erl
@@ -280,7 +280,7 @@ delete_metric(Name, duration) ->
     true = ets:delete(?FOLSOM_TABLE, Name),
     ok;
 delete_metric(Name, counter) ->
-    true = ets:delete(?COUNTER_TABLE, Name),
+    ok = folsom_metrics_counter:delete(Name),
     true = ets:delete(?FOLSOM_TABLE, Name),
     ok;
 delete_metric(Name, gauge) ->

http://git-wip-us.apache.org/repos/asf/couchdb-folsom/blob/01eb3958/src/folsom_metrics_counter.erl
----------------------------------------------------------------------
diff --git a/src/folsom_metrics_counter.erl b/src/folsom_metrics_counter.erl
index 1861ffe..ebef6a3 100644
--- a/src/folsom_metrics_counter.erl
+++ b/src/folsom_metrics_counter.erl
@@ -30,7 +30,8 @@
          dec/1,
          dec/2,
          get_value/1,
-         clear/1]).
+         clear/1,
+	 delete/1]).
 
 -define(WIDTH, 16). %% Keep this a power of two
 
@@ -59,6 +60,11 @@ get_value(Name) ->
 clear(Name) ->
     new(Name).
 
+delete(Name) ->
+    Counters = [{Name,N} || N <- lists:seq(0,?WIDTH-1)],
+    [ets:delete(?COUNTER_TABLE, Counter) || Counter <- Counters],
+    ok.
+
 key(Name) ->
     X = erlang:system_info(scheduler_id),
     Rnd = X band (?WIDTH-1),


Mime
View raw message