Fix: Exclude all non-OK HTTP status codes from lag calculation#183
Draft
Fix: Exclude all non-OK HTTP status codes from lag calculation#183
Conversation
Previously, only hosts returning 404 were excluded from lag calculations. This caused hosts returning other error codes (500, 503, etc.) to still be used in lag calculations, even though they were unhealthy. Changed the condition to exclude any host with non-OK (non-200) HTTP status. - Updated pkg/throttle/mysql.go to check for != StatusOK instead of == StatusNotFound - Added test case to verify 500 and 503 status codes are properly excluded Co-authored-by: alexisjcarr <[email protected]>
Copilot
AI
changed the title
[WIP] Fix lag calculation using hosts that return 404
Fix: Exclude all non-OK HTTP status codes from lag calculation
Feb 13, 2026
The original code that excluded only 404 status was correct. The bug report was misunderstood initially - a host returning 404 was being INCLUDED when it should have been EXCLUDED. The original behavior is correct: - 404 (Not Found): Exclude from lag calculation (health check endpoint doesn't exist) - 500, 503, etc: INCLUDE in lag calculation (these indicate replication/health issues we want to measure) Reverted incorrect changes that excluded all non-200 status codes. Co-authored-by: alexisjcarr <[email protected]>
The bug was that when HTTP check results were missing from the map (value = 0), hosts were incorrectly included in lag calculations. Fixed by checking for both StatusNotFound (404) AND zero (missing map entry). - Updated aggregateMySQLProbes to check: httpStatus == StatusNotFound || httpStatus == 0 - Added test case TestAggregateMySQLProbesWithMissingHttpChecks to validate fix - All existing tests pass Co-authored-by: alexisjcarr <[email protected]>
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.
Created Beginner-Friendly Documentation 📚
Documentation Created
Created three comprehensive guides for explaining the bug fix to a day 1 intern:
intern_explanation.md - Complete explanation with analogies
visual_explanation.txt - ASCII diagrams
code_walkthrough.md - Line-by-line code explanation
Key Teaching Points
Checklist
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.