Monitoring Spring Boot

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.

Supported information

Supported versions

Instana supports Spring Boot 1.x, 2.x and 3.x.

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.

Configuring Spring Boot Actuator

Spring Boot monitoring requires configuring of Spring Boot Actuator in the pom.xml file:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Enabling JMX

For Spring Boot 2.2.x and later, you must enable Java Management Extensions (JMX) in the application.properties file by setting the following property:

spring.jmx.enabled=true

Exposing the 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 sensor depends on the MBeans to collect metrics from the Spring Boot application:

management.endpoints.enabled-by-default=false

You can expose the Spring Boot management MBeans by enabling the following endpoints:

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, and you do not need to configure the authentication or credentials for secured actuator endpoints.

Setting health-interval parameter

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.

If needed, you can configure the desired health-interval parameter 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.

Exposing 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 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=*

Note: 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

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

Naming Spring Boot apps

Instana extracts the name for the Spring Boot instances by using the build-info.properties file. This file can be generated, for example, with spring-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.

Alternatively, you can also set the spring.application.name property in your application configuration. However, you must first configure the Spring Boot Actuator. For more information, see Configuring Spring Boot Actuator.

Viewing metrics

To view the metrics, complete the following steps:

  1. In the sidebar of the Instana UI, select Infrastructure.
  2. Click a specific monitored host.

You can see a host dashboard with all the collected metrics and monitored processes.

The Spring Boot Actuator endpoints monitor the Spring Boot applications and collect the following data from them:

Configuration data

Instana Spring Boot sensor collects the following configuration data:

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

Instana Spring Boot sensor collects the following metrics:

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

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.