From 2688f5c60fd6496da9a1e9b4d0ecb9456b668869 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Thu, 14 Dec 2017 12:51:11 +0100 Subject: [PATCH] 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. --- src/exometer.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/exometer.erl b/src/exometer.erl index 6bc15fe..36572bc 100644 --- a/src/exometer.erl +++ b/src/exometer.erl @@ -400,7 +400,8 @@ get_cached_value_(#exometer_entry{name = Name, [ exometer_cache:write(Name, DataPoint1, Value1, CacheTTL) || { DataPoint1, Value1 } <- Result], All = Result ++ Cached, - [{_,_} = lists:keyfind(DP, 1, All) || DP <- DataPoints] + [{_,_} = lists:keyfind(DP, 1, All) || DP <- DataPoints, + lists:keymember(DP,1,All)] end.