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

What is the role of spring boot monitoring endpoints

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

Share

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

This article mainly introduces the role of spring boot monitoring endpoint, has a certain reference value, interested friends can refer to, I hope you have a lot of gains after reading this article, let Xiaobian take you to understand.

The role of monitoring endpoints:

According to the role of endpoints, endpoints can be divided into four categories:

Application configuration class: Get application-related information such as application configuration loaded in the application, environment variables, automation configuration reports, etc.

Metrics class: Get metrics used to monitor the running process of the application, such as memory information, thread information, http requests, etc.

Operation control class: provides operation class functions such as closing applications. The following endpoints are available:

ID description Sensitive autoconfig displays an auto-configuration report showing all auto-configuration candidates and why they were applied or not truebeans displays a complete list of all Spring Beans in an application trueconfigprops displays a collated list of all @ConfigurationProperties truedump performs a thread dump true

env Exposes properties from Spring ConfigurableEnvironment truehealth Exposes health information for apps (A simple 'status' is displayed when accessed using an unauthenticated connection, falseinfo displays arbitrary app information falsemetrics displays 'metrics' information for the current app truemappings displays a collated list of all @RequestMapping paths trushutdown allows the app to shut down gracefully (Not enabled by default) truetrace Displays trace information (default to the most recent HTTP requests) true1. Apply configuration classes:

(1)/autoconfig: Gets the automation configuration usage of the application, including all automation configuration candidates. It also lists whether each candidate matches successfully and the reasons why it does not match successfully. PositiveMatches returns automation configurations that match successfully, negativeMatches returns automation configurations that match unsuccessfully.

(2)/configprops: Get all configuration properties of the application configuration. prefix stands for property prefix, properties stands for property name and id, etc.

(3)/beans: Gets all beans created in the application. Each Bean contains beans, scopes, types, resources, and dependencies.

(4)/env: Get the environment information of the application. Contains environment variables, JVM properties, application configuration properties, parameters, ports, etc.

(5)/mappings: Returns all controller mapping reports, including service interfaces and monitoring interfaces.

(6)/info: Get application customization information, default is empty. You can configure it yourself in application.properties.

2. Metric category:

(7)/metrics: Returns various important metrics, such as memory profile information, heap memory information, non-heap memory information, thread usage, class statistics of application loading and unloading, garbage collector details, tomcat container usage, http request performance metrics, etc.

(8)/health: Obtain information about various indicators of the application. You can also customize your own Health monitoring.

(9)/dump: Used to generate a snapshot of current thread activity.

(10)/trace: Used to return basic http trace information. Keep a record of the last 100 http requests.

3. Operation control category:

(11)/shutdown: This is an endpoint that directly shuts down the application, unlike the previous endpoints, which are enabled by default, and it requires properties to configure the startup operation. You can configure it in application.properties:

endpoints.shutdown.enabled=true

4. Application Monitoring Class

(12)/heapdump: endpoint of springmvc, used to return Gzip compressed hprof heap dump files (ending with hprof.gz)

(13)/loggers: Ability to view log levels for all package classes and modify them.

(14)/actuator: A list of all endpoints, i.e., a list of interfaces monitored by the application.

(15)/auditevents: Exposes audit event information for the current application.

: where/shutdown is a post request and the rest are get requests.

If you want to modify the log level, you need to post requests and send data in JSON (application/json) format. Test it and find that if you start the program through springboot main program entrance, you can dynamically modify the logback log level; if you pack it under linux, dynamically modifying the log level is invalid.

If the monitoring endpoints above cannot be accessed, it may be that your management port is often protected by a firewall and does not need to be protected if it is not exposed to the outside world. At this point you need to add to application.properties:

management.security.enabled=false

It can also be set individually, such as endpoints.mappings.sensitive=false, to turn off security restrictions for/mappings.

2. Custom endpoint access paths and access ports

By default, the monitored interface port is consistent with the service port. such as

url intercept prefix name

management.contextPath=/jvm

Default uses original http port

management.port=20001

Thank you for reading this article carefully. I hope that the article "What is the role of spring boot monitoring endpoint" shared by Xiaobian will help everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you 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