remove known session name

Signed-off-by: Peekjef72 <67902897+peekjef72@users.noreply.github.com>
This commit is contained in:
Peekjef72 2023-04-15 11:20:07 +02:00 committed by Ben Reedy
parent 4077290659
commit 8b74c77663
No known key found for this signature in database
GPG Key ID: 235C15B6086C9D7E
1 changed files with 7 additions and 0 deletions

View File

@ -261,6 +261,7 @@ func (c *TerminalServicesCollector) collectTSSessionCounters(ctx *ScrapeContext,
if err != nil {
return nil, err
}
names := make(map[string]bool)
for _, d := range dst {
// only connect metrics for remote named sessions
@ -268,6 +269,12 @@ func (c *TerminalServicesCollector) collectTSSessionCounters(ctx *ScrapeContext,
if n == "" || n == "services" || n == "console" {
continue
}
// don't add name already present in labels list
if _, ok := names[n]; ok {
continue
}
names[n] = true
ch <- prometheus.MustNewConstMetric(
c.HandleCount,
prometheus.GaugeValue,