added the rpx_sessions counter

This commit is contained in:
2025-08-19 22:23:22 +09:00
parent 10c139e837
commit c001458b24
8 changed files with 43 additions and 5 deletions

View File

@ -11,7 +11,8 @@ type ClientCollector struct {
ClientRoutes *prometheus.Desc
ClientPeers *prometheus.Desc
PtySessions *prometheus.Desc
RptySessions *prometheus.Desc
RptySessions *prometheus.Desc
RpxSessions *prometheus.Desc
}
// NewClientCollector returns a new ClientCollector with all prometheus.Desc initialized
@ -58,6 +59,11 @@ func NewClientCollector(client *Client) ClientCollector {
"Number of rpty sessions",
nil, nil,
),
RpxSessions: prometheus.NewDesc(
prefix + "rpx_sessions",
"Number of rpx sessions",
nil, nil,
),
}
}
@ -68,6 +74,7 @@ func (c ClientCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.ClientPeers
ch <- c.PtySessions
ch <- c.RptySessions
ch <- c.RpxSessions
}
func (c ClientCollector) Collect(ch chan<- prometheus.Metric) {
@ -110,4 +117,10 @@ func (c ClientCollector) Collect(ch chan<- prometheus.Metric) {
prometheus.GaugeValue,
float64(c.client.stats.rpty_sessions.Load()),
)
ch <- prometheus.MustNewConstMetric(
c.RpxSessions,
prometheus.GaugeValue,
float64(c.client.stats.rpx_sessions.Load()),
)
}