process: fix metric labels for multiple process instances (#1804)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke 2024-12-03 18:31:41 +01:00 committed by GitHub
parent 2aebd5c2da
commit 57a3e84cec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -362,7 +362,8 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
for name, process := range perfData {
// Duplicate processes are suffixed #, and an index number. Remove those.
name, _, _ = strings.Cut(name, ":")
name, _, _ = strings.Cut(name, ":") // Process V2
name, _, _ = strings.Cut(name, "#") // Process
if c.config.ProcessExclude.MatchString(name) || !c.config.ProcessInclude.MatchString(name) {
continue