test: cluster consistented metrics and label for nodes running/stopped
- `emqx_cluster_sessions_count` - `emqx_cluster_sessions_max` - `emqx_subscriptions_shared_count` - `emqx_subscriptions_shared_max` - `emqx_cluster_nodes_running` - `emqx_cluster_nodes_stopped`
This commit is contained in:
parent
55a8488a4f
commit
59e280dc54
|
@ -287,12 +287,18 @@ assert_stats_metric_labels([MetricName | R] = _Metric, Mode) ->
|
||||||
undefined ->
|
undefined ->
|
||||||
ok;
|
ok;
|
||||||
N when is_integer(N) ->
|
N when is_integer(N) ->
|
||||||
%% ct:print(
|
case N =:= length(lists:droplast(R)) of
|
||||||
%% "====================~n"
|
true ->
|
||||||
%% "%% Metric: ~p~n"
|
ok;
|
||||||
%% "%% Expect labels count: ~p in Mode: ~p~n",
|
false ->
|
||||||
%% [_Metric, N, Mode]
|
ct:print(
|
||||||
%% ),
|
"====================~n"
|
||||||
|
"%% Metric: ~p~n"
|
||||||
|
"%% Expect labels count: ~p in Mode: ~p~n"
|
||||||
|
"%% But got labels: ~p~n",
|
||||||
|
[_Metric, N, Mode, length(lists:droplast(R))]
|
||||||
|
)
|
||||||
|
end,
|
||||||
?assertEqual(N, length(lists:droplast(R)))
|
?assertEqual(N, length(lists:droplast(R)))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -304,10 +310,14 @@ assert_stats_metric_labels([MetricName | R] = _Metric, Mode) ->
|
||||||
|
|
||||||
%% `/prometheus/stats`
|
%% `/prometheus/stats`
|
||||||
%% BEGIN always no label
|
%% BEGIN always no label
|
||||||
|
metric_meta(<<"emqx_cluster_sessions_count">>) -> ?meta(0, 0, 0);
|
||||||
|
metric_meta(<<"emqx_cluster_sessions_max">>) -> ?meta(0, 0, 0);
|
||||||
metric_meta(<<"emqx_topics_max">>) -> ?meta(0, 0, 0);
|
metric_meta(<<"emqx_topics_max">>) -> ?meta(0, 0, 0);
|
||||||
metric_meta(<<"emqx_topics_count">>) -> ?meta(0, 0, 0);
|
metric_meta(<<"emqx_topics_count">>) -> ?meta(0, 0, 0);
|
||||||
metric_meta(<<"emqx_retained_count">>) -> ?meta(0, 0, 0);
|
metric_meta(<<"emqx_retained_count">>) -> ?meta(0, 0, 0);
|
||||||
metric_meta(<<"emqx_retained_max">>) -> ?meta(0, 0, 0);
|
metric_meta(<<"emqx_retained_max">>) -> ?meta(0, 0, 0);
|
||||||
|
metric_meta(<<"emqx_subscriptions_shared_count">>) -> ?meta(0, 0, 0);
|
||||||
|
metric_meta(<<"emqx_subscriptions_shared_max">>) -> ?meta(0, 0, 0);
|
||||||
%% END
|
%% END
|
||||||
%% BEGIN no label in mode `node`
|
%% BEGIN no label in mode `node`
|
||||||
metric_meta(<<"emqx_vm_cpu_use">>) -> ?meta(0, 1, 1);
|
metric_meta(<<"emqx_vm_cpu_use">>) -> ?meta(0, 1, 1);
|
||||||
|
@ -316,6 +326,8 @@ metric_meta(<<"emqx_vm_run_queue">>) -> ?meta(0, 1, 1);
|
||||||
metric_meta(<<"emqx_vm_process_messages_in_queues">>) -> ?meta(0, 1, 1);
|
metric_meta(<<"emqx_vm_process_messages_in_queues">>) -> ?meta(0, 1, 1);
|
||||||
metric_meta(<<"emqx_vm_total_memory">>) -> ?meta(0, 1, 1);
|
metric_meta(<<"emqx_vm_total_memory">>) -> ?meta(0, 1, 1);
|
||||||
metric_meta(<<"emqx_vm_used_memory">>) -> ?meta(0, 1, 1);
|
metric_meta(<<"emqx_vm_used_memory">>) -> ?meta(0, 1, 1);
|
||||||
|
metric_meta(<<"emqx_cluster_nodes_running">>) -> ?meta(0, 1, 1);
|
||||||
|
metric_meta(<<"emqx_cluster_nodes_stopped">>) -> ?meta(0, 1, 1);
|
||||||
%% END
|
%% END
|
||||||
metric_meta(<<"emqx_cert_expiry_at">>) -> ?meta(2, 2, 2);
|
metric_meta(<<"emqx_cert_expiry_at">>) -> ?meta(2, 2, 2);
|
||||||
metric_meta(<<"emqx_license_expiry_at">>) -> ?meta(0, 0, 0);
|
metric_meta(<<"emqx_license_expiry_at">>) -> ?meta(0, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue