fix(go.d): skip writing HOST line for vnodes with no collected metrics (#20995)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Ilya Mashchenko committed
Sep 17, 2025 at 13:24 UTC
caeb68d272be1acf7369aa952564de7464a51752
1 file changed
+5
src/go/plugin/go.d/agent/module/job.go
+5
@@ -439,6 +439,7 @@ func (j *Job) processMetrics(metrics map[string]int64, startTime time.Time, sinc
439
}
440
}
441
442
+ bufLenBeforeHost := j.buf.Len()
443
j.api.HOST(j.vnode.GUID)
444
445
elapsed := int64(durationTo(time.Since(startTime), time.Millisecond))
@@ -468,6 +469,10 @@ func (j *Job) processMetrics(metrics map[string]int64, startTime time.Time, sinc
469
}
470
*j.charts = (*j.charts)[:i]
471
472
+ if updated == 0 && j.vnode.GUID != "" {
473
+ j.buf.Truncate(bufLenBeforeHost)
474
+ }
475
+
476
j.api.HOST("")
477
478
if !j.collectStatusChart.created || createChart {