RHINENG-28970: change error to warning - #2303
Merged
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR modifies the Kafka logging behavior in the message queue logger so that connection issues containing "failed to dial" are logged as warnings instead of errors, reducing noisy error reporting in Glitchtip while preserving error counting and panic detection for severe issues. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The check for "failed to dial" currently uses the format string rather than the formatted message; consider switching the
strings.Containscall to usemsgso you match the actual logged content, including interpolated values. - This change will downgrade any Kafka log that contains "failed to dial" in the format string, not just the specific reader initialization case; if that’s broader than intended, consider tightening the condition (e.g., matching the full message prefix) to avoid unintentionally reclassifying other errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The check for "failed to dial" currently uses the format string rather than the formatted message; consider switching the `strings.Contains` call to use `msg` so you match the actual logged content, including interpolated values.
- This change will downgrade any Kafka log that contains "failed to dial" in the format string, not just the specific reader initialization case; if that’s broader than intended, consider tightening the condition (e.g., matching the full message prefix) to avoid unintentionally reclassifying other errors.
## Individual Comments
### Comment 1
<location path="base/mqueue/mqueue.go" line_range="37-38" />
<code_context>
fn := func(fmt string, args ...interface{}) {
counter.Inc()
- utils.LogError("type", "kafka", format.Sprintf(fmt, args...))
+ msg := format.Sprintf(fmt, args...)
+ if strings.Contains(fmt, "failed to dial") {
+ utils.LogWarn("type", "kafka", msg)
+ } else {
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Use the formatted message for substring checks instead of the raw format string.
Currently, the check uses `strings.Contains(fmt, "failed to dial")` while the log message is built from `msg := format.Sprintf(fmt, args...)`. If "failed to dial" appears only in one of the `args` and not in the format string, the condition won’t match and the message will still be logged as an error. Checking `strings.Contains(msg, "failed to dial")` ensures the log level reflects the actual emitted message and avoids misclassification when the phrase comes from arguments rather than the template.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2303 +/- ##
==========================================
- Coverage 58.83% 58.82% -0.02%
==========================================
Files 150 150
Lines 9599 9603 +4
==========================================
+ Hits 5648 5649 +1
- Misses 3359 3360 +1
- Partials 592 594 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TenSt
requested changes
Aug 14, 2026
Downgrade kafka errors that contain 'failed to dial' and show in glitchtip as 'error initializing the kafka reader for partition X' to only warnings. This kind of error should stop appearing in glitchtip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Downgrade kafka errors that contain 'failed to dial' and show in glitchtip as 'error initializing the kafka reader for partition X' to only warnings. This kind of error should stop appearing in glitchtip.
Testing
Glitchtip should stop surfacing errors starting with "error initializing the kafka reader for partition" such as this one.
Secure Coding Practices Checklist GitHub Link
Secure Coding Checklist
Summary by Sourcery
Bug Fixes: