Merge pull request #7771 from DDDHuang/monitor_topics
fix: monitor samplers data calculate topics error
This commit is contained in:
commit
1185f010ec
|
@ -237,9 +237,19 @@ merge_cluster_samplers(TS, NodeData, Cluster) ->
|
|||
undefined ->
|
||||
Cluster#{TS => NodeData};
|
||||
ClusterData ->
|
||||
Cluster#{TS => count_map(NodeData, ClusterData)}
|
||||
Cluster#{TS => merge_cluster_sampler_map(NodeData, ClusterData)}
|
||||
end.
|
||||
|
||||
merge_cluster_sampler_map(M1, M2) ->
|
||||
Fun =
|
||||
fun
|
||||
(topics, Map) ->
|
||||
Map;
|
||||
(Key, Map) ->
|
||||
Map#{Key => maps:get(Key, M1) + maps:get(Key, M2)}
|
||||
end,
|
||||
lists:foldl(Fun, #{}, ?SAMPLER_LIST).
|
||||
|
||||
merge_cluster_rate(Node, Cluster) ->
|
||||
Fun =
|
||||
fun(Key, Value, NCluster) ->
|
||||
|
@ -365,13 +375,6 @@ internal_format(List) when is_list(List) ->
|
|||
internal_format(#emqx_monit{time = Time, data = Data}) ->
|
||||
#{Time => Data}.
|
||||
|
||||
count_map(M1, M2) ->
|
||||
Fun =
|
||||
fun(Key, Map) ->
|
||||
Map#{Key => maps:get(Key, M1) + maps:get(Key, M2)}
|
||||
end,
|
||||
lists:foldl(Fun, #{}, ?SAMPLER_LIST).
|
||||
|
||||
getstats(Key) ->
|
||||
%% Stats ets maybe not exist when ekka join.
|
||||
try
|
||||
|
|
Loading…
Reference in New Issue