Actuator Endpoints
Spring Boot Actuator provides production-ready monitoring and management endpoints.Endpoint Exposure
Comma-separated list of actuator endpoints to expose over HTTP. Different profiles expose different endpoints.
Default Profile (All Services)
By default, services only expose
health and info endpoints to minimize the attack surface.Development Profile
Production Profile
Production adds the
prometheus endpoint for metrics scraping by monitoring systems.Exposed Endpoints
Health
GET /actuator/healthService health status and readiness checksInfo
GET /actuator/infoApplication metadata and build informationPrometheus
GET /actuator/prometheusMetrics in Prometheus format (production only)All Endpoints
GET /actuatorLists all available endpoints (dev only)Health Check Configuration
Health Details Visibility
Controls health check detail visibility. Values:
never, when-authorized, always.Default and Production
Services hide health details by default to prevent information leakage. Health endpoint returns only
UP or DOWN status.Development
Development profiles show full health details including database connectivity, disk space, and other indicators.
Example Health Responses
Production (show-details: never)
Development (show-details: always)
Distributed Tracing
SGIVU uses Zipkin for distributed tracing to track requests across microservices.Tracing Configuration
Percentage of requests to trace (0.0 to 1.0). Set to
0.1 (10%) by default to balance observability with performance.Zipkin server endpoint for sending trace data.
Sampling Strategy
Why 10% sampling?
Why 10% sampling?
Tracing every request can impact performance and generate massive amounts of data. A 10% sampling rate:
- Provides sufficient visibility into system behavior
- Captures enough traces to detect patterns and issues
- Minimizes performance overhead
- Reduces storage requirements
1.0 (100%) in development for complete visibility.Service Examples
Gateway Service
Auth Service
Domain Services (User, Client, Vehicle, Purchase-Sale)
All domain services use identical tracing configuration:Logging Configuration
SGIVU uses SLF4J with Logback for structured logging.Log Levels
Root logger level. Set to
INFO in all environments for balanced logging.Package-specific log levels for fine-grained control.
Standard Configuration
Service-Specific Logging
Gateway Service
The Gateway explicitly sets log levels for security and controller packages to ensure authentication/authorization events are captured.
Vehicle Service
The Vehicle Service sets AWS SDK logging to
info to reduce verbosity from S3 operations.Log Level Guide
ERROR
Critical failures requiring immediate attention
WARN
Potentially harmful situations that don’t stop execution
INFO
Important runtime events and milestones
DEBUG
Detailed diagnostic information (development only)
Complete Observability Examples
Gateway Service
Auth Service
User Service
Client Service
Vehicle Service
Purchase-Sale Service
Observability Stack
Service Instrumentation
Spring Boot Actuator and Micrometer automatically instrument services with metrics, health checks, and trace context propagation.
Trace Collection
Sampled requests generate trace spans that are sent to the Zipkin server at
http://sgivu-zipkin:9411.Health Monitoring
Orchestrators and load balancers query
/actuator/health to determine service availability.Monitoring Best Practices
Set up health check alerts
Set up health check alerts
Configure your orchestrator (Kubernetes, Docker Swarm, ECS) to:
- Perform health checks on
/actuator/health - Set appropriate timeout and interval values
- Restart unhealthy containers automatically
- Alert on repeated health check failures
Use Zipkin UI for request tracing
Use Zipkin UI for request tracing
Access the Zipkin UI (typically at
http://localhost:9411) to:- Search for traces by service name or time range
- Visualize request flows across services
- Identify performance bottlenecks
- Debug distributed transaction failures
- Analyze service dependencies
Adjust sampling rate based on traffic
Adjust sampling rate based on traffic
Low traffic environments (< 100 req/min):Medium traffic environments (100-1000 req/min):High traffic environments (> 1000 req/min):
Export Prometheus metrics to Grafana
Export Prometheus metrics to Grafana
- Deploy Prometheus to scrape
/actuator/prometheusendpoints - Configure Prometheus as a data source in Grafana
- Import Spring Boot dashboards from Grafana.com
- Create custom dashboards for business metrics
- Set up alerting rules in Prometheus/Alertmanager
Implement structured logging
Implement structured logging
Use structured logging (JSON format) for better log analysis:This enables powerful log filtering and analysis in centralized logging systems.
Troubleshooting
Health check endpoint returns 404
Health check endpoint returns 404
Causes:
- Actuator dependency not included
- Endpoints not exposed in configuration
- Context path misconfiguration
- Verify
spring-boot-starter-actuatoris in dependencies - Check
management.endpoints.web.exposure.includeconfiguration - Try full path:
/actuator/health(not just/health)
No traces appearing in Zipkin
No traces appearing in Zipkin
Causes:
- Zipkin server unreachable
- Sampling probability too low
- Micrometer tracing not configured
- Verify Zipkin is running:
curl http://sgivu-zipkin:9411/health - Increase sampling to
1.0for testing - Check service logs for Zipkin connection errors
- Verify
spring-cloud-starter-zipkindependency
Too many actuator endpoints exposed in production
Too many actuator endpoints exposed in production
Risk: Information disclosure and potential security vulnerabilitiesSolution: Ensure production profile uses restricted endpoint exposure:Never use
include: "*" in production.High CPU usage from tracing
High CPU usage from tracing
Cause: Sampling probability too high for traffic volumeSolution: Reduce sampling probability:Monitor CPU usage after adjustment.
Related Configuration
Spring Configuration
Server and application settings
Environment Variables
Observability-related environment variables
Deployment
Zipkin and monitoring stack deployment
Service Architecture
How observability fits into the system