Video: Monitoring application events in Thermostat, using Byteman

Thermostat is Red Hat’s Monitoring and management tool for Java Deployments, allowing users to measure and monitor a host of different performance aspects of their Java applications. Available metrics range from raw CPU and memory usage to operation of the Garbage Collector and Compiler through to thread activity and method call/heap profiles. Thermostat provides a GUI view of activity of local and distributed JVMs in real time and it also backs up all the metrics it obtains to a persistent store so they can be reviewed offline.

What Thermostat cannot do on its own is track events and record statistics that are specific to a given Java application, at least not unless the application co-operates with it, for example by publishing JMX statistics that Thermostat can read, persist and display in its GUI. However, that’s about to change thanks to work Red  Hat’s OpenJDK team has been doing to integrate Byteman into Thermostat.

Byteman is a tool which can be used to modify the behaviour of Java programs by injecting extra Java code almost anywhere in the program. You don’t need to recompile your program or even prepare it in advance in order for this to work. You can specify changes to the program on the command line but, what is more amazing, you can actually use Byteman to change the way a program runs after startup while it is still running.

Thermostat has been extended so that it is able to install Byteman into a monitored JVM and to inject code changes into application or JDK runtime methods. The injected Java code posts an event to Thermostat when control reaches the target methods. Each event is organized as a JSON format record and the JSON fields can include parameters/local values from the target method call or global static values. Thermostat saves events to the persistent store and allows them either to be browsed or exported as JSON records or visualized using a variety of different graphical displays.

This functionality is being prepared for the next release of Thermostat. If you want a sneak peek you are lucky because I gave a preview demonstration at DevNation 2016 which was videoed and is now available online.

Some of the text in the video is quite small so you probably want to view this in full screen mode which you can do by clicking on the title line at the top of the video.

watch video


Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!

 

Leave a Reply