Refactoring: use new Fetch interface that automatically reports and logs errors#11763
Refactoring: use new Fetch interface that automatically reports and logs errors#11763ycombinator merged 4 commits intoelastic:masterfrom ycombinator:refactoring-mb-kb-fetch
Conversation
|
Pinging @elastic/stack-monitoring |
| if err != nil { | ||
| m.Logger().Error(err) | ||
| return | ||
| return nil |
There was a problem hiding this comment.
Should this be return err here? Also is m.Logger above still needed?
There was a problem hiding this comment.
Please see the note in the PR description about x-pack code paths 😄.
There was a problem hiding this comment.
ahh good to know! Thanks!
|
Reviewers: I plan to put up similar PRs to this one for the |
ruflin
left a comment
There was a problem hiding this comment.
LGTM. +1 on having at least 1 PR per module and not all in one.
| now := time.Now() | ||
|
|
||
| m.fetchStats(r, now) | ||
| err := m.fetchStats(r, now) |
There was a problem hiding this comment.
BTW, just realised this might be odd when x-pack is enabled and we send up an error event ...
There was a problem hiding this comment.
Actually, it won't be odd because of this line: https://github.com/elastic/beats/pull/11763/files#diff-8710596f0decaae3ca552cedea1eb0a0R153
There was a problem hiding this comment.
I added a comment around that line now so hopefully it's a bit clearer now.
Refactors code in the
kibanaMetricbeat module to use the newFetchinterface introduced in #10727.Note that x-pack code paths in this module were not refactored to use the new interface as we don't want errors from those code paths to be reported into
metricbeat-*indices, only logged to Metricbeat logs.Related: #11767 and #11795.