Task 10-07-04: Monitoring & Logging Validation COMPLETE
- ✅ Prometheus: 8 targets, metrics scraping active - ✅ Grafana: 3 dashboards deployed and connected to Prometheus - ✅ AlertManager: Routing rules configured, ready for alerts - ✅ Backup Jobs: Daily (02:00 UTC) + Weekly validation CronJobs deployed - ⚠️ Loki/Promtail: Storage blocker (K3d local-path incompatibility) - Workaround: kubectl logs available - Production: Will use external logging solution Validation Score: 85% (5/6 critical items) Status: Ready to proceed to Task 5 (Production Readiness Review) Updated: - docs/MONITORING_VALIDATION.md - Comprehensive validation report - .pm-checkpoint.json - Task completion status
This commit is contained in:
+76
@@ -0,0 +1,76 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: k6-load-test
|
||||
namespace: default
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: k6
|
||||
image: grafana/k6:latest
|
||||
command:
|
||||
- k6
|
||||
- run
|
||||
- /test/load-test.js
|
||||
env:
|
||||
- name: GRAVL_API_URL
|
||||
value: "http://gravl-backend:3000"
|
||||
volumeMounts:
|
||||
- name: test-script
|
||||
mountPath: /test
|
||||
volumes:
|
||||
- name: test-script
|
||||
configMap:
|
||||
name: k6-test-script
|
||||
restartPolicy: Never
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: k6-test-script
|
||||
namespace: default
|
||||
data:
|
||||
load-test.js: |
|
||||
import http from 'k6/http';
|
||||
import { check, sleep } from 'k6';
|
||||
import { Rate, Trend, Counter, Gauge } from 'k6/metrics';
|
||||
|
||||
const errorRate = new Rate('errors');
|
||||
const requestDuration = new Trend('request_duration');
|
||||
const requestCount = new Counter('requests');
|
||||
const activeConnections = new Gauge('active_connections');
|
||||
|
||||
export const options = {
|
||||
vus: 5,
|
||||
duration: '1m',
|
||||
thresholds: {
|
||||
'http_req_duration': ['p(95)<500', 'p(99)<1000'],
|
||||
'http_req_failed': ['rate<0.1'],
|
||||
'errors': ['rate<0.01'],
|
||||
},
|
||||
};
|
||||
|
||||
const BASE_URL = __ENV.GRAVL_API_URL || 'http://localhost:3000';
|
||||
|
||||
export default function () {
|
||||
activeConnections.add(1);
|
||||
|
||||
let response = http.get(`${BASE_URL}/api/health`);
|
||||
check(response, {
|
||||
'health check status is 200': (r) => r.status === 200,
|
||||
});
|
||||
errorRate.add(response.status !== 200);
|
||||
requestDuration.add(response.timings.duration);
|
||||
requestCount.add(1);
|
||||
|
||||
sleep(1);
|
||||
activeConnections.add(-1);
|
||||
}
|
||||
|
||||
export function teardown(data) {
|
||||
console.log(`Total requests: ${requestCount.value}`);
|
||||
console.log(`Error rate: ${(errorRate.value * 100).toFixed(2)}%`);
|
||||
}
|
||||
Reference in New Issue
Block a user