39

Full Stack Performance Monitoring Using Micrometer

 4 years ago
source link: https://www.tuicool.com/articles/iiQJFfQ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Clint Checketts, core committer of Micrometer Project, recently spoke at SpringOne Platform 2019 Conference about Micrometer monitoring and alerting framework. Micrometer provides a simple facade over the instrumentation clients for different monitoring systems that allows developers to instrument JVM-based applications. Not only can it be used for recording metrics, but also a wide range of observability features when used along with other tools like Prometheus and Grafana to provide application resiliency.

Checketts discussed the importance of dimensional metrics in the overall monitoring of systems. Similar to other products like Google Prometheus and Netflix Atlas , Micrometer provides the support for managing dimensional time-series based metrics data.

He talked about the difference between dimensional metrics and hierarchical metrics. Dimensional metrics track metrics differently , in that they are tagged where each metric consists of a name and can contain multiple statistics. This allows for better querying flexibility and extensibility. It's not just about monitoring for errors, but actually understanding the overall health of the system.

Observability is basically a tripod of three pillars:

  • Logging: Detailed information about individual actions. Libraries include SLF4J, Log4J, Logback, and JUL.
  • Metrics: Aggregate information about application features. Libraries include Micrometer, Prometheus, and Drop Wizard Metrics.
  • Tracing: Sampled information across multiple services. Zipkin library falls into this category.

Checketts also discussed the key logging features and how Micrometer compares to traditional logging. It supports common logging with destinations such as Elasticsearch . It can also be used for adding cross-cutting metdadata like nested diagnostic contexts (NDC) to the log messages.

Micrometer terminology includes the following components: Meter (what is measured. Examples: counters, timers, and gauges), MeterRegistry (a meter store abstraction), Tag (a meter dimension) and Metric (an individual measurement).

Checketts showed how to use the monitoring framework in different applications, and gave the examples of Micrometer using Docker , and Kotlin using SimpleMeterRegistry and CompositeMeterRegistry classes.

He discussed the Micrometer integration in Spring based applications. The support is built into Spring, and the class just needs to be autowired. Another demo showed how to set up a Spring application with Micrometer and enable the Prometheus Actuator . Also, the Metrics Actuator is powered by Micrometer.

Resilience4J , a fault tolerance library, includes Micrometer support and can be used to monitor the statistics like circuit breaker state and success/failure rates. Checketts also showed how to get custom frontend metrics from an Angular application, sending metrics to Micrometer backend every five seconds.

You can download the sample code shown in the presentation from the Github project .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK