ArithmeticError in Harvest.Collector.Metric.Harvester.merge_metric/2 since 1.22.4
tomtaylor opened this issue · comments
Since upgrading to 1.22.4 our reporting has halted, as every attempt to call NewRelic.Harvest.Collector.Metric.Harvester.merge_metric/2
causes an ArithmeticError on line 155, causing the GenServer to crash.
The full stack trace is:
ArithmeticError: bad argument in arithmetic expression
Module "erlang", in :erlang.*/2
File "lib/new_relic/harvest/collector/metric/harvester.ex", line 155, in NewRelic.Harvest.Collector.Metric.Harvester.merge_metric/2
File "lib/enum.ex", line 2181, in Enum."-reduce/3-lists^foldl/2-0-"/3
File "lib/new_relic/harvest/collector/metric/harvester.ex", line 46, in NewRelic.Harvest.Collector.Metric.Harvester.handle_cast/2
File "gen_server.erl", line 680, in :gen_server.try_dispatch/4
File "gen_server.erl", line 756, in :gen_server.handle_msg/6
File "proc_lib.erl", line 226, in :proc_lib.init_p_do_apply/3
Arg 0 is nil
and arg 1 is 1000
.
We've since reverted, and everything is working again. If it's useful, we could try and spin up New Relic locally and try and debug it further.
We've worked out this is because os_mon
is disabled, so some of the CPU metric parameters are nil
. NewRelic.Harvest.Collector.Metric.Harvester
is being called with:
{:report, %NewRelic.Metric{call_count: 1, max_call_time: nil, min_call_time: nil, name: :"CPU/User Time", scope: "", sum_of_squares: 0, total_call_time: nil, total_exclusive_time: 0}}
Oh right, must be because of #289
We need that cpu_utilization
measurement to report the standard CPU metric.
Since you are asking for this, are you OK with not getting CPU metrics in this situation?