Skip to content

Refactoring: use new Fetch interface that automatically reports and logs errors#11763

Merged
ycombinator merged 4 commits intoelastic:masterfrom
ycombinator:refactoring-mb-kb-fetch
Apr 12, 2019
Merged

Refactoring: use new Fetch interface that automatically reports and logs errors#11763
ycombinator merged 4 commits intoelastic:masterfrom
ycombinator:refactoring-mb-kb-fetch

Conversation

@ycombinator
Copy link
Copy Markdown
Contributor

@ycombinator ycombinator commented Apr 11, 2019

Refactors code in the kibana Metricbeat module to use the new Fetch interface 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.

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/stack-monitoring

@ycombinator ycombinator marked this pull request as ready for review April 11, 2019 12:32
@ycombinator ycombinator requested a review from a team as a code owner April 11, 2019 12:32
if err != nil {
m.Logger().Error(err)
return
return nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be return err here? Also is m.Logger above still needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the note in the PR description about x-pack code paths 😄.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh good to know! Thanks!

@ycombinator
Copy link
Copy Markdown
Contributor Author

Reviewers: I plan to put up similar PRs to this one for the elasticsearch and logstash modules. I broke out the kibana module changes into its own PR so we can hash out any issues with the approach first before applying it to all stack modules. Plus it should make reviewing a bit easier too.

Copy link
Copy Markdown
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, just realised this might be odd when x-pack is enabled and we send up an error event ...

Copy link
Copy Markdown
Contributor Author

@ycombinator ycombinator Apr 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment around that line now so hopefully it's a bit clearer now.

@ycombinator ycombinator merged commit 462f798 into elastic:master Apr 12, 2019
@ycombinator ycombinator added the needs_backport PR is waiting to be backported to other branches. label Apr 12, 2019
@ycombinator ycombinator deleted the refactoring-mb-kb-fetch branch December 25, 2019 11:17
@ycombinator ycombinator removed the needs_backport PR is waiting to be backported to other branches. label Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants