diff --git a/os_capacity/prometheus.py b/os_capacity/prometheus.py index e4a2269..b5ae000 100755 --- a/os_capacity/prometheus.py +++ b/os_capacity/prometheus.py @@ -167,20 +167,20 @@ def get_host_details(compute_client, placement_client): free_by_flavor_total = prom_core.GaugeMetricFamily( "openstack_free_capacity_by_flavor_total", "Free capacity if you fill the cloud full of each flavor", - labels=["flavor_name"], + labels=["flavor_name", "public"], ) - flavor_names = sorted([f.name for f in flavors]) - for flavor_name in flavor_names: - counts = capacity_per_flavor.get(flavor_name, {}).values() + + for f in flavors: + counts = capacity_per_flavor.get(f.name, {}).values() total = 0 if not counts else sum(counts) - free_by_flavor_total.add_metric([flavor_name], total) + free_by_flavor_total.add_metric([f.name, f.is_public], total) # print(f'openstack_free_capacity_by_flavor{{flavor="{flavor_name}"}} {total}') # capacity per host free_by_flavor_hypervisor = prom_core.GaugeMetricFamily( "openstack_free_capacity_hypervisor_by_flavor", "Free capacity for each hypervisor if you fill remaining space full of each flavor", - labels=["hypervisor", "flavor_name", "az_aggregate", "project_aggregate"], + labels=["hypervisor", "flavor_name", "az_aggregate", "project_aggregate", "public"], ) resource_providers, project_to_aggregate = get_resource_provider_info( compute_client, placement_client