feat: cluster info available in metrics
This commit is contained in:
parent
cf16a822b8
commit
7b5422dbae
|
@ -124,8 +124,10 @@ collect_mf(_Registry, Callback) ->
|
|||
Metrics = emqx_metrics:all(),
|
||||
Stats = emqx_stats:getstats(),
|
||||
VMData = emqx_vm_data(),
|
||||
ClusterData = emqx_cluster_data(),
|
||||
_ = [add_collect_family(Name, Stats, Callback, gauge) || Name <- emqx_stats()],
|
||||
_ = [add_collect_family(Name, VMData, Callback, gauge) || Name <- emqx_vm()],
|
||||
_ = [add_collect_family(Name, ClusterData, Callback, gauge) || Name <- emqx_cluster()],
|
||||
_ = [add_collect_family(Name, Metrics, Callback, counter) || Name <- emqx_metrics_packets()],
|
||||
_ = [add_collect_family(Name, Metrics, Callback, counter) || Name <- emqx_metrics_messages()],
|
||||
_ = [add_collect_family(Name, Metrics, Callback, counter) || Name <- emqx_metrics_delivery()],
|
||||
|
@ -454,7 +456,13 @@ emqx_collect(emqx_vm_total_memory, VMData) ->
|
|||
gauge_metric(?C(total_memory, VMData));
|
||||
|
||||
emqx_collect(emqx_vm_used_memory, VMData) ->
|
||||
gauge_metric(?C(used_memory, VMData)).
|
||||
gauge_metric(?C(used_memory, VMData));
|
||||
|
||||
emqx_collect(emqx_cluster_nodes_running, ClusterData) ->
|
||||
gauge_metric(?C(nodes_running, ClusterData));
|
||||
|
||||
emqx_collect(emqx_cluster_nodes_stopped, ClusterData) ->
|
||||
gauge_metric(?C(nodes_stopped, ClusterData)).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Indicators
|
||||
|
@ -592,3 +600,13 @@ emqx_vm_data() ->
|
|||
{process_total_messages, 0}, %% XXX: Plan removed at v5.0
|
||||
{cpu_idle, Idle},
|
||||
{cpu_use, 100 - Idle}] ++ emqx_vm:mem_info().
|
||||
|
||||
emqx_cluster() ->
|
||||
[ emqx_cluster_nodes_running
|
||||
, emqx_cluster_nodes_stopped
|
||||
].
|
||||
|
||||
emqx_cluster_data() ->
|
||||
#{running_nodes := Running, stopped_nodes := Stopped} = ekka_mnesia:cluster_info(),
|
||||
[{nodes_running, length(Running)},
|
||||
{nodes_stopped, length(Stopped)}].
|
||||
|
|
Loading…
Reference in New Issue