Skip to content

Commit 004077b

Browse files
Add support for filtering public flavors (#20)
1 parent 0397047 commit 004077b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

os_capacity/prometheus.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ def get_host_details(compute_client, placement_client):
167167
free_by_flavor_total = prom_core.GaugeMetricFamily(
168168
"openstack_free_capacity_by_flavor_total",
169169
"Free capacity if you fill the cloud full of each flavor",
170-
labels=["flavor_name"],
170+
labels=["flavor_name", "public"],
171171
)
172-
flavor_names = sorted([f.name for f in flavors])
173-
for flavor_name in flavor_names:
174-
counts = capacity_per_flavor.get(flavor_name, {}).values()
172+
173+
for flavor in flavors:
174+
counts = capacity_per_flavor.get(flavor.name, {}).values()
175175
total = 0 if not counts else sum(counts)
176-
free_by_flavor_total.add_metric([flavor_name], total)
176+
free_by_flavor_total.add_metric([flavor.name, str(flavor.is_public)], total)
177177
# print(f'openstack_free_capacity_by_flavor{{flavor="{flavor_name}"}} {total}')
178178

179179
# capacity per host

0 commit comments

Comments
 (0)