fix(http): avoid crash if the old sample data dont contain live_connections
In version 5.1.0, a new metric called "live_connections" was added. However, we try to merge some data from the Mria disk table, which may include old data formats. Therefore, maps:get/3 is needed to avoid crashes.
This commit is contained in:
parent
ebf307d704
commit
80e2c2c955
@ -249,7 +249,7 @@ merge_cluster_sampler_map(M1, M2) ->
|
|||||||
(topics, Map) ->
|
(topics, Map) ->
|
||||||
Map#{topics => maps:get(topics, M1)};
|
Map#{topics => maps:get(topics, M1)};
|
||||||
(Key, Map) ->
|
(Key, Map) ->
|
||||||
Map#{Key => maps:get(Key, M1) + maps:get(Key, M2)}
|
Map#{Key => maps:get(Key, M1, 0) + maps:get(Key, M2, 0)}
|
||||||
end,
|
end,
|
||||||
lists:foldl(Fun, #{}, ?SAMPLER_LIST).
|
lists:foldl(Fun, #{}, ?SAMPLER_LIST).
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user