From 1cfccdca0f555a0fba007f62107d5d0ed22a9e1e Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Fri, 13 Oct 2023 14:49:20 +0300 Subject: [PATCH] write only CHART if obsolete (#1370) --- agent/module/job.go | 5 +++++ agent/netdataapi/api.go | 2 +- agent/netdataapi/api_test.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/agent/module/job.go b/agent/module/job.go index 1c4db5173..8af098ce1 100644 --- a/agent/module/job.go +++ b/agent/module/job.go @@ -435,6 +435,11 @@ func (j *Job) createChart(chart *Chart) { j.moduleName, ) + if chart.Obsolete { + _ = j.api.EMPTYLINE() + return + } + seen := make(map[string]bool) for _, l := range chart.Labels { if l.Key != "" { diff --git a/agent/netdataapi/api.go b/agent/netdataapi/api.go index eb3cb98a9..8345d036b 100644 --- a/agent/netdataapi/api.go +++ b/agent/netdataapi/api.go @@ -21,7 +21,7 @@ const quotes = "' '" var ( end = []byte("END\n\n") - clabelCommit = []byte("CLABEL_COMMIT\n\n") + clabelCommit = []byte("CLABEL_COMMIT\n") newLine = []byte("\n") ) diff --git a/agent/netdataapi/api_test.go b/agent/netdataapi/api_test.go index 929246abc..697c38080 100644 --- a/agent/netdataapi/api_test.go +++ b/agent/netdataapi/api_test.go @@ -160,7 +160,7 @@ func TestAPI_CLABELCOMMIT(t *testing.T) { assert.Equal( t, - "CLABEL_COMMIT\n\n", + "CLABEL_COMMIT\n", buf.String(), ) }