It works most of the time and I'm able to get Prometheus metrics. However, randomly (usually after node restart) some nodes don't have metrics anymore and display the following error:
HTTP ERROR 404 Prometheus meter registry is null. Has the Prometheus Metrics Pluging been configured?
There is no visible difference in logs produced by a node having metrics and a node having no metrics. I don't know how to reproduce it. As a workaround, I have found that metrics can be enabled again by calling the JMX restartEmbeddedWebServer() to restart the Jetty server. Have you already seen something like that?
This report comes from ASF Slack: