Convert Prometheus percents to ratio

Typically we like to use ratio in Prometheus rather than percent as it
is easier to do math with.

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie
2019-12-01 19:48:59 +01:00
parent 3b515b854e
commit 1df763e684
4 changed files with 18 additions and 18 deletions

View File

@@ -78,7 +78,7 @@ func descUSW(ns string) *usw {
RxErrors: prometheus.NewDesc(pns+"receive_errors_total", "Total Receive Errors", labelP, nil),
RxMulticast: prometheus.NewDesc(pns+"receive_multicast_total", "Total Receive Multicast", labelP, nil),
RxPackets: prometheus.NewDesc(pns+"receive_packets_total", "Total Receive Packets", labelP, nil),
Satisfaction: prometheus.NewDesc(pns+"satisfaction_percent", "Satisfaction", labelP, nil),
Satisfaction: prometheus.NewDesc(pns+"satisfaction_ratoi", "Satisfaction", labelP, nil),
Speed: prometheus.NewDesc(pns+"port_speed_bps", "Speed", labelP, nil),
TxBroadcast: prometheus.NewDesc(pns+"transmit_broadcast_total", "Total Transmit Broadcast", labelP, nil),
TxBytes: prometheus.NewDesc(pns+"transmit_bytes_total", "Total Transmit Bytes", labelP, nil),
@@ -168,7 +168,7 @@ func (u *promUnifi) exportPortTable(r report, labels []string, pt []unifi.Port)
{u.USW.RxErrors, prometheus.CounterValue, p.RxErrors, labelP},
{u.USW.RxMulticast, prometheus.CounterValue, p.RxMulticast, labelP},
{u.USW.RxPackets, prometheus.CounterValue, p.RxPackets, labelP},
{u.USW.Satisfaction, prometheus.GaugeValue, p.Satisfaction, labelP},
{u.USW.Satisfaction, prometheus.GaugeValue, p.Satisfaction.Val / 100.0, labelP},
{u.USW.Speed, prometheus.GaugeValue, p.Speed.Val * 1000000, labelP},
{u.USW.TxBroadcast, prometheus.CounterValue, p.TxBroadcast, labelP},
{u.USW.TxBytes, prometheus.CounterValue, p.TxBytes, labelP},