fix: cluster nodes running/stopped with node name as label
This commit is contained in:
parent
0e25eb287b
commit
02b3292025
|
@ -591,12 +591,19 @@ cluster_metric_meta() ->
|
||||||
{emqx_cluster_nodes_stopped, gauge, undefined}
|
{emqx_cluster_nodes_stopped, gauge, undefined}
|
||||||
].
|
].
|
||||||
|
|
||||||
cluster_data(Mode) ->
|
cluster_data(node) ->
|
||||||
|
Labels = [],
|
||||||
|
do_cluster_data(Labels);
|
||||||
|
cluster_data(_) ->
|
||||||
|
Labels = [{node, node(self())}],
|
||||||
|
do_cluster_data(Labels).
|
||||||
|
|
||||||
|
do_cluster_data(Labels) ->
|
||||||
Running = emqx:cluster_nodes(running),
|
Running = emqx:cluster_nodes(running),
|
||||||
Stopped = emqx:cluster_nodes(stopped),
|
Stopped = emqx:cluster_nodes(stopped),
|
||||||
#{
|
#{
|
||||||
emqx_cluster_nodes_running => [{with_node_label(Mode, []), length(Running)}],
|
emqx_cluster_nodes_running => [{Labels, length(Running)}],
|
||||||
emqx_cluster_nodes_stopped => [{with_node_label(Mode, []), length(Stopped)}]
|
emqx_cluster_nodes_stopped => [{Labels, length(Stopped)}]
|
||||||
}.
|
}.
|
||||||
|
|
||||||
%%========================================
|
%%========================================
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
collect_json_data/2,
|
collect_json_data/2,
|
||||||
|
|
||||||
aggre_cluster/3,
|
|
||||||
|
|
||||||
point_to_map_fun/1,
|
point_to_map_fun/1,
|
||||||
|
|
||||||
boolean_to_number/1,
|
boolean_to_number/1,
|
||||||
|
@ -83,9 +81,6 @@ aggre_cluster(Module, Mode) ->
|
||||||
Module:aggre_or_zip_init_acc()
|
Module:aggre_or_zip_init_acc()
|
||||||
).
|
).
|
||||||
|
|
||||||
aggre_cluster(LogicSumKs, ResL, Init) ->
|
|
||||||
do_aggre_cluster(LogicSumKs, ResL, Init).
|
|
||||||
|
|
||||||
do_aggre_cluster(_LogicSumKs, [], AccIn) ->
|
do_aggre_cluster(_LogicSumKs, [], AccIn) ->
|
||||||
AccIn;
|
AccIn;
|
||||||
do_aggre_cluster(LogicSumKs, [{ok, {_NodeName, NodeMetric}} | Rest], AccIn) ->
|
do_aggre_cluster(LogicSumKs, [{ok, {_NodeName, NodeMetric}} | Rest], AccIn) ->
|
||||||
|
|
Loading…
Reference in New Issue