Skip to content

Conversation

@luohoufu
Copy link
Contributor

@luohoufu luohoufu commented Apr 9, 2025

What does this PR do

This pull request includes an important change to the QueryQPS function in the modules/elastic/api/v1/cluster_overview.go file. The change improves the precision of the QPS calculations by using the util.ToFixed function to round the results to two decimal places.

Precision improvement in QPS calculations:

Rationale for this change

image

Standards checklist

  • The PR title is descriptive
  • The commit messages are semantic
  • Necessary tests are added
  • Updated the release notes
  • Necessary documents have been added if this is a new feature
  • Performance tests checked, no obvious performance degradation

@luohoufu luohoufu requested a review from Copilot April 9, 2025 01:42
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.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

modules/elastic/api/v1/cluster_overview.go:830

  • Consider adding unit tests that explicitly verify the precision of the rounded QPS values to ensure that util.ToFixed behaves as expected in this context.
indexQPS[k]["index"] = util.ToFixed(maxIndexRate/float64(bucketSizeInSeconds), 2)

@luohoufu luohoufu merged commit cbf88f0 into main Apr 11, 2025
6 checks passed
@luohoufu luohoufu deleted the fix_float_pr branch April 11, 2025 07:19
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.

5 participants