Push Spring Boot app metrics into AWS CloudWatch

Spring Boot is one of our favorite topics on this site. We believe that no matter how much we post about this theme, we still not be able to exhaust the subjects.

Recently we found a very interesting library that it deserves to be tried. But before starting discussion about it, let’s say two words about Spring Actuator. It is a sub-module of Spring Boot that offers several endpoints to be queried if you want to monitor your application. So, if it can be used to monitor your application, then for sure it stores a bunch of metrics that determine how your application is running.

The library we want to talk about today (link here) is a plugin that can be configured to push one or more of these metrics into AWS CloudWatch. For example, if you run your application with AWS Beanstalk and you want to monitor several JVM metrics (GC pauses, number of threads, etc), you can do that very easily with this library.

Overall, we found this library very useful and very easy to integrate in your app. In about 10 minutes we created a Spring Boot app where we integrated it (link here). In our opinion, there are 2 problems: it pollutes the output because it prints to console the published metrics and its dependencies versions should be updated. For the first one, a dedicated log appender solves the problem.

Considering the fact that you can build custom metrics with Spring Actuator and then publish them to AWS CloudWatch, we believe this library is interesting and in some cases it could be really useful.

Do you enjoy our posts? Sign up for weekly updates direct to your inbox!

Happy cloud computing!