Skip to content

Commit

Permalink
Add support for filtering public flavors
Browse files Browse the repository at this point in the history
  • Loading branch information
assumptionsandg committed Feb 29, 2024
1 parent 0397047 commit baa7003
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions os_capacity/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit baa7003

Please sign in to comment.