mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-28 23:56:36 +00:00
Merge pull request #1184 from peekjef72/update-terminal_services
fix Terminal Service duplicate session names under load.
This commit is contained in:
@@ -261,6 +261,7 @@ func (c *TerminalServicesCollector) collectTSSessionCounters(ctx *ScrapeContext,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
names := make(map[string]bool)
|
||||||
|
|
||||||
for _, d := range dst {
|
for _, d := range dst {
|
||||||
// only connect metrics for remote named sessions
|
// only connect metrics for remote named sessions
|
||||||
@@ -268,6 +269,12 @@ func (c *TerminalServicesCollector) collectTSSessionCounters(ctx *ScrapeContext,
|
|||||||
if n == "" || n == "services" || n == "console" {
|
if n == "" || n == "services" || n == "console" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// don't add name already present in labels list
|
||||||
|
if _, ok := names[n]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
names[n] = true
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.HandleCount,
|
c.HandleCount,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
|
|||||||
Reference in New Issue
Block a user