@@ -2929,34 +2929,54 @@ channel_statistics1(_Config) ->
29292929
29302930 % % Check the stats reflect that
29312931 Check2 = fun () ->
2932- [{{Ch , QRes }, 1 , 0 , 0 , 0 , 0 , 0 }] = ets :lookup (
2933- channel_queue_metrics ,
2934- {Ch , QRes }),
2935- [{{Ch , X }, 1 , 0 , 0 }] = ets :lookup (
2936- channel_exchange_metrics ,
2937- {Ch , X }),
2938- [{{Ch , {QRes , X }}, 1 }] = ets :lookup (
2939- channel_queue_exchange_metrics ,
2940- {Ch , {QRes , X }})
2932+ [{{Ch , QRes }, 1 , 0 , 0 , 0 , 0 , 0 , 0 }] = ets :lookup (
2933+ channel_queue_metrics ,
2934+ {Ch , QRes }),
2935+ [{{Ch , X }, 1 , 0 , 0 , 0 }] = ets :lookup (
2936+ channel_exchange_metrics ,
2937+ {Ch , X }),
2938+ [{{Ch , {QRes , X }}, 1 , 0 }] = ets :lookup (
2939+ channel_queue_exchange_metrics ,
2940+ {Ch , {QRes , X }})
29412941 end ,
29422942 test_ch_metrics (Check2 , ? TIMEOUT ),
29432943
2944- % % Check the stats remove stuff on queue deletion
2944+ % % Check the stats are marked for removal on queue deletion.
29452945 rabbit_channel :do (Ch , # 'queue.delete' {queue = QName }),
29462946 Check3 = fun () ->
2947+ [{{Ch , QRes }, 1 , 0 , 0 , 0 , 0 , 0 , 1 }] = ets :lookup (
2948+ channel_queue_metrics ,
2949+ {Ch , QRes }),
2950+ [{{Ch , X }, 1 , 0 , 0 , 0 }] = ets :lookup (
2951+ channel_exchange_metrics ,
2952+ {Ch , X }),
2953+ [{{Ch , {QRes , X }}, 1 , 1 }] = ets :lookup (
2954+ channel_queue_exchange_metrics ,
2955+ {Ch , {QRes , X }})
2956+ end ,
2957+ test_ch_metrics (Check3 , ? TIMEOUT ),
2958+
2959+ % % Check the garbage collection removes stuff.
2960+ force_metric_gc (),
2961+ Check4 = fun () ->
29472962 [] = ets :lookup (channel_queue_metrics , {Ch , QRes }),
2948- [{{Ch , X }, 1 , 0 , 0 }] = ets :lookup (
2949- channel_exchange_metrics ,
2950- {Ch , X }),
2963+ [{{Ch , X }, 1 , 0 , 0 , 0 }] = ets :lookup (
2964+ channel_exchange_metrics ,
2965+ {Ch , X }),
29512966 [] = ets :lookup (channel_queue_exchange_metrics ,
29522967 {Ch , {QRes , X }})
29532968 end ,
2954- test_ch_metrics (Check3 , ? TIMEOUT ),
2969+ test_ch_metrics (Check4 , ? TIMEOUT ),
29552970
29562971 rabbit_channel :shutdown (Ch ),
29572972 dummy_event_receiver :stop (),
29582973 passed .
29592974
2975+ force_metric_gc () ->
2976+ timer :sleep (300 ),
2977+ rabbit_core_metrics_gc ! start_gc ,
2978+ gen_server :call (rabbit_core_metrics_gc , test ).
2979+
29602980test_ch_metrics (Fun , Timeout ) when Timeout =< 0 ->
29612981 Fun ();
29622982test_ch_metrics (Fun , Timeout ) ->
0 commit comments