PR 3/4: PLG Monitoring Stack - Metrics, Helm Charts & Promtail Sidecars - #71
Conversation
…refiner skill Add consolidated requirements for Prometheus, Loki, and Grafana (PLG) observability stack covering deployment, log aggregation, session tracking, client IP logging, metrics, and pre-built dashboards. Update requirements-refiner skill to provide concrete answer options with recommendations for each clarifying question. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
13 user stories across 5 phases covering log enrichment (sessionId, clientIp, apiKeyId), Prometheus metrics, Helm charts for Loki/Prometheus/ Grafana, Docker Compose and OpenShift deployment integration, and pre-built Grafana dashboards. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tput Add sessionId (from Keycloak session_state claim) to request context, NDJSON log output, and shared LogContext interface. Unauthenticated requests naturally omit the field. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract client IP from X-Forwarded-For > X-Real-IP > socket.remoteAddress and include it in NDJSON log output and shared LogContext interface. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Log API key prefix as apiKeyId for API key-authenticated requests. Ensures sessionId and apiKeyId are mutually exclusive and the full API key value is never written to logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add prom-client with RED metrics (http_requests_total, http_request_duration_seconds, http_request_errors_total), Node.js runtime default metrics, and /metrics endpoint excluded from auth guards and OpenShift route. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add PLG Helm chart with Loki StatefulSet, NDJSON-compatible config, 30-day retention via compactor, PVC storage, and per-environment values files (local/openshift). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…figuration Add Prometheus StatefulSet, ConfigMap with scrape targets for backend-services and Temporal, configurable scrape interval and PVC storage, per-environment values overrides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… Sources Add Grafana Deployment with username/password auth, pre-provisioned Prometheus and Loki data sources, ClusterIP service on port 3001, no OpenShift Route (access via port-forwarding). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add opt-in docker-compose.monitoring.yml with Loki, Promtail, Prometheus, and Grafana. Promtail auto-discovers containers via Docker socket. Includes npm scripts (dev:monitoring) and VS Code task integration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… Deployments Add Promtail sidecar containers to backend-services, temporal-worker, temporal-server, frontend, and PostgreSQL pods. Each sidecar tails log files from shared volumes and forwards to Loki with service labels. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… and Scripts Add PLG Helm deployment to GitHub Actions workflow and oc-deploy.sh script. PLG environment variables configurable per overlay. PLG is a separate Helm release that does not affect existing Kustomize deployment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve merge conflicts in 4 test files by combining develop's mock-based test structure with PLG branch's sessionId/clientIp/apiKeyId feature coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76e81b2 to
fafd8d6
Compare
The reflector mock was returning `true`/`false` instead of
`{ allowApiKey: true }`/`undefined`, causing the guard to skip
API key auth checks and resolve instead of rejecting.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-locate the monitoring compose file with its config files in deployments/local/. Update volume paths and all references in package.json and docs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dbarkowsky
left a comment
There was a problem hiding this comment.
Ok to move forward and see how this works with the final part.
For the helm charts, in other projects we've kept them in a separate bcgov-c repo at the request of the DevOps folks. They would have a better idea as to why, but something to keep in mind if it's a security concern.
…bject Replace individual request.apiKeyGroupId and request.apiKeyPrefix properties with a single request.apiKey object (ValidatedApiKey interface), mirroring the request.user pattern for JWT auth. This avoids growing one-off properties each time downstream code needs a new field from the validated key. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Eventually all infra code will live in a separate argoCD repo, that's what Brandon has been working on, I don't think there are security concerns currently as long as we manage keys properly. |
Summary
Adds the PLG (Promtail/Loki/Grafana) monitoring stack with Prometheus metrics, Helm charts for OpenShift deployment, and Docker Compose for local development.
Changes
Testing
Checklist
By submitting this pull request, I acknowledge that I have attempted to meet the following: