From 231101fd5fdd9c8ecb8549daf1dbf259d21bb371 Mon Sep 17 00:00:00 2001 From: Felix Breuer Date: Thu, 25 May 2023 17:02:57 +0200 Subject: [PATCH 1/4] add flacor id to metics Signed-off-by: Felix Breuer --- internal/helper/loadbalancermachine.go | 5 +++++ 1 file changed, 5 insertions(+) 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 { From e32e230534958381f446d4e369d889f38f925600 Mon Sep 17 00:00:00 2001 From: Felix Breuer Date: Tue, 30 May 2023 10:09:59 +0200 Subject: [PATCH 2/4] add flavorid to lb metrics Signed-off-by: Felix Breuer --- internal/helper/loadbalancer.go | 5 +++++ 1 file changed, 5 insertions(+) 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 { From 8a9d6e2e5006e6613596818f7fded2f50f37e0a4 Mon Sep 17 00:00:00 2001 From: Felix Breuer Date: Wed, 31 May 2023 14:41:36 +0200 Subject: [PATCH 3/4] add flavorID to metrics Signed-off-by: Felix Breuer --- internal/metrics/metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index 867d9e60..464f7fbf 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", "flavorID", "floatingID", "securityGroupID"}) // 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", "flavorID", "serverID"}) ) func init() { From ec9447a131db5407fbab5e696f6456ec5dc87394 Mon Sep 17 00:00:00 2001 From: Felix Breuer Date: Wed, 31 May 2023 15:51:28 +0200 Subject: [PATCH 4/4] reorder metrics Signed-off-by: Felix Breuer --- internal/metrics/metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index 464f7fbf..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", "flavorID", "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", "flavorID", "serverID"}) + }, []string{"lb", "lbm", "namespace", "portID", "serverID", "flavorID"}) ) func init() {