Add new RemoteFX network metrics (#1489)

This commit is contained in:
Darin Truckenmiller
2024-05-15 14:13:02 -07:00
committed by GitHub
parent c242fae84c
commit 9c65b7464f
2 changed files with 51 additions and 2 deletions

View File

@@ -39,6 +39,9 @@ type collector struct {
TotalSentBytes *prometheus.Desc
UDPPacketsReceivedPersec *prometheus.Desc
UDPPacketsSentPersec *prometheus.Desc
FECRate *prometheus.Desc
LossRate *prometheus.Desc
RetransmissionRate *prometheus.Desc
// gfx
AverageEncodingTime *prometheus.Desc
@@ -134,6 +137,24 @@ func (c *collector) Build() error {
[]string{"session_name"},
nil,
)
c.FECRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_fec_rate"),
"Forward Error Correction (FEC) percentage",
[]string{"session_name"},
nil,
)
c.LossRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_loss_rate"),
"Loss percentage",
[]string{"session_name"},
nil,
)
c.RetransmissionRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_retransmission_rate"),
"Percentage of packets that have been retransmitted",
[]string{"session_name"},
nil,
)
// gfx
c.AverageEncodingTime = prometheus.NewDesc(
@@ -207,6 +228,9 @@ type perflibRemoteFxNetwork struct {
TotalSentBytes float64 `perflib:"Total Sent Bytes"`
UDPPacketsReceivedPersec float64 `perflib:"UDP Packets Received/sec"`
UDPPacketsSentPersec float64 `perflib:"UDP Packets Sent/sec"`
FECRate float64 `perflib:"Forward Error Correction (FEC) percentage"`
LossRate float64 `perflib:"Loss percentage"`
RetransmissionRate float64 `perflib:"Percentage of packets that have been retransmitted"`
}
func (c *collector) collectRemoteFXNetworkCount(ctx *types.ScrapeContext, ch chan<- prometheus.Metric) error {
@@ -282,6 +306,26 @@ func (c *collector) collectRemoteFXNetworkCount(ctx *types.ScrapeContext, ch cha
d.UDPPacketsSentPersec,
d.Name,
)
ch <- prometheus.MustNewConstMetric(
c.FECRate,
prometheus.GaugeValue,
d.FECRate,
d.Name,
)
ch <- prometheus.MustNewConstMetric(
c.LossRate,
prometheus.GaugeValue,
d.LossRate,
d.Name,
)
ch <- prometheus.MustNewConstMetric(
c.RetransmissionRate,
prometheus.GaugeValue,
d.RetransmissionRate,
d.Name,
)
}
return nil
}