Skip to content

Added 0 check before writeThroughpt calculation to prevent divide bytes written by 0#6734

Open
Fred1155 wants to merge 5 commits intomasterfrom
bole_fix_write_throughpt
Open

Added 0 check before writeThroughpt calculation to prevent divide bytes written by 0#6734
Fred1155 wants to merge 5 commits intomasterfrom
bole_fix_write_throughpt

Conversation

@Fred1155
Copy link
Contributor

@Fred1155 Fred1155 commented Feb 13, 2026

Motivation and Context

WRITE_THROUGHPUT metric is calculated to Double.Infinity, which cannot be emitted to EMF and is not true. This happen because when first byte time and last byte time are the same, we are dividing bytes written by 0.

Modifications

Added 0 check before bytespersec is invoked for writethroughpt

Testing

Added test case.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@Fred1155 Fred1155 requested a review from a team as a code owner February 13, 2026 17:42
@Fred1155 Fred1155 changed the title Added 0 check in bytesPerSec to prevent divide bytes written by 0 Added 0 check before writeThroughpt calculation to prevent divide bytes written by 0 Feb 13, 2026
@sonarqubecloud
Copy link

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.

2 participants