Category: Software, Data

hen you’re operating an enterprise system as a DevOps team, metrics are essential — whether it’s statistics for monitoring and alerting on system health, measuring response times for user experience, or even exposing domain metrics for making business decisions. In this article, I’ll explain the basics of what we did using Micrometer with Prometheus and show you how you can write noninvasive code for metrics gathering, or any cross-cutting concern, by taking advantage of some Aspect-Oriented Programming.

If you’re not au fait with this lingo, it means Micrometer is an abstraction for talking to many different types of monitoring system and you will need one set up to make use of the data.

You can create your own Annotation Types in Java, they’re just like an interface with a hat on: In Micrometer the Counted Annotation Type is a wee bit more complicated, and this is a simplified version of it: If you’ve not written an annotation type before, there are certainly a few bits here that you won’t be familiar with.

This is why Annotation Types are such a good fit here, we can tag our method and it will simply work.

Related Articles