@cryptotaxi247 / netdata-1 / commits / 962536406

fix(go.d/apache): make ?auto param check non-fatal (#19580)

Ilya Mashchenko committed Feb 5, 2025 at 15:20 UTC 9625364069b9044924bc8fe94b4a58e858512026
2 files changed +6 -6
src/go/plugin/go.d/collector/apache/collector_test.go
+5 -5
@@ -53,19 +53,19 @@ func TestCollector_Init(t *testing.T) {
53 wantFail: false,
54 config: New().Config,
55 },
56 - "fail when URL not set": {
57 - wantFail: true,
56 + "success when URL has no wantMetrics suffix": {
57 + wantFail: false,
58 config: Config{
59 HTTPConfig: web.HTTPConfig{
60 - RequestConfig: web.RequestConfig{URL: ""},
60 + RequestConfig: web.RequestConfig{URL: "http://127.0.0.1:38001"},
61 },
62 },
63 },
64 - "fail when URL has no wantMetrics suffix": {
64 + "fail when URL not set": {
65 wantFail: true,
66 config: Config{
67 HTTPConfig: web.HTTPConfig{
68 - RequestConfig: web.RequestConfig{URL: "http://127.0.0.1:38001"},
68 + RequestConfig: web.RequestConfig{URL: ""},
69 },
70 },
71 },
src/go/plugin/go.d/collector/apache/init.go
+1 -1
@@ -15,7 +15,7 @@ func (c *Collector) validateConfig() error {
15 return errors.New("url not set")
16 }
17 if !strings.HasSuffix(c.URL, "?auto") {
18 - return errors.New("invalid URL, should ends in '?auto'")
18 + c.Warningf("missing '?auto' parameter - needed for machine-readable output")
19 }
20 return nil
21 }