Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SpringBoot services monitor the use of SpringBootAdmin

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "SpringBoot service monitoring SpringBootAdmin use method", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn "SpringBoot Service Monitoring SpringBootAdmin Usage Method"!

Github Address: https://github.com/codecentric/spring-boot-admin

Document address: codecentric.github.io/spring-boot-admin/current/

Using SpringBootAdmin in a project is divided into two parts: server and client. The client provides self-generated health status to the server through http

Version: 2.1.6

1. Build a server-side project

server-side dependency

de.codecentric spring-boot-admin-starter-server ${spring.boot.admin.version}

The annotation @EnableAdminServer is marked on the startup class

set port

server: port: 8080

Start

If there is an error:

2019-11-02 09:50:14.924 ERROR 55391 --- [nio-8080-exec-2] o.a.catalina.connector.CoyoteAdapter : Exception while processing an asynchronous requestjava.lang.IllegalStateException: Calling [asyncError()] is not valid for a request with Async state [MUST_DISPATCH] at org.apache.coyote.AsyncStateMachine.asyncError(AsyncStateMachine.java:440) ~[tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:512) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.Request.action(Request.java:430) ~[tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.AsyncContextImpl.setErrorState(AsyncContextImpl.java:396) ~[tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:239) ~[tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.AbstractProcessor.dispatch(AbstractProcessor.java:241) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.16.jar:9.0.16] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_191] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_191] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.16.jar:9.0.16] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191]

Replace Tomcat with jetty

de.codecentric spring-boot-admin-starter-server org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-jetty

Full project source code at https://github.com/FutaoSmile/LazyStarter/tree/master/lazy-admin

2. Client-Services that need to be monitored

Add client dependencies

org.jolokia jolokia-core de.codecentric spring-boot-admin-starter-client 2.1.6

Configure SpringBootAdmin server address

spring: boot: admin: client: url: http://localhost:8080management: endpoints: web: exposure: include: "*" endpoint: health: show-details: always

Start the SpringBoot client project

Address to access server configuration: http://localhost:8080

If there is no data, as shown below, this is because your SpringBoot project encapsulates the data returned by the monitoring endpoint, as can be seen from the data structure returned by Info.

The solution is not to let SpringBoot encapsulate the data returned by the monitoring endpoint

If @RestControllerAdvice is used then constrain the package path @RestControllerAdvice("com.west.lake.blog.controller")

Request log and request time monitoring

cache manager

At this point, I believe that everyone has a deeper understanding of "SpringBoot Service Monitoring SpringBootAdmin Usage", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report