Repository navigation
Conversation
Closes kaaval#3. Adds /metrics — real gauges computed on every scrape (a live query, not a cached counter), covering scans, vulnerabilities, asset-vulnerabilities, integration findings, RBAC scan results, and endpoints, each broken down by their real status/severity labels. No sensitive data in metric labels — checked: only status/severity strings, never asset IDs, CVE IDs, hostnames, or tenant IDs. One open question for the maintainer: /metrics is currently unauthenticated, matching standard Prometheus practice (scrape-only, restricted by network policy rather than app-level auth). Flagging it explicitly rather than deciding it silently — happy to add auth if you'd rather it be gated. Tests: 5 new tests in tests/test_metrics.py, covering the collector directly and the real HTTP route end-to-end (status code, content-type, dependency injection). Full non-DB suite: 152/152 passing. Signed-off-by: KK Nkama <[email protected]>
rrskris
left a comment
There was a problem hiding this comment.
The isolated registry per scrape and the HTTP-level test are useful foundations. The current collector does not yet satisfy #3's requirement to expose the latest persisted CVE and RBAC findings.
The active CVE paths write CVEScanResult and K8sCVEScanResult, while kaaval_scans_total and kaaval_vulnerabilities_total query the legacy Scan and Vulnerability tables. Counting RBACScanResult rows by status also counts historical scans rather than current findings.
Please derive the finding counts by severity, maximum contextual score, and last-scan timestamp from the latest scan results, then add the PrometheusRule example requested by #3. Include a regression that seeds two scans with different findings and proves only the latest contributes. Define the multi-cluster aggregation explicitly so one cluster's new scan does not hide another cluster's results. Keep this change within the current CVE/RBAC scope; image imports can be a follow-up.
Closes #3.
Adds
/metrics— real gauges computed on every scrape (a live query, not acached counter), covering scans, vulnerabilities, asset-vulnerabilities,
integration findings, RBAC scan results, and endpoints, each broken down by
their real status/severity labels.
No sensitive data in metric labels — checked: only status/severity strings,
never asset IDs, CVE IDs, hostnames, or tenant IDs.
One open question for the maintainer:
/metricsis currently unauthenticated,matching standard Prometheus practice (scrape-only, restricted by network
policy rather than app-level auth). Flagging it explicitly rather than
deciding it silently — happy to add auth if you'd rather it be gated.
Tests: 5 new tests in
tests/test_metrics.py, covering the collector directlyand the real HTTP route end-to-end (status code, content-type, dependency
injection). Full non-DB suite: 152/152 passing.