Skip to content

Commit

Permalink
add lb name to lb metrics (#29)
Browse files Browse the repository at this point in the history
* add lb name to lb metrics

* docs/metrics.md update

Co-authored-by: Schlotter, Christian <[email protected]>
  • Loading branch information
sbueringer and chrischdi authored Mar 3, 2021
1 parent 97db1c5 commit 80d5426
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,16 @@ kos_firewall_v2_group_status{description="",egressPolicyID="cbb204f5-3a92-427f-b
kos_firewall_v2_group_status{description="",egressPolicyID="cbb204f5-3a92-427f-b082-c34a004856df",id="f4d10c07-4b29-4b91-a57c-7a4762634f90",ingressPolicyID="ca06e59e-5d49-4944-80a6-f14e01edc01c",name="my-firewall",projectID="1b08db53fdec4c498a15ad7d027eac4f",status="PENDING_CREATE"} 0
kos_firewall_v2_group_status{description="",egressPolicyID="cbb204f5-3a92-427f-b082-c34a004856df",id="f4d10c07-4b29-4b91-a57c-7a4762634f90",ingressPolicyID="ca06e59e-5d49-4944-80a6-f14e01edc01c",name="my-firewall",projectID="1b08db53fdec4c498a15ad7d027eac4f",status="PENDING_DELETE"} 0
kos_firewall_v2_group_status{description="",egressPolicyID="cbb204f5-3a92-427f-b082-c34a004856df",id="f4d10c07-4b29-4b91-a57c-7a4762634f90",ingressPolicyID="ca06e59e-5d49-4944-80a6-f14e01edc01c",name="my-firewall",projectID="1b08db53fdec4c498a15ad7d027eac4f",status="PENDING_UPDATE"} 0
kos_loadbalancer_admin_state_up{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",vip_address="10.6.0.8"} 1
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="ACTIVE",vip_address="10.6.0.8"} 1
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="ALLOCATED",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="BOOTING",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="DELETED",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="ERROR",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="PENDING_CREATE",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="PENDING_DELETE",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="PENDING_UPDATE",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="READY",vip_address="10.6.0.8"} 0
kos_loadbalancer_admin_state_up{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",vip_address="10.6.0.8"} 1
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="ACTIVE",vip_address="10.6.0.8"} 1
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="ALLOCATED",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="BOOTING",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="DELETED",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="ERROR",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="PENDING_CREATE",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="PENDING_DELETE",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="PENDING_UPDATE",vip_address="10.6.0.8"} 0
kos_loadbalancer_provisioning_status{id="059e7a29-5229-409e-870d-6ceb9c1059a9",name="foo",port_id="10902a71-299d-4666-b086-1a0725288dac",provider="vmwareedge",provisioning_status="READY",vip_address="10.6.0.8"} 0
kos_neutron_floating_ip_status{fixed_ip="",floating_ip="172.17.0.161",id="aa8ae8f5-fd6e-49fc-a755-93cccc74ae11",port_id=""} 1
kos_neutron_floating_ip_status{fixed_ip="",floating_ip="172.17.0.174",id="ed22b15f-05fd-401d-8bb1-9745c7b8e93d",port_id=""} 1
kos_neutron_floating_ip_status{fixed_ip="10.6.0.8",floating_ip="172.17.0.173",id="81a46647-ff4e-4697-9162-f802a15e88a5",port_id="10902a71-299d-4666-b086-1a0725288dac"} 1
Expand Down
4 changes: 2 additions & 2 deletions pkg/metrics/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var (
// possible load balancer provisioning states, from https://github.com/openstack/octavia-lib/blob/fe022cdf14604206af783c8a0887c008c48fd053/octavia_lib/common/constants.py#L169
provisioningStates = []string{"ALLOCATED", "BOOTING", "READY", "ACTIVE", "PENDING_DELETE", "PENDING_UPDATE", "PENDING_CREATE", "DELETED", "ERROR"}

loadBalancerLabels = []string{"id", "vip_address", "provider", "port_id"}
loadBalancerLabels = []string{"id", "name", "vip_address", "provider", "port_id"}
)

func registerLoadBalancerMetrics() {
Expand Down Expand Up @@ -71,7 +71,7 @@ func PublishLoadBalancerMetrics(client *gophercloud.ServiceClient, tenantID stri

// publishLoadBalancerMetric extracts data from a load balancer and exposes the metrics via prometheus
func publishLoadBalancerMetric(lb loadbalancers.LoadBalancer) {
labels := []string{lb.ID, lb.VipAddress, lb.Provider, lb.VipPortID}
labels := []string{lb.ID, lb.Name, lb.VipAddress, lb.Provider, lb.VipPortID}

loadbalancerAdminStateUp.WithLabelValues(labels...).Set(boolFloat64(lb.AdminStateUp))

Expand Down

0 comments on commit 80d5426

Please sign in to comment.