Skip to content

Conversation

@jnewbigin
Copy link

@jnewbigin jnewbigin commented Nov 24, 2025

What this PR does / why we need it:
When using query-tee, it is possible for identical floating point data to be returned as different values from different cells. Floating point addition is not commutative so the result is dependent on the order that data is returned.

These differences are recorded in goldfish as a mismatch.

This fix will reuse the threshold compare to treat the values in this special case as the same and report the values as matching (even when they have a different hash value).

In order to reuse the ResponsesComparator without cyclic dependencies, it has been factored into it's own package

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@CLAassistant
Copy link

CLAassistant commented Nov 24, 2025

CLA assistant check
All committers have signed the CLA.

@jnewbigin jnewbigin force-pushed the jnewbigin/goldfish-floatingpoint branch from 7db7154 to 1594935 Compare November 24, 2025 23:02
@jnewbigin jnewbigin force-pushed the jnewbigin/goldfish-floatingpoint branch 2 times, most recently from 07f32fd to 336918b Compare November 24, 2025 23:33
@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 25, 2025
@jnewbigin jnewbigin force-pushed the jnewbigin/goldfish-floatingpoint branch from 8b96826 to 6f5b89c Compare November 25, 2025 01:09
This change relocates response comparator logic to its own package to
prevent cyclic imports and improve code organization.
No functional changes.
Some results containing floating point numbers might have different hash
values but the same effective value.

This can come about because adding floating point numbers is not commutative
@jnewbigin jnewbigin force-pushed the jnewbigin/goldfish-floatingpoint branch from 6f5b89c to af34838 Compare November 25, 2025 03:56
Copy link
Contributor

@ashwanthgoli ashwanthgoli left a comment

Choose a reason for hiding this comment

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

overall LGTM, left some minor suggestions

@jnewbigin jnewbigin marked this pull request as ready for review November 27, 2025 22:43
@jnewbigin jnewbigin requested a review from a team as a code owner November 27, 2025 22:43
Comment on lines +66 to +71
if err == nil {
result.ComparisonStatus = goldfish.ComparisonStatusMatch
result.DifferenceDetails["tolerance_match"] = true
return result
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we should not return here as we update performance stats in difference details on line 82.

it would be also nice to capture the error in DifferenceDetails to understand why the comparator failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants