Add dashboard statistics module and refactor views for metrics handling
All checks were successful
CI / ci (push) Successful in 14s

- Introduced a new `stats.py` module to encapsulate dashboard statistics building and cache key constants.
- Refactored `views.py` to utilize the new `build_stats` function for constructing metrics context, improving code organization and readability.
- Updated Prometheus query handling to streamline metrics fetching with a new `fetch_dashboard_metrics` function.
- Enhanced test cases to reflect changes in metrics fetching and context building, ensuring accurate functionality.
- Added new HTML templates for displaying detailed resource allocation and flavor statistics on the dashboard.
This commit is contained in:
2026-02-07 18:39:28 +03:00
parent 9fa0a78eb6
commit 6a27fecb13
11 changed files with 925 additions and 1083 deletions

View File

@@ -48,7 +48,7 @@ INSTALLED_APPS = [
PROMETHEUS_URL = "http://10.226.74.53:9090/"
PROMETHEUS_METRICS = {
"cpu_usage": "rate(libvirt_domain_info_cpu_time_seconds_total)[300s]",
"ram_usage": "avg_over_time(libvirt_domain_info_memory_usage_bytes[300s]",
"ram_usage": "avg_over_time(libvirt_domain_info_memory_usage_bytes[300s])",
}
# Openstack cloud settings