@cryptotaxi247 / netdata-1 / commits / 03716a87a

chore(go.d): skip HOST for vnodes during Cleanup with stale label (#20996)

Ilya Mashchenko committed Sep 17, 2025 at 15:23 UTC 03716a87a40ca3c072f940ea2b2be35eaef614ac
1 file changed +20 -14
src/go/plugin/go.d/agent/module/job.go
+20 -14
@@ -312,9 +312,26 @@ func (j *Job) Cleanup() {
312 return
313 }
314
315 - if !j.vnodeCreated && j.vnode.GUID != "" {
316 - j.sendVnodeHostInfo()
317 - j.vnodeCreated = true
315 + // Netdata automatically obsoletes vnode charts when no updates are sent.
316 + // For virtual nodes with a stale label, we must not send anything:
317 + // - Sending a HOST line would incorrectly mark the vnode as active.
318 + isVnodeWithStaleConfig := j.vnode.Labels["_node_stale_after_seconds"] != ""
319 +
320 + if !isVnodeWithStaleConfig {
321 + if !j.vnodeCreated && j.vnode.GUID != "" {
322 + j.sendVnodeHostInfo()
323 + j.vnodeCreated = true
324 + }
325 + j.api.HOST(j.vnode.GUID)
326 +
327 + if j.charts != nil {
328 + for _, chart := range *j.charts {
329 + if chart.created {
330 + chart.MarkRemove()
331 + j.createChart(chart)
332 + }
333 + }
334 + }
335 }
336
337 j.api.HOST("")
@@ -328,17 +345,6 @@ func (j *Job) Cleanup() {
345 j.createChart(j.collectDurationChart)
346 }
347
331 - j.api.HOST(j.vnode.GUID)
332 -
333 - if j.charts != nil {
334 - for _, chart := range *j.charts {
335 - if chart.created {
336 - chart.MarkRemove()
337 - j.createChart(chart)
338 - }
339 - }
340 - }
341 -
348 if j.buf.Len() > 0 {
349 _, _ = io.Copy(j.out, j.buf)
350 }