Micrometer
Micrometer is a metrics instrumentation library for JVM-based applications. It provides a simple facade over the instrumentation clients for the most popular monitoring systems, letting you instrument your JVM-based application code without vendor lock-in.
Registry
A Meter is the interface for collecting a set of measurements (which we individually call metrics) about your application. Meters in Micrometer are created from and held in a MeterRegistry.
Counter
A Counter reports a count over a specified property of an application.
Counter.builder("library.books.created")
.description("Book records created since application start")
.register(this.meterRegistry);
Gauge
A gauge is a handle to get the current value. Typical examples for gauges would be the size of a collection or map or number of threads in a running state.
Gauge.builder("library.books.created",fetchBookCreatedCount())
.description("Book records created since application start")
.register(this.meterRegistry);
Timer
Timers are intended for measuring short-duration latencies and the frequency of such events.
@Timed(value = "library.allbooks.time", description = "Time service spent to retrieve all books", percentiles = {0.95, 0.90})
public List<BookDTO> getAllBooks() {...}
Distribution Summary
A distribution summary tracks the distribution of events. It is similar to a timer structurally, but records values that do not represent a unit of time. For example, you could use a distribution summary to measure the payload sizes of requests hitting a server.
Long Task Timers
The long task timer is a special type of timer that lets you measure time while an event being measured is still running. A normal Timer only records the duration after the task is complete. For instance monitoring of Batch Jobs.