4040
4141-export ([queue_stats /2 ,
4242 queue_stats /5 ,
43+ queue_declared /1 ,
44+ queue_created /1 ,
4345 queue_deleted /1 ,
4446 queues_deleted /1 ]).
4547
@@ -113,13 +115,17 @@ terminate() ->
113115
114116connection_created (Pid , Infos ) ->
115117 ets :insert (connection_created , {Pid , Infos }),
118+ ets :update_counter (connection_churn_metrics , node (), {2 , 1 },
119+ ? CONNECTION_CHURN_METRICS ),
116120 ok .
117121
118122connection_closed (Pid ) ->
119123 ets :delete (connection_created , Pid ),
120124 ets :delete (connection_metrics , Pid ),
121125 % % Delete marker
122126 ets :update_element (connection_coarse_metrics , Pid , {5 , 1 }),
127+ ets :update_counter (connection_churn_metrics , node (), {3 , 1 },
128+ ? CONNECTION_CHURN_METRICS ),
123129 ok .
124130
125131connection_stats (Pid , Infos ) ->
@@ -133,12 +139,16 @@ connection_stats(Pid, Recv_oct, Send_oct, Reductions) ->
133139
134140channel_created (Pid , Infos ) ->
135141 ets :insert (channel_created , {Pid , Infos }),
142+ ets :update_counter (connection_churn_metrics , node (), {4 , 1 },
143+ ? CONNECTION_CHURN_METRICS ),
136144 ok .
137145
138146channel_closed (Pid ) ->
139147 ets :delete (channel_created , Pid ),
140148 ets :delete (channel_metrics , Pid ),
141149 ets :delete (channel_process_metrics , Pid ),
150+ ets :update_counter (connection_churn_metrics , node (), {5 , 1 },
151+ ? CONNECTION_CHURN_METRICS ),
142152 ok .
143153
144154channel_stats (Pid , Infos ) ->
@@ -233,8 +243,22 @@ queue_stats(Name, MessagesReady, MessagesUnacknowledge, Messages, Reductions) ->
233243 Messages , Reductions }),
234244 ok .
235245
246+ queue_declared (_Name ) ->
247+ % % Name is not needed, but might be useful in the future.
248+ ets :update_counter (connection_churn_metrics , node (), {6 , 1 },
249+ ? CONNECTION_CHURN_METRICS ),
250+ ok .
251+
252+ queue_created (_Name ) ->
253+ % % Name is not needed, but might be useful in the future.
254+ ets :update_counter (connection_churn_metrics , node (), {7 , 1 },
255+ ? CONNECTION_CHURN_METRICS ),
256+ ok .
257+
236258queue_deleted (Name ) ->
237259 ets :delete (queue_coarse_metrics , Name ),
260+ ets :update_counter (connection_churn_metrics , node (), {8 , 1 },
261+ ? CONNECTION_CHURN_METRICS ),
238262 % % Delete markers
239263 ets :update_element (queue_metrics , Name , {3 , 1 }),
240264 CQX = ets :select (channel_queue_exchange_metrics , match_spec_cqx (Name )),
0 commit comments