QDB-16746 - Flaky test test_stats_by_node#106
Merged
igorniebylski merged 1 commit intomasterfrom Nov 14, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a flaky test by addressing a race condition where statistics may be incomplete when queried from a fresh or purged cluster. The fix replaces exception raising with warning logging when metrics are not found in the internal index.
- Replaced
raise Exceptionwithlogger.warningandcontinuefor missing metrics in the index - Applied the fix to both
_by_uidand_cumulativefunctions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -326,7 +326,8 @@ def _by_uid( | |||
| continue | |||
|
|
|||
| if not metric in idx: | |||
There was a problem hiding this comment.
[nitpick] Use the Pythonic 'metric not in idx' syntax instead of 'not metric in idx' for better readability. Change to 'if metric not in idx:'.
| @@ -362,7 +363,8 @@ def _cumulative( | |||
| continue | |||
|
|
|||
| if not metric in idx: | |||
There was a problem hiding this comment.
[nitpick] Use the Pythonic 'metric not in idx' syntax instead of 'not metric in idx' for better readability. Change to 'if metric not in idx:'.
Suggested change
| if not metric in idx: | |
| if metric not in idx: |
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.
quasardb.statsmodule expects that each statistic has three entries:But after launching a fresh cluster / purging cluster we can run into situation where we pull statistics and get only
$qdb.statistic.stat.Module expects that all three entries are present, logic of creating statistics index dictionary
depends on
.typeand.unitbeing present. Exception was raised if statistic name was present in the cluster but wasn't present in the statistics index dictionary.To fix: from now log a warning instead of raising an exception when checking if statistic name is present in the index dict.