Skip to content

chore: Extend byte counters with a total amount of bytes since creation - #26933

Open
abies wants to merge 1 commit into
mainfrom
26930-bytes-counter
Open

chore: Extend byte counters with a total amount of bytes since creation#26933
abies wants to merge 1 commit into
mainfrom
26930-bytes-counter

Conversation

@abies

@abies abies commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Description:
Possibility of retrieving the number of bytes read/written by a connection without stepping on the toes of metrics.

Proper way to do that would be probably redesigning metrics to NOT reset the counter, but hold a local copy of the last read count, it is a bigger change, and given that metrics are redesigned anyway, probably future work.

It is needed to implement per-connection throttling for sync/broadcast (#18762)

Related issue(s):

Fixes #26930

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Artur Biesiadowski <artur.biesiadowski@swirldslabs.com>
@abies abies added this to the v0.79 milestone Aug 21, 2026
@abies
abies requested a review from mxtartaglia-sl August 21, 2026 12:57
@abies abies self-assigned this Aug 21, 2026
@abies
abies requested a review from a team as a code owner August 21, 2026 12:57
@lfdt-bot

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...onsensus/io/counting/internal/FastByteCounter.java 0.00% 2 Missing ⚠️

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #26933      +/-   ##
============================================
+ Coverage     70.47%   70.53%   +0.05%     
- Complexity    11685    11689       +4     
============================================
  Files          2586     2586              
  Lines        108464   108474      +10     
  Branches      12141    12141              
============================================
+ Hits          76444    76510      +66     
+ Misses        28037    27980      -57     
- Partials       3983     3984       +1     
Files with missing lines Coverage Δ Complexity Δ
...a/org/hiero/consensus/io/counting/ByteCounter.java 33.33% <ø> (ø) 0.00 <0.00> (ø)
...us/io/counting/internal/ThreadSafeByteCounter.java 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...onsensus/io/counting/internal/FastByteCounter.java 44.44% <0.00%> (-12.70%) 0.00 <0.00> (ø)

... and 18 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@testlens-app

testlens-app Bot commented Aug 21, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 705bb15
▶️ Tests: 38110 executed
⚪️ Checks: 56/56 completed


Learn more about TestLens at testlens.app/docs.

public class FastByteCounter implements ModifiableByteCounter {

private long count;
private long resetSoFar;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i would suggest calling it something like historicValue or nonResetValue

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.

Easy way to count bytes received from a stream

3 participants