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

@@ -12,7 +12,8 @@ type ServerCollector struct {
ServerPeers *prometheus.Desc
SshProxySessions *prometheus.Desc
PtySessions *prometheus.Desc
RptySessions *prometheus.Desc
RptySessions *prometheus.Desc
RpxSessions *prometheus.Desc
}
// NewServerCollector returns a new ServerCollector with all prometheus.Desc initialized
@@ -64,6 +65,11 @@ func NewServerCollector(server *Server) ServerCollector {
"Number of rpty session",
nil, nil,
),
RpxSessions: prometheus.NewDesc(
prefix + "rpx_sessions",
"Number of rpx session",
nil, nil,
),
}
}
@@ -75,6 +81,7 @@ func (c ServerCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.SshProxySessions
ch <- c.PtySessions
ch <- c.RptySessions
ch <- c.RpxSessions
}
func (c ServerCollector) Collect(ch chan<- prometheus.Metric) {
@@ -123,4 +130,10 @@ func (c ServerCollector) Collect(ch chan<- prometheus.Metric) {
prometheus.GaugeValue,
float64(c.server.stats.rpty_sessions.Load()),
)
ch <- prometheus.MustNewConstMetric(
c.RpxSessions,
prometheus.GaugeValue,
float64(c.server.stats.rpx_sessions.Load()),
)
}