Imagine that you’re part of a car racing team. You’re the one behind the screens to control the race and make some tough decisions (like changing the teams strategy). But you don’t have the insights (or metrics) about your car, opponents or even the weather. Sounds painful right? But why are we making this mistake when building our software? Why don’t we implement metrics by default? That’s where Micrometer comes in! It can help you with creating timers, gauges, counters and comparing data. We will create an application from scratch (lot of live coding)! Ready for the ride?!
5. @KoTurk77
@KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
But why don’t we (developers) think about proper monitoring?
6. @KoTurk77
@KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Title Text
https://formulaf1results.blogspot.com/2020/01/f1-crash-wallpaper.html
Application X Application Y
Backend
(still driving but slow)
7. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Of course you can log it but…..
8. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
A log is an event that happened
A metric is a measurement of the health of a system.
https://www.sumologic.com/blog/logs-metrics-overview/
9. @KoTurk77
@KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
That’s where
Micrometer comes in
10. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Introduction
21. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Timer
22. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
https://s1.cdn.autoevolution.com/images/news/gallery/red-bull-racing-beats-record-to-set-new-fastest-pit-stop-in-the-history-of-f1_2.jpg
23. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Histograms
24. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
25. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
26. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Counter
30. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
About security
• Please implement spring security
• Otherwise you will expose your endpoint to others
• And don’t forget to add it in your database config!
https://www.baeldung.com/spring-security-basic-authentication
https://egkatzioura.com/2020/05/07/spring-boot-and-micrometer-with-prometheus-part-6-securing-metrics/
31. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Sensitive data (!)
• Disable endpoints you don’t need
32. @KoTurk77
@KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
How to visualise the application metrics?
Which monitoring system to use?
37. All examples you can find at:
https://github.com/KoTurk
@KoTurk77
Thank you for listening
38. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Let’s deep dive into Grafana
39. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Long Task Timer (duration)
40. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Timer (count)
41. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Timer (max)
42. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Gauge
43. @KoTurk77 The Battle of the IDEs #Devnexus
@KoTurk77
Controlling your race with Micrometer and Spring Boot / Micronaut
Bindings