summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiana Corbacho <diana@rabbitmq.com>2017-03-07 10:06:26 +0000
committerDiana Corbacho <diana@rabbitmq.com>2017-03-07 10:19:31 +0000
commit183d0e5c5b605af86e8abcf9675c452b97f0f78f (patch)
treefd74841af46050d57f215b7b31b407bf9c6aea6f /src
parent48072079619e1e2a27c74735db68c7066975e9c3 (diff)
downloadrabbitmq-server-git-183d0e5c5b605af86e8abcf9675c452b97f0f78f.tar.gz
Test and clean up metrics dependent on both process and entity
It leaked consumer_created when the queue still existed, now both entity and process must exists to keep the metrics.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_core_metrics_gc.erl15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/rabbit_core_metrics_gc.erl b/src/rabbit_core_metrics_gc.erl
index 99a8058bde..3141fdc301 100644
--- a/src/rabbit_core_metrics_gc.erl
+++ b/src/rabbit_core_metrics_gc.erl
@@ -64,7 +64,6 @@ gc_connections() ->
gc_process(connection_coarse_metrics).
gc_channels() ->
- %% TODO channel stats
gc_process(channel_created),
gc_process(channel_metrics),
gc_process(channel_process_metrics),
@@ -107,7 +106,6 @@ gc_process(Pid, Table, Key) ->
true ->
none;
false ->
- %% TODO catch?
ets:delete(Table, Key),
none
end.
@@ -128,7 +126,6 @@ gc_entity(Id, Table, Key, GbSet) ->
true ->
none;
false ->
- %% TODO catch?
ets:delete(Table, Key),
none
end.
@@ -136,26 +133,22 @@ gc_entity(Id, Table, Key, GbSet) ->
gc_process_and_entity(Table, GbSet) ->
ets:foldl(fun({{Pid, Id} = Key, _, _, _, _, _, _, _}, none)
when Table == channel_queue_metrics ->
- gc_entity(Id, Table, Key, GbSet),
- gc_process(Pid, Table, Key);
+ gc_process_and_entity(Id, Pid, Table, Key, GbSet);
({{Pid, Id} = Key, _, _, _, _}, none)
when Table == channel_exchange_metrics ->
- gc_entity(Id, Table, Key, GbSet),
- gc_process(Pid, Table, Key);
+ gc_process_and_entity(Id, Pid, Table, Key, GbSet);
({{Id, Pid, _} = Key, _, _, _, _}, none)
when Table == consumer_created ->
- gc_entity(Id, Table, Key, GbSet),
- gc_process(Pid, Table, Key);
+ gc_process_and_entity(Id, Pid, Table, Key, GbSet);
({{{Pid, Id}, _} = Key, _, _, _, _}, none) ->
gc_process_and_entity(Id, Pid, Table, Key, GbSet)
end, none, Table).
gc_process_and_entity(Id, Pid, Table, Key, GbSet) ->
- case rabbit_misc:is_process_alive(Pid) orelse gb_sets:is_member(Id, GbSet) of
+ case rabbit_misc:is_process_alive(Pid) andalso gb_sets:is_member(Id, GbSet) of
true ->
none;
false ->
- %% TODO catch?
ets:delete(Table, Key),
none
end.