Backend: Add functionality to export KubeScape Data Metrics to Prometheus
Description:
Add functionality in the backend to export Kubescape compliance scan data metrics to Prometheus for monitoring and visualization.
Tasks:
-
Integration with Prometheus
- Set up a Prometheus metrics endpoint in the backend.
- Define and register custom metrics for Kubescape compliance scans (e.g., counters, gauges).
-
Data Processing
- Fetch Kubescape compliance scan data using the existing client.
- Parse and transform the data into Prometheus-compatible metrics.
-
Metrics Export
- Push the transformed metrics to the Prometheus endpoint.
- Ensure proper labeling (e.g., control name, severity, namespace).
-
Error Handling and Logging
- Handle errors during data fetching, transformation, and export.
- Implement logging for debugging and monitoring.
-
Testing
- Write unit tests for metric transformation and export logic.
- Perform integration tests with Prometheus to validate metric ingestion.
Acceptance Criteria:
- Kubescape data metrics (e.g., compliance results, control failures) are exported to Prometheus.
- Metrics include appropriate labels for detailed filtering and monitoring.
- Robust error handling and logging are implemented.
- Unit and integration tests validate the functionality.
Edited by Manuel Ucles