Skip to content

Commit 2688f5c

Browse files
committed
Datapoint inconsistencies can make exometer:get_values/1 crash
An unnecessarily strict pattern-match in a get_cached_value_/2 LC could crash exometer:get_values/1, if custom metrics (e.g. probes) report the wrong set of supported datapoints. A guard in the LC ensures that only datapoints actually present in the data will be asked for.
1 parent c4afd6d commit 2688f5c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/exometer.erl

+2-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ get_cached_value_(#exometer_entry{name = Name,
400400
[ exometer_cache:write(Name, DataPoint1, Value1, CacheTTL)
401401
|| { DataPoint1, Value1 } <- Result],
402402
All = Result ++ Cached,
403-
[{_,_} = lists:keyfind(DP, 1, All) || DP <- DataPoints]
403+
[{_,_} = lists:keyfind(DP, 1, All) || DP <- DataPoints,
404+
lists:keymember(DP,1,All)]
404405
end.
405406

406407

0 commit comments

Comments
 (0)