Assess your understanding of Spring Boot Actuator features and best practices for application monitoring. This quiz covers endpoints, health checks, metrics, configuration, and monitoring strategies to help reinforce core concepts in efficient application observability.
Which of the following best describes the primary purpose of the Spring Boot Actuator module?
Explanation: The Spring Boot Actuator module is designed to add monitoring and management capabilities to applications, such as health checks, metrics, and environment information. Speeding up web requests and user authentication are handled by different modules, not Actuator. Generating HTML reports for user analytics is outside the scope of Actuator's responsibilities.
What property must be set in the configuration to enable all actuator endpoints, including sensitive ones?
Explanation: Setting 'management.endpoints.web.exposure.include=*' exposes all actuator endpoints, which may include sensitive ones. The other options do not exist in actuator configuration and would not have the desired effect. Care should be taken when exposing all endpoints to ensure security.
When you access the '/actuator/health' endpoint without authentication, what is typically displayed by default?
Explanation: By default, the health endpoint shows a concise status like 'UP' or 'DOWN' to avoid exposing sensitive details. Application logs, database information, and environment variables are not shown for security reasons. More detailed health info can be configured if needed.
If you want to add a custom readiness check for an API dependency in your application, what should you implement?
Explanation: Implementing a custom HealthIndicator lets you add personalized health checks, such as checking external APIs. ControllerAdvice handles exceptions, Repository deals with data operations, and DataSource manages database connections but do not serve as health checks.
Which actuator endpoint provides runtime metrics like memory usage and active threads?
Explanation: /actuator/metrics offers various runtime statistics including memory and thread information. The /actuator/info endpoint gives build or custom info, /actuator/tasks is not a standard endpoint, and /actuator/history is not used in actuator monitoring.
Which is the recommended way to restrict access to sensitive actuator endpoints in a production environment?
Explanation: Configuring authentication and authorization for sensitive endpoints is the recommended security practice. Removing the dependency disables monitoring, while just logging access or relying on request methods is not secure. Proper security ensures control and visibility.
A developer wants to include the application's version and description in the '/actuator/info' endpoint. Which configuration keys should be used?
Explanation: Setting info.version and info.description in properties files exposes them via the info endpoint. The other options are incorrect key formats and will not display the desired information on the info endpoint.
How can a developer disable the '/actuator/shutdown' endpoint to prevent it from shutting down the application?
Explanation: Setting management.endpoint.shutdown.enabled to false disables the shutdown functionality. Deleting classes or uninstalling the module removes all actuator features, and setting shutdown.method does not affect actuator endpoints. This property is the supported approach.
If not configured otherwise, on which port do actuator endpoints run relative to the application's server port?
Explanation: By default, actuator endpoints are available on the same port as the main application. They don't require a dedicated port unless configured. The other statements about ports are inaccurate for the default configuration.
Which actuator endpoint allows you to view a list of all beans created in the application context?
Explanation: /actuator/beans displays all beans and their dependencies in the application context. The other endpoints either do not exist or do not serve this function, so they would not help with viewing application beans.