Monitoring Spring Boot
You can monitor the Spring Boot applications by using the Instana Spring Boot sensor. The Spring Boot sensor is automatically deployed and installed after you install the Instana agent. You can view the metrics that are related to Spring Boot applications in the Instana UI after you configure the Spring Boot Actuator as outlined in this topic.
Support information
To make sure that the Spring Boot sensor is compatible with your current setup, check the following support information sections:
Supported operating systems
The supported operating systems of Spring Boot sensor are consistent with host agents requirements, which can be checked in the Supported operating systems section of each host agent, such as Supported operating systems Linux.
Supported versions and support policy
The following table shows the latest supported version and support policy:
Technology | Support policy | Latest technology version | Latest supported version |
---|---|---|---|
Spring Boot | 45 days | 3.5.0 | 3.5.0 |
For more information about the support policy, see Support strategy for sensors.
Supported tracing
For this technology, Instana supports tracing. For more information, see Instrumented frameworks and libraries.
Configuring Spring Boot monitoring
To configure Spring Boot monitoring, complete the following steps:
Step 1: Configure Spring Boot Actuator
To configure Spring Boot Actuator, add the following dependency in the pom.xml
file:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
The Spring Boot Actuator generates and exposes operational endpoints of a running Spring Boot application.
Step 2: Enable Java Management Extensions (JMX)
For Spring Boot 2.2.x and later, enable JMX by setting the following property in the application.properties
file:
spring.jmx.enabled=true
Enabling JMX exposes data and resources from your Spring Boot application as managed beans (MBeans).
Step 3: Expose Spring Boot management MBeans
If the endpoints are disabled in the application.properties
file with the following configuration settings, then you need to expose the Spring Boot management MBeans because the sensor depends on the MBeans to collect metrics
from the Spring Boot application:
management.endpoints.enabled-by-default=false
To expose the MBeans, enable the following endpoints in the application.properties
file:
management.endpoint.info.enabled=true
management.endpoint.health.enabled=true
management.endpoint.metrics.enabled=true
management.endpoint.env.enabled=true
Instana queries metrics from the Spring Boot management MBean org.springframework.boot:type=Endpoint,name=Metrics
. No need to configure the authentication or credentials for secured actuator endpoints.
For Spring Boot 3.x, make sure that the following directive is available in the application.properties
file:
management.endpoints.jmx.exposure.include=env,health,info,metrics
Step 4: Expose endpoints over HTTP
For Spring Boot 2 and later, Spring Boot Actuator provides dependency management and auto-configuration for Micrometer. Depending on the Spring Boot version, different Micrometer metrics are available on the JVM dashboard.
You must carefully consider when to expose the endpoints over HTTP because the endpoints might contain sensitive information. By default, only the health endpoint is exposed. For more information, see Exposing Endpoints.
To exclude specific endpoints from HTTP, use the following directive:
management.endpoints.web.exposure.exclude=health,info
To exclude all endpoints from HTTP, use the following directive:
management.endpoints.web.exposure.exclude=*
Step 5: Show environment values in text
Before the application configuration properties can be displayed in the Instana UI, you need to make extra changes in the application.properties
file. Otherwise, these properties are shown as ******
because of sensitive
values. For more information, see Sanitize Sensitive Values.
To always show the values as clear text, use the following configuration in the application.properties
file:
management.endpoint.env.show-values=ALWAYS
Step 6: Name Spring Boot apps
Instana extracts the name for the Spring Boot instances from the following sources:
-
spring.application.name
property: If this property is defined in your application configuration, its value is used as the application name. For Spring Boot 3, to specify the name of the Spring Boot application, set thespring.application.name
property in theapplication.properties
file as follows:spring.application.name=<Your_Application_Name>
-
build-info.properties
file: Ifspring.application.name
is not defined, Instana retrieves the name for the Spring Boot application from thebuild-info.properties
file. This file can be generated, for example, withspring-boot-maven-plugin
:<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> </configuration> <executions> <execution> <goals> <goal>build-info</goal> </goals> <configuration> <additionalProperties> <name>${project.artifactId}</name> <version>${project.version}</version> </additionalProperties> </configuration> </execution> </executions> </plugin>
For more information about Integrating with Actuator, see Spring Boot Maven Plugin Documentation.
Step 7: Set health-interval parameter (optional)
By default, Instana queries the health of the Spring Boot app every 10 minutes by querying the management MBean org.springframework.boot:type=Endpoint,name=Health
.
To configure the desired health-interval
parameter, set the value in seconds:
com.instana.plugin.springboot:
health-interval: 30
The health check can introduce new downstream calls, depending on the health check implementation. If the health check fails, then you see a warning message that indicates the root cause.
Viewing metrics
To view the metrics, complete the following steps:
- In the sidebar of the Instana UI, select Infrastructure.
- Click a specific monitored host.
You can see a host dashboard with all the collected metrics and monitored processes.
Endpoints and HTTP sessions
Instana Spring Boot sensor collects the following metrics from endpoints and HTTP sessions:
Configuration data
The following table lists the configuration data that is collected by the Instana Spring Boot sensor:
Configuration | Description |
---|---|
Name | The name of the Spring Boot application. |
Application version | The build version of the Spring Boot application. |
SpringBoot version | The version of the Spring Boot framework. |
Status | The status of the Spring Boot application, such as Up or Down . |
Port | The HTTP port of the Spring Boot application. |
HTTP Session Limit | The maximum HTTP sessions of the Spring Boot application. |
Application Configuration | The Spring Boot application configuration information including configuration path and properties. |
Performance metrics
The following table lists the performance metrics that are collected by the Instana Spring Boot sensor:
Metric | Description | Granularity |
---|---|---|
Endpoint Request or Response Breakdown | The number of requests per second for each response status code (1xx, 2xx, 3xx, 4xx, or 5xx) |
1 second |
HTTP Sessions | The number of active HTTP sessions | 1 second |
Datasources
Instana Spring Boot sensor collects the following monitoring data from the datasources:
Configuration data
The following table lists the configuration data that is collected from the datasources:
Name | Description |
---|---|
Pool Name | The pool name of HikariCP. |
Connection Timeout | The connection timeout of HikariCP. |
Performance metrics
The following performance metrics are collected from the datasources:
Java Database Connectivity (JDBC) datasource
The following table lists the JDBC metrics that are collected from the datasources:
Metric | Display name | Description | Granularity |
---|---|---|---|
active |
Active | The number of active connections. | 1 second |
idle |
Idle | The number of idle connections. | 1 second |
max |
Max | The number of maximum connections. | 1 second |
min |
Min | The number of minimum connections. | 1 second |
HikariCP datasource
The following table lists the HikariCP metrics that are collected from the datasources:
Metric | Display name | Description | Granularity |
---|---|---|---|
acquire |
Acquisitions | The number of connection acquisitions. | 1 second |
active |
Active | The number of active connections. | 1 second |
creation |
Creations | The number of connection creations. | 1 second |
idle |
Idle | The number of idle connections. | 1 second |
max |
Max | The number of maximum connections. | 1 second |
min |
Min | The number of minimum connections. | 1 second |
pending |
Pending Threads | The number of threads waiting for a connection. | 1 second |
timeout |
Timeouts | The number of connection timeouts. | 1 second |
total |
Total | The total number of connections. | 1 second |
usage |
Usage | The number of connections added back to the pool. | 1 second |
Health Signatures
For each sensor, a curated knowledgebase of health signatures is evaluated continuously against the incoming metrics and is used to raise issues or incidents that depend on the user impact.
Built-in events trigger issues or incidents based on failing health signatures on entities, and custom events trigger issues or incidents based on the thresholds of an individual metric of any selected entity.
For more information about built-events for the Spring Boot sensor, see the Built-in events reference.
Troubleshooting
Use these troubleshooting entries to help resolve problems that are related to monitoring Spring Boot applications. An error message with the stated issue type and a brief explanation on what went wrong is displayed on the Spring Boot dashboard in the Instana UI.
Spring Boot Actuator is not configured
Monitoring issue type: springboot_actuator_not_configured
To configure Spring Boot Actuator, see Configuring Spring Boot Actuator.
JMX is not enabled
Monitoring issue type: springboot_jmx_not_enabled
To enable JMX, see Configuring Spring Boot Actuator.
If the spring.main.lazy-initialization
property is enabled, you must update the Spring Boot version to 2.4.12 or later.