Monitoring
This guide covers monitoring and observability for your Actyze deployment.
Overview
Monitoring your Actyze deployment helps you:
- Track system health and performance
- Identify and debug issues quickly
- Optimize resource usage
- Plan for scaling
Kubernetes Monitoring
Using kubectl
Check pod status:
kubectl get pods -n actyze
View pod logs:
# Backend logs
kubectl logs -f deployment/actyze-backend -n actyze
# Frontend logs
kubectl logs -f deployment/actyze-frontend -n actyze
# Nexus logs
kubectl logs -f deployment/actyze-nexus -n actyze
Check resource usage:
kubectl top pods -n actyze
kubectl top nodes
Prometheus & Grafana (Optional)
For production deployments, consider setting up Prometheus and Grafana:
# Install Prometheus Operator
helm install prometheus-operator prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
Application Logs
Backend (Spring Boot)
Logs are written to stdout and can be viewed with kubectl:
kubectl logs -f deployment/actyze-backend -n actyze
Nexus (FastAPI)
Nexus uses structured logging. View logs:
kubectl logs -f deployment/actyze-nexus -n actyze
Frontend (Nginx)
Access and error logs:
kubectl logs -f deployment/actyze-frontend -n actyze
Database Monitoring
PostgreSQL
Check database connections:
kubectl exec -it <postgres-pod> -n actyze -- psql -U postgres -c "SELECT * FROM pg_stat_activity;"
Monitor database size:
kubectl exec -it <postgres-pod> -n actyze -- psql -U postgres -c "SELECT pg_size_pretty(pg_database_size('nexus'));"
Trino
Monitor Trino queries through the Web UI:
# Forward port to access Trino UI
kubectl port-forward svc/actyze-trino -n actyze 8080:8080
Then open http://localhost:8080 in your browser.
Health Checks
Backend Health
curl http://<backend-service>:8080/actuator/health
Nexus Health
curl http://<nexus-service>:8000/health
Frontend Health
curl http://<frontend-service>
Alerts & Notifications
Setting up Alerts
-
Resource Usage Alerts
- CPU/Memory thresholds
- Disk space warnings
- Pod restart counts
-
Application Alerts
- API error rates
- Query failures
- Authentication issues
-
Database Alerts
- Connection pool exhaustion
- Slow query detection
- Replication lag
Performance Metrics
Key metrics to monitor:
- Request Latency: API response times
- Throughput: Requests per second
- Error Rate: Failed requests percentage
- Query Performance: Average SQL query execution time
- Resource Usage: CPU, memory, disk I/O
Troubleshooting
High Memory Usage
# Identify memory-hungry pods
kubectl top pods -n actyze --sort-by=memory
Frequent Pod Restarts
# Check restart count
kubectl get pods -n actyze
# View previous logs
kubectl logs <pod-name> -n actyze --previous
Slow Queries
Check Nexus logs for slow query warnings:
kubectl logs deployment/actyze-nexus -n actyze | grep "slow"
Best Practices
-
Enable Structured Logging
- Use JSON format for easier parsing
- Include correlation IDs for request tracing
-
Set Resource Limits
- Define CPU and memory limits in Helm values
- Prevent resource exhaustion
-
Regular Backups
- Automate database backups
- Test restore procedures
-
Log Retention
- Configure appropriate retention periods
- Use log aggregation tools for long-term storage