106106 {2 , ? MICROSECOND , io_seek_time_seconds_total , counter , " Total I/O seek time" , io_seek_time }
107107 ]},
108108
109- {ra_metrics , [
110- {2 , undefined , raft_term_total , counter , " Current Raft term number" },
111- {3 , undefined , raft_log_snapshot_index , gauge , " Raft log snapshot index" },
112- {4 , undefined , raft_log_last_applied_index , gauge , " Raft log last applied index" },
113- {5 , undefined , raft_log_commit_index , gauge , " Raft log commit index" },
114- {6 , undefined , raft_log_last_written_index , gauge , " Raft log last written index" },
115- {7 , ? MILLISECOND , raft_entry_commit_latency_seconds , gauge , " Time taken for a log entry to be committed" }
116- ]},
117-
118109 {auth_attempt_metrics , [
119110 {2 , undefined , auth_attempts_total , counter , " Total number of authentication attempts" },
120111 {3 , undefined , auth_attempts_succeeded_total , counter , " Total number of successful authentication attempts" },
@@ -701,7 +692,6 @@ get_data(Table, false, VHostsFilter) when Table == channel_exchange_metrics;
701692 Table == exchange_metrics ;
702693 Table == queue_exchange_metrics ;
703694 Table == channel_queue_exchange_metrics ;
704- Table == ra_metrics ;
705695 Table == channel_process_metrics ->
706696 Result = ets :foldl (fun
707697 % % For queue_coarse_metrics
@@ -723,33 +713,10 @@ get_data(Table, false, VHostsFilter) when Table == channel_exchange_metrics;
723713 {T , V1 + A1 , V2 + A2 , V3 + A3 , V4 + A4 };
724714 ({_ , V1 , V2 , V3 , V4 }, {T , A1 , A2 , A3 , A4 }) ->
725715 {T , V1 + A1 , V2 + A2 , V3 + A3 , V4 + A4 };
726- ({_ , V1 , V2 , V3 , V4 , V5 , V6 }, {T , A1 , A2 , A3 , A4 , A5 , A6 }) ->
727- % % ra_metrics: raft_entry_commit_latency_seconds needs to be an average
728- {T , V1 + A1 , V2 + A2 , V3 + A3 , V4 + A4 , V5 + A5 , accumulate_count_and_sum (V6 , A6 )};
729716 ({_ , V1 , V2 , V3 , V4 , V5 , V6 , V7 , _ }, {T , A1 , A2 , A3 , A4 , A5 , A6 , A7 }) ->
730717 {T , V1 + A1 , V2 + A2 , V3 + A3 , V4 + A4 , V5 + A5 , V6 + A6 , V7 + A7 }
731718 end , empty (Table ), Table ),
732- case Table of
733- % % raft_entry_commit_latency_seconds needs to be an average
734- ra_metrics ->
735- {Count , Sum } = element (7 , Result ),
736- [setelement (7 , Result , division (Sum , Count ))];
737- _ ->
738- [Result ]
739- end ;
740- get_data (ra_metrics = Table , true , _ ) ->
741- ets :foldl (
742- fun ({# resource {kind = queue }, _ , _ , _ , _ , _ , _ } = Row , Acc ) ->
743- % % Metrics for QQ records use the queue resource as the table
744- % % key. The queue name and vhost will be rendered as tags.
745- [Row | Acc ];
746- ({ClusterName , _ , _ , _ , _ , _ , _ } = Row , Acc ) when is_atom (ClusterName ) ->
747- % % Other Ra clusters like Khepri and the stream coordinator use
748- % % the cluster name as the metrics key. Transform this into a
749- % % value that can be rendered as a "raft_cluster" tag.
750- Row1 = setelement (1 , Row , #{<<" raft_cluster" >> => atom_to_binary (ClusterName , utf8 )}),
751- [Row1 | Acc ]
752- end , [], Table );
719+ [Result ];
753720get_data (exchange_metrics = Table , true , VHostsFilter ) when is_map (VHostsFilter )->
754721 ets :foldl (fun
755722 ({# resource {kind = exchange , virtual_host = VHost }, _ , _ , _ , _ , _ } = Row , Acc ) when
@@ -912,22 +879,12 @@ sum_queue_metrics(Props, {T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11,
912879 sum (proplists :get_value (segments , Props ), A17 )
913880 }.
914881
915- division (0 , 0 ) ->
916- 0 ;
917- division (A , B ) ->
918- A / B .
919-
920- accumulate_count_and_sum (Value , {Count , Sum }) ->
921- {Count + 1 , Sum + Value }.
922-
923882empty (T ) when T == channel_queue_exchange_metrics ; T == queue_exchange_metrics ; T == channel_process_metrics ; T == queue_consumer_count ->
924883 {T , 0 };
925884empty (T ) when T == connection_coarse_metrics ; T == auth_attempt_metrics ; T == auth_attempt_detailed_metrics ->
926885 {T , 0 , 0 , 0 };
927886empty (T ) when T == channel_exchange_metrics ; T == exchange_metrics ; T == queue_coarse_metrics ; T == connection_metrics ->
928887 {T , 0 , 0 , 0 , 0 };
929- empty (T ) when T == ra_metrics ->
930- {T , 0 , 0 , 0 , 0 , 0 , {0 , 0 }};
931888empty (T ) when T == channel_queue_metrics ; T == queue_delivery_metrics ; T == channel_metrics ->
932889 {T , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
933890empty (queue_metrics = T ) ->
0 commit comments