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

[Metricbeat] Fix silent failures in kafka and prometheus #13353

Merged
merged 4 commits into from
Aug 27, 2019
Merged

[Metricbeat] Fix silent failures in kafka and prometheus #13353

merged 4 commits into from
Aug 27, 2019

Conversation

kaiyan-sheng
Copy link
Contributor

This PR contains two tiny fixes for silent failures due to missing proper return error. One is in kafka module, when GetAvailableOffsets failed, the error is not reported. The other place is in prometheus module, it silently fails if metric name is incorrect (#13252).

@kaiyan-sheng kaiyan-sheng requested a review from a team as a code owner August 26, 2019 23:34
@kaiyan-sheng kaiyan-sheng self-assigned this Aug 26, 2019
metricbeat/module/kafka/partition/partition.go Outdated Show resolved Hide resolved
metricbeat/helper/prometheus/prometheus.go Outdated Show resolved Hide resolved
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

LGTM

Only one extra suggestion, what do you think about logging the error in the kafka module at the debug level only? (the one that is logged now at the error level if !offOk). These errors can flood logs when happen.

}

block := resp.GetBlock(topic, partition)
if len(block.Offsets) == 0 {
return -1, nil
return -1, errors.Wrap(block.Err, "block offsets is empty")
Copy link
Member

Choose a reason for hiding this comment

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

I am worried this can change some behaviour. But I don't think so, at the end an error was reported by the metricset on this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah previously it will return nil but offOK returned from queryOffsetRange will still be false so it goes into the same if statement.

@kaiyan-sheng
Copy link
Contributor Author

LGTM

Only one extra suggestion, what do you think about logging the error in the kafka module at the debug level only? (the one that is logged now at the error level if !offOk). These errors can flood logs when happen.

Yeah good point!

@kaiyan-sheng kaiyan-sheng merged commit 43ee008 into elastic:master Aug 27, 2019
@kaiyan-sheng kaiyan-sheng deleted the error_msg branch August 27, 2019 17:21
@zube zube bot added [zube]: Done and removed [zube]: Inbox labels Aug 27, 2019
jsoriano pushed a commit to jsoriano/beats that referenced this pull request Aug 28, 2019
* Fix silent failures in kafka and prometheus
* Change error log to warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metricbeat Metricbeat review Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants