The frontend application has been configured with comprehensive logging to help with debugging and monitoring.
The frontend uses Next.js instrumentation hook to enable server-side logging. This is configured in frontend/next.config.ts:
experimental: {
instrumentationHook: true,
} as any,The following components provide logging:
src/instrumentation.ts: OpenTelemetry instrumentation loggingsrc/app/layout.tsx: Server-side layout rendering logssrc/app/page.tsx: Client-side page component logs
All environment variables are managed through Kubernetes ConfigMaps:
- Base Configuration (
kubernetes/base/configmaps/app-config.yaml): Useslocalhost:8080for local development - Speedscale Overlay (
kubernetes/overlays/speedscale/frontend-config-patch.yaml): Uses production domain (edit to set your actual domain)
When the frontend starts and receives requests, you should see:
-
Instrumentation logs (server-side):
🔍 Registering OpenTelemetry instrumentation for frontend server... ✅ OpenTelemetry instrumentation registered successfully for frontend server -
Layout rendering logs (server-side):
🚀 Frontend layout component rendered on server -
Page component logs (client-side):
🏠 Home page component mounted, auth status: { isAuthenticated: false, isLoading: true } 🔓 User not authenticated, redirecting to login
If you're not seeing any log messages when port forwarding:
-
Check if instrumentation is enabled:
kubectl exec -n banking-app <frontend-pod> -- cat /app/.next/server/instrumentation.js
-
Check pod logs:
kubectl logs -n banking-app <frontend-pod> -f
-
Verify environment variables:
kubectl exec -n banking-app <frontend-pod> -- env | grep -E "(NODE_ENV|OTEL_)"
-
Test with the provided script:
./scripts/test-frontend-logs.sh
- Instrumentation not loading: Ensure
experimental.instrumentationHook: trueis set innext.config.ts - Build issues: The instrumentation file is only loaded in production mode with proper environment variables
- Client vs Server logs: Some logs only appear on the server side, others on the client side
Use the provided test script to verify logging is working:
./scripts/test-frontend-logs.shAfter making changes to the logging configuration, rebuild the frontend:
# Build the frontend
cd frontend
npm run build
# Rebuild the Docker image
docker build -t ghcr.io/speedscale/microsvc/frontend:latest .
# Redeploy to Kubernetes
kubectl rollout restart deployment/frontend -n banking-appThe frontend sends OpenTelemetry traces to Jaeger for monitoring. You can access the Jaeger UI to view traces and spans from the frontend application.