terminal_services: Avoid duplicate metrics by add session_id (#1576)

This commit is contained in:
Jan-Otto Kröpke 2024-08-20 19:24:08 +02:00 committed by GitHub
parent 2589e56f95
commit 56709b9638
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ package terminal_services
import ( import (
"errors" "errors"
"fmt" "fmt"
"strconv"
"strings" "strings"
"syscall" "syscall"
@ -123,7 +124,7 @@ func (c *Collector) Build() error {
c.sessionInfo = prometheus.NewDesc( c.sessionInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "session_info"), prometheus.BuildFQName(types.Namespace, Name, "session_info"),
"Terminal Services sessions info", "Terminal Services sessions info",
[]string{"session_name", "user", "host", "state"}, []string{"session_name", "user", "host", "state", "id"},
nil, nil,
) )
c.connectionBrokerPerformance = prometheus.NewDesc( c.connectionBrokerPerformance = prometheus.NewDesc(
@ -445,6 +446,7 @@ func (c *Collector) collectWTSSessions(ch chan<- prometheus.Metric) error {
userName, userName,
session.HostName, session.HostName,
stateName, stateName,
strconv.Itoa(int(session.SessionID)),
) )
} }
} }