Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Apr 12, 2019

Conversation

ycombinator
Copy link
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.

@ycombinator ycombinator force-pushed the refactoring-mb-kb-fetch branch from 5e0f2f3 to 8569a60 Compare April 11, 2019 12:30
@elasticmachine
Copy link
Collaborator

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 m.XPackEnabled {
intervalMs := m.calculateIntervalMs()
err = eventMappingStatsXPack(r, intervalMs, now, content)
if err != nil {
m.Logger().Error(err)
return
return nil
Copy link
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
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
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
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
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
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
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
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
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