Detailed explanation of spring boot monitoring and processing scheme examples
As we all know, spring boot integrates many third-party frameworks. Let's briefly discuss things related to performance monitoring and JVM monitoring. Other articles will not be discussed in this article. Although there are some connections, it is said at the beginning that there is a need for relevant spring boot framework foundation. After so much nonsense, let's really enter the topic below.
First of all, let's take a look at the overall data flow chart. There are two main lines, one is the collection of interface or method performance monitoring data, and the other is the collection of spring boot microservice JVM related index data. Finally, they are summarized into the influxdb timing database, and the data display tool grafara is used for data display or alarm.
. basic services
There are many basic services, including rabbitmq, Eureka registration center, influxdb and grafara (if you don't know these things, please ask Baidu or Google for relevant knowledge). The following is a brief description of the functions of each basic service:
Rabbitmq is a very popular message middleware, which is mainly used to collect information about the monitoring performance of spring boot applications. Why rabbitmq is not other Kafka and so on, because the testing is convenient, the performance is sufficient, and the spring boot integration is perfect.
Eureka registration center is generally known to those who have seen or used spring cloud related frameworks. Spring cloud registration center mainly recommends Eureka! Why not do too much discussion is not the main focus of this article. This paper is mainly used to synchronize and obtain the relevant information of applications registered in the registry.
Why do influxdb and grafara choose these two? Other schemes, such as elasticsearch, logstash, kibana, elk combination and so on! Obviously, the reason is that the compression ratio of the data in the time series database is much better than that of other databases (elasticsearch) (of course, I haven't actually tested it, but I just read some documents). At the same time, the use of SQL in the infixdb is very similar to the relational databases such as mysql. It's easy to get started, and the grafara tool can warn. And so on!!!!!!!!!!!
OK, let's briefly introduce the tools here. As for how to deploy and build these tools, please find the materials to learn first, or because it is not the focus of this article and will not be discussed in depth. If there are docker related basic children's shoes, you can directly download an image and start it for testing (I use the above basic application launched by docker (except Eureka))
I. monitored applications
I won't say much here. The monitored application must be a spring boot project, but you should refer to the relevant packages and annotations and modify the relevant configuration files
Package references, which must be referenced
To put it simply, the functions of related packages spring cloud starter Netflix Eureka client are used for the packages used by the registry, spring cloud starter stream rabbit sends rabbitmq related packages, and spring boot starter actuator publishes rest interface packages related to monitoring,
Spring cloud starter hystrix fuse performance monitoring related packages.
Related notes
Profile related
Briefly explain the related configurations under endpoints, mainly because these paths need to be authorized. Through the configuration, these path interfaces are no longer sensitive and require authorized access. This should enable us to easily access the response interface of each service registered in the registry. Insert a sentence here. For interface performance, you need to add the following related annotations on the method before relevant performance data can be output
Well, here, your application basically has the ability to output relevant performance. You can visit
If it's the interface above, your application is basically OK. Why is it basic? Because your screenshot does not reflect the performance information and send rabbitmq related information. This needs to see the log and join the discussion in the comment area where you failed. Let's focus on the main line first.
OK, let's start with the spring boot application. Start the next topic
II. Performance index data collection
Just visited http://IP:port/hystrix.stream The displayed information is the output of excuses or method performance related information. If there are no problems above, the data should be sent to rabbitmq. We can directly go to rabbitmq to receive relevant data.