官术网_书友最值得收藏!

Spring Boot actuators for microservices instrumentation

The previous sections explored most of the Spring Boot features required for developing a microservices. In this section, we will explore some of the production-ready operational aspects of Spring Boot.

Spring Boot actuators provide an excellent out-of-the-box mechanism for monitoring and managing Spring Boot microservices in production.

The full source code of this example is available as the chapter3.bootactuator project in the code files of this book under the following Git repository: https://github.com/rajeshrv/Spring5Microservice

Create another Spring starter project, and name it as chapter3.bootactuator.application; this time, select the Web, HAL browser, hateoas, and Actuator dependencies. Similar to chapter3.bootrest , add a GreeterController endpoint with the greet method. Add management.security.enabled=false to the application.properties file to grant access to all endpoints.

Do the following to execute the application:

  1. Start the application as Spring Boot App.
  2. Point the browser to localhost:8080/application. This will open the HAL browser. Review the Links section.

A number of links are available under the Links section. These are automatically exposed by the Spring Boot actuator:

Some of the important links are listed as follows:

  • dump: Performs a thread dump and displays the result
  • mappings: Displays a list of all the http request mappings
  • info: Displays information about the application
  • health: Displays the health condition of the application
  • autoconfig: Displays the auto configuration report
  • metrics: Shows different metrics collected from the application

From the browser, individual endpoints are accessible using /application/<endpoint_name>. For example, to access the /health endpoint, point the browser to localhost:8080/application/health.

主站蜘蛛池模板: 西乌珠穆沁旗| 当雄县| 周至县| 汽车| 张家界市| 浑源县| 古蔺县| 汽车| 玉环县| 旬阳县| 枝江市| 台东市| 奉化市| 凭祥市| 彰化市| 旬阳县| 黄龙县| 布尔津县| 勃利县| 利川市| 大冶市| 柘城县| 平阴县| 连江县| 云梦县| 金溪县| 龙泉市| 台湾省| 德昌县| 光山县| 崇文区| 广西| 海盐县| 甘孜| 开鲁县| 建昌县| 赤水市| 沾益县| 瓮安县| 宕昌县| 洪雅县|