Creating custom metrics
Every program manager loves metrics. In fact, a popular company (Netflix) is so well known in this arena that people describe it as a metrics-gathering company that happens to stream video.
When it comes to Spring Boot, metrics are a prime piece of Spring Boot Actuator functionality. If we visit /application/metrics
, we can see a list of metrics:
{ "names": [ "jvm.buffer.memory.used", "jvm.memory.used", "jvm.buffer.count", "logback.events", "process.uptime", "jvm.memory.committed", "http.server.requests", "jvm.buffer.total.capacity", "jvm.memory.max", "process.starttime" ] }
This lists all sorts of stuff--memory, garbage collection, heap versus nonheap, threads, and more. That's nice, but what's usually needed is the ability to create our own metrics.
Spring Boot provides an interface to register our own metrics and have them appear on the same page. Supplied immediately...