Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prometheus label "raft_cluster" to non-QQ raft metrics (backport #12148) #12216

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,19 @@ get_data(Table, false, VHostsFilter) when Table == channel_exchange_metrics;
_ ->
[Result]
end;
get_data(ra_metrics = Table, true, _) ->
ets:foldl(
fun ({#resource{kind = queue}, _, _, _, _, _, _} = Row, Acc) ->
%% Metrics for QQ records use the queue resource as the table
%% key. The queue name and vhost will be rendered as tags.
[Row | Acc];
({ClusterName, _, _, _, _, _, _} = Row, Acc) when is_atom(ClusterName) ->
%% Other Ra clusters like Khepri and the stream coordinator use
%% the cluster name as the metrics key. Transform this into a
%% value that can be rendered as a "raft_cluster" tag.
Row1 = setelement(1, Row, #{<<"raft_cluster">> => atom_to_binary(ClusterName, utf8)}),
[Row1 | Acc]
end, [], Table);
get_data(exchange_metrics = Table, true, VHostsFilter) when is_map(VHostsFilter)->
ets:foldl(fun
({#resource{kind = exchange, virtual_host = VHost}, _, _, _, _, _} = Row, Acc) when
Expand Down
Loading