Spring Boot Monitoring with Actuator 3 — Questions and Answers
Question 1: How can you add custom tags to every Micrometer metric emitted by your Spring Boot application?
- Define a MeterRegistryCustomizer bean that calls registry.config().commonTags() (Correct answer)
- Annotate each metric with @MetricTags
- Set management.metrics.tags in application.properties
- Use @CommonTag on the main application class
Correct answer: Define a MeterRegistryCustomizer bean that calls registry.config().commonTags()
A MeterRegistryCustomizer bean lets you apply common tags globally to all meters registered in the application.
Question 2: What is the purpose of the /actuator/scheduledtasks endpoint?
- Lists all @Scheduled methods, their configuration, and next execution time (Correct answer)
- Triggers immediate execution of a scheduled task
- Pauses and resumes scheduled tasks dynamically
- Shows task execution history and failure counts
Correct answer: Lists all @Scheduled methods, their configuration, and next execution time
The /actuator/scheduledtasks endpoint exposes metadata about all @Scheduled methods including cron expressions and fixed-rate settings.
Question 3: Which Actuator endpoint allows you to view and modify the logging level of a package at runtime?
- /actuator/loggers (Correct answer)
- /actuator/logging
- /actuator/loglevel
- /actuator/log-config
Correct answer: /actuator/loggers
The /actuator/loggers endpoint supports GET to view and POST to dynamically change logger levels without restarting.
Question 4: Which HTTP method must you use to update a logger level via the /actuator/loggers endpoint?
- POST (Correct answer)
- PUT
- PATCH
- GET
Correct answer: POST
A POST request to /actuator/loggers/{name} with a JSON body like {"configuredLevel":"DEBUG"} updates the logger level.
Question 5: What does a DOWN status in /actuator/health indicate by default?
- At least one HealthIndicator reported a DOWN status (Correct answer)
- The application process is about to shut down
- The JVM heap is above 90% utilization
- The application context has not fully started
Correct answer: At least one HealthIndicator reported a DOWN status
The aggregate health is DOWN when any single registered HealthIndicator returns a DOWN status.
Question 6: How do you expose Actuator endpoints on a separate management port?
- Set management.server.port to a different port number (Correct answer)
- Set server.management-port in application.properties
- Add @ManagementPort annotation to the main class
- Configure a second Tomcat connector with type=management
Correct answer: Set management.server.port to a different port number
Setting management.server.port to a value different from server.port causes all Actuator endpoints to bind to that alternate port.
Question 7: Which dependency must be added to enable Micrometer metrics export to Prometheus?
- micrometer-registry-prometheus (Correct answer)
- spring-boot-starter-prometheus
- actuator-prometheus-export
- micrometer-prometheus-bridge
Correct answer: micrometer-registry-prometheus
Adding io.micrometer:micrometer-registry-prometheus to the classpath auto-configures the /actuator/prometheus scrape endpoint.
How can you add custom tags to every Micrometer metric emitted by your Spring Boot application?