Skip to content

Conversation

@igorniebylski
Copy link
Contributor

quasardb.stats module expects that each statistic has three entries:

$qdb.statistic.stat
$qdb.statistic.stat.type
$qdb.statistic.stat.unit

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

{
"stat_name": {"value": None, "type": "type", "unit": "unit"},
}

depends on .type and .unit being 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.

Copilot AI review requested due to automatic review settings November 14, 2025 07:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Exception with logger.warning and continue for missing metrics in the index
  • Applied the fix to both _by_uid and _cumulative functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Internal stuff we don't care about nor cannot do anything with
continue

if not metric in idx:
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

[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:'.

Copilot uses AI. Check for mistakes.
# Internal stuff we don't care about nor cannot do anything with
continue

if not metric in idx:
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

[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:

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@solatis solatis left a comment

Choose a reason for hiding this comment

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

LGTM

@igorniebylski igorniebylski merged commit d4875de into master Nov 14, 2025
9 checks passed
@igorniebylski igorniebylski deleted the sc-16746/flaky-test-stats-by-node-test-in-python-api branch November 14, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants