Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions collectors/wt_client_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type WtClientCollector struct {

numBackupsDesc *prometheus.Desc
numPendingBackupsDesc *prometheus.Desc
numSessionsDesc *prometheus.Desc

// errChan is a channel that we send any errors that we encounter into.
// This channel should be buffered so that it does not block sending.
Expand All @@ -43,6 +44,13 @@ func NewWtClientCollector(lnd *lndclient.LndServices,
"tower_pubkey",
}, nil,
),
numSessionsDesc: prometheus.NewDesc(
"lnd_wt_client_num_sessions",
"watchtower client number of sessions",
[]string{
"tower_pubkey",
}, nil,
),

errChan: errChan,
}
Expand Down Expand Up @@ -89,6 +97,7 @@ func (c *WtClientCollector) Collect(ch chan<- prometheus.Metric) {
numBackups uint32
numPendingBackups uint32
)

for _, sessionInfo := range tower.SessionInfo {
for _, session := range sessionInfo.Sessions {
numBackups += session.NumBackups
Expand All @@ -104,5 +113,9 @@ func (c *WtClientCollector) Collect(ch chan<- prometheus.Metric) {
c.numPendingBackupsDesc, prometheus.GaugeValue,
float64(numPendingBackups), pubkey,
)
ch <- prometheus.MustNewConstMetric(
c.numSessionsDesc, prometheus.GaugeValue,
float64(tower.NumSessions), pubkey,
)
}
}
Loading