I recently tried to upgrade my rabbitmq installation (3-node cluster using 3.8.0-alpine hosted in Kubernetes) to 3.9.x. After the upgrade, the rabbitmq service stood up and was functioning, but no metrics were being reported to Prometheus. I was getting the following error:
2021-08-18 15:36:11.732445+00:00 [erro] <0.735.0>
2021-08-18 15:36:13.898507+00:00 [erro] <0.3462.0> {bad_header,<<"GET /met">>}
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> crasher:
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> initial call: cowboy_stream_h:request_process/3
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> pid: <0.3484.0>
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> registered_name: []
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> exception error: an error occurred when evaluating an arithmetic expression
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in operator +/2
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> called as undefined + 0
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from prometheus_mnesia_collector:'-get_memory_usage/0-fun-0-'/2 (src/collectors/mnesia/prometheus_mnesia_collector.erl, line 199)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from lists:foldl/3 (lists.erl, line 1267)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from prometheus_mnesia_collector:get_memory_usage/0 (src/collectors/mnesia/prometheus_mnesia_collector.erl, line 201)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from prometheus_mnesia_collector:metrics/1 (src/collectors/mnesia/prometheus_mnesia_collector.erl, line 124)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from prometheus_mnesia_collector:collect_mf/2 (src/collectors/mnesia/prometheus_mnesia_collector.erl, line 108)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from prometheus_collector:collect_mf/3 (src/prometheus_collector.erl, line 156)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> in call from prometheus_registry:'-collect/2-lc$^0/1-0-'/3 (src/prometheus_registry.erl, line 86)
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> ancestors: [<0.735.0>,<0.686.0>,<0.684.0>,<0.683.0>,<0.681.0>,
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> rabbit_web_dispatch_sup,<0.599.0>]
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> message_queue_len: 0
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> messages: []
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> links: [<0.735.0>,#Port<0.723>]
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> dictionary: []
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> trap_exit: false
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> status: running
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> heap_size: 6772
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> stack_size: 28
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> reductions: 4853
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0> neighbours:
2021-08-18 15:36:21.731849+00:00 [erro] <0.3484.0>
2021-08-18 15:36:21.732461+00:00 [erro] <0.735.0> Ranch listener {acceptor,{0,0,0,0,0,0,0,0},15692}, connection process <0.735.0>, stream 107 had its request process <0.3484.0> exit with reason badarith and stacktrace [{erlang,'+',[undefined,0],[{error_info,#{module => erl_erts_errors}}]},{prometheus_mnesia_collector,'-get_memory_usage/0-fun-0-',2,[{file,"src/collectors/mnesia/prometheus_mnesia_collector.erl"},{line,199}]},{lists,foldl,3,[{file,"lists.erl"},{line,1267}]},{prometheus_mnesia_collector,get_memory_usage,0,[{file,"src/collectors/mnesia/prometheus_mnesia_collector.erl"},{line,201}]},{prometheus_mnesia_collector,metrics,1,[{file,"src/collectors/mnesia/prometheus_mnesia_collector.erl"},{line,124}]},{prometheus_mnesia_collector,collect_mf,2,[{file,"src/collectors/mnesia/prometheus_mnesia_collector.erl"},{line,108}]},{prometheus_collector,collect_mf,3,[{file,"src/prometheus_collector.erl"},{line,156}]},{prometheus_registry,'-collect/2-lc$^0/1-0-',3,[{file,"src/prometheus_registry.erl"},{line,86}]}]
2021-08-18 15:36:21.732461+00:00 [erro] <0.735.0>
No alarms, diagnostics checks all were green, and as far as I could tell the system was running exactly as expected with the exception of emitting metrics to prometheus.
I haven't found a way around this, but so far have been able to upgrade to 3.8.21 successfully.