diff --git a/internal/helper/loadbalancer.go b/internal/helper/loadbalancer.go index 35942f9a..23980a75 100644 --- a/internal/helper/loadbalancer.go +++ b/internal/helper/loadbalancer.go @@ -375,6 +375,11 @@ func parseLoadBalancerOpenstackMetric( "portID": "nil", "floatingID": "nil", "securityGroupID": "nil", + "flavorID": "nil", + } + + if lb.Spec.Infrastructure.Flavor.FlavorID != nil { + labels["flavorID"] = *lb.Spec.Infrastructure.Flavor.FlavorID } if lb.Status.PortID != nil { diff --git a/internal/helper/loadbalancermachine.go b/internal/helper/loadbalancermachine.go index 66a6197c..fce8b6d8 100644 --- a/internal/helper/loadbalancermachine.go +++ b/internal/helper/loadbalancermachine.go @@ -125,6 +125,11 @@ func parseLoadBalancerMachineOpenstackInfoMetrics( "namespace": loadBalancerMachine.Namespace, "portID": "nil", "serverID": "nil", + "flavorID": "nil", + } + + if loadBalancerMachine.Spec.Infrastructure.Flavor.FlavorID != nil { + labels["flavorID"] = *loadBalancerMachine.Spec.Infrastructure.Flavor.FlavorID } if loadBalancerMachine.Status.DefaultPortID != nil { diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index 867d9e60..b0f93b37 100644 --- a/internal/metrics/metrics.go +++ b/internal/metrics/metrics.go @@ -65,7 +65,7 @@ var ( LoadBalancerOpenstackInfoMetrics = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "loadbalancer_openstack_info", Help: "Openstack Info contains labels with the OpenStackIDs for LoadBalancer", - }, []string{"lb", "namespace", "portID", "floatingID", "securityGroupID"}) + }, []string{"lb", "namespace", "portID", "floatingID", "securityGroupID", "flavorID"}) // LoadBalancerReplicasMetrics Replicas for LoadBalancer (from lb.spec.replicas) LoadBalancerReplicasMetrics = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "loadbalancer_replicas", @@ -112,7 +112,7 @@ var ( LoadBalancerMachineOpenstackInfoMetrics = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "loadbalancermachine_openstack_info", Help: "Openstack Info contains labels with the OpenStackIDs for LoadBalancerMachine", - }, []string{"lb", "lbm", "namespace", "portID", "serverID"}) + }, []string{"lb", "lbm", "namespace", "portID", "serverID", "flavorID"}) ) func init() {