# Spring Boot Admin

## Basic Concept

Our platform has integrated with Spring Boot Admin, an open-source software that manages and monitors Spring Boot applications. It displays the monitoring information provided by the Spring Boot Actuator Endpoints on the Web UI. For instance, it includes the basic information of all monitored Spring Boot projects, such as detailed health status, JVM and memory data, garbage collection, configuration details (such as data source, cache list and hit rate), etc. Also, the logger level can be modified directly via Spring Boot Admin.

## User Scenarios

This section is intended for users who need to view the application's monitoring information.

## Common Application Scenarios

Spring Boot Admin monitors the following items:
| Item                       | Description                                                            |  
|-------------------------------|------------------------------------------------------------------------|  
| Application running status    | Displays information such as time, number of garbage collections, number of threads, and memory usage trends. |  
| Application environment monitoring | Displays system environment variables, application configuration parameters, and automatic configuration parameters. |  
| Application performance monitoring | Displays current values by selecting JVM or Tomcat parameters. |  
| Application bean management     | Enables inspection of Spring Bean and verification of their singleton status. |  
| Application JVM management      | Displays current thread running status and allows the dumping of memory stack information. |  
| Application scheduled tasks     | Displays the list of scheduled tasks for the application. |  
| Application log management      | Allows dynamic modification of the log level and log viewing. |  
| Application mapping management  | Displays application interface information (including calling methods, return types, processing classes, etc.) |


## Access Steps

1. Navigate to `https://portal.insuremo.com/` and click **Sign in** to log in.
2. Click the hamburger menu icon (three horizontal lines) in the upper-left corner to expand the sidebar.
3. Locate and select `Monitoring` > `Boot Admin` from the menu.

## Account & Permission Requirements

- Container SSO is integrated, with an entry added via the Monitor menu. The permission requirement is the same as accessing the Log Dashboard. You only need a valid account and environment permissions within the container.

- **Recommended access path via Portal**: If you already have an account for the target tenant / workspace tenant on the Portal, simply log in. Otherwise, please join the corresponding tenant / workspace tenant and wait for tenant.admin to approve your request and assign the relevant runtime permissions.

- Alternative access (runtime container login): After logging into the runtime container, navigate to **`Utility & AI` > `Monitoring` > `Boot Admin`**. If no container runtime account exists, account synchronization from the business system to the container platform is supported.

### Tenant Boot-Admin VS Platform Boot-Admin

insureMO provides two levels of boot-admin:

Service instances can be viewed by environment and tenant, and namespace visibility is governed by the current identity. Full namespace access is available for platform support users, whereas tenant users can only access namespaces allocated to their respective tenant.

* Boot-admin for platform service 

  This boot-admin is designed for platform maintenance. It is only available for tenant users within a private cloud environment.

* Boot-admin for tenant service

  It's very convenient for users to utilize Spring Boot Admin. To integrate a new microservice, no additional dependencies and configurations are required——simply publish it via the portal. The entry link is the tenant domain appended with `/boot-admin/`, e.g. `https://{tenantcode}.insuremo.com/boot-admin/` (note that the trailing `/` is required at the end of the URL).
  
  For login, enter both the username and password as admin.


### Details

The **Details** page displays the basic information of the application, such as version details, health status, process and thread information. 

![details1](./image/springbootadmin/details1.png)

![details2](./image/springbootadmin/details2.png)

### Environment

The **Environment** page displays all environment variables used by the application, such as the SDK packages the application depends on, as well as connection information for database and message queues.

This section is especially useful for developers, as it allows them to view all the active environmental parameters loaded by the service application for troubleshooting.

![environment](./image/springbootadmin/environment.png)

### Log Configuration

From the **Loggers** page, you can see the log printing level of package at each level and directly modify it through the interface. 

The log level configuration feature is commonly used for troubleshooting, reservation of high-severity logs, and filtering of unimportant information. 

![logger](./image/springbootadmin/logger.png)

Occasionally, errors may occur during large file operations. Since REST calls typically show request / response in the log by default, the log can become very large and unwieldy for troubleshooting.

To disable these logs, access the boot-admin and change the logging level of **request.response.logging** to **OFF**.

![big file log](./image/springbootadmin/big_file_log.png)

![disable log](./image/springbootadmin/disable_log.png)


#### View API Information 

To view the input and output information of the GIMO API, you need to configure the corresponding logs in Spring Boot Admin first. Each product version offers unique configuration modes.

- For versions 21.0.02-21.0.08

    Set the **request.response.logging** of the API gateway and the invoked microservices to **DEBUG**. The output information will be enhanced, including the request header, request body, return body, and HTTP status code​. 
    - The change will take effect in real time without restarting the service.
    - After using the service, manually restore it to **INFO**. 

- For versions 21.0.09-22.10

    Set the **request.response.logging** of the API gateway and the invoked microservices to **DEBUG**. The output information will be enhanced, including the request header, request body, return body, and HTTP status code​. 
    - The change will take effect in real time without restarting service. 
    - If you do not reset it to **INFO** after use, it will be automatically restored to **INFO** after one hour. 
    - Sensitive field information in the response will be replaced with *** for security purpose.

- For versions 22.11 and later

    - For the scenario where services A, B, and C all rely on the GI foundation module (A > B > C scenario), you need to set the **request.response.logging** of the API gateway and the invoked microservices to the **DEBUG**.

    - For the scenario where service A does not rely on the GI foundation, but services B and C do (A > B > C scenario), you need to set the **server.request.response.logging** of the API gateway and services B, C to **DEBUG**. Meanwhile, set the **remoteCall.request.response.logging** of service A to **DEBUG**.

    -  The output information will be enhanced, including the request header, request body, return body, and HTTP status code​. 

        - The change will take effect in real time without restarting service. 
        - If you do not reset it back to **INFO** after use, it will be automatically restored to **INFO** after one hour. 
        - Sensitive field information in response will be replaced with *** for security purpose.

### Mappings
The **Mapping** page displays HTTP Endpoints information as follows.

![Mappings](./image/springbootadmin/mapping.png)


### Learn More
For more information, see [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin).


