jvmmetricsfinagle

How to get JVM metrics with Finagle?


For the same application code, I get them to appear on machine A but not on B.
On machine B I still get many of the metrics mentioned in the Finagle docs, but not the JVM ones.

Is there any JVM setting, or another environment setting, that would enable/disable JVM metrics?


Solution

  • TL;DR

    JvmStats.register(statsReceiver)


    Turns out I had a wrong assumption in: "the same application code is running on A and B."

    My app would startup differently on machine B because it's running on a web container: it would skip the normal TwitterService startup lifecycle, which you get if you extend TwitterServer with a main() method.
    Somewhere along this lifecycle JvmStats.register gets called. That's how machine A had JVM metrics. I finally managed to get them on B by adding that one line.