Skip to content

Commit

Permalink
fix(go.d/apache): make ?auto param check non-fatal (netdata#19580)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyam8 authored Feb 5, 2025
1 parent 4dd3026 commit 9625364
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/go/plugin/go.d/collector/apache/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ func TestCollector_Init(t *testing.T) {
wantFail: false,
config: New().Config,
},
"fail when URL not set": {
wantFail: true,
"success when URL has no wantMetrics suffix": {
wantFail: false,
config: Config{
HTTPConfig: web.HTTPConfig{
RequestConfig: web.RequestConfig{URL: ""},
RequestConfig: web.RequestConfig{URL: "http://127.0.0.1:38001"},
},
},
},
"fail when URL has no wantMetrics suffix": {
"fail when URL not set": {
wantFail: true,
config: Config{
HTTPConfig: web.HTTPConfig{
RequestConfig: web.RequestConfig{URL: "http://127.0.0.1:38001"},
RequestConfig: web.RequestConfig{URL: ""},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/go/plugin/go.d/collector/apache/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (c *Collector) validateConfig() error {
return errors.New("url not set")
}
if !strings.HasSuffix(c.URL, "?auto") {
return errors.New("invalid URL, should ends in '?auto'")
c.Warningf("missing '?auto' parameter - needed for machine-readable output")
}
return nil
}
Expand Down

0 comments on commit 9625364

Please sign in to comment.