10000 feat: include read/write byte stats in scaletests JSON report by cstyan · Pull Request #17777 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: include read/write byte stats in scaletests JSON report #17777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Prev Previous commit
Rename CollectableFn, it also doesn't need to be exported
Signed-off-by: Callum Styan <callumstyan@gmail.com>
  • Loading branch information
cstyan committed Jun 13, 2025
commit 4ab9d1ed687e55380beafa85976897071243e235
2 changes: 1 addition & 1 deletion scaletest/harness/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Cleanable interface {
Cleanup(ctx context.Context, id string, logs io.Writer) error
}

// Collectable is an optional extension to Runnable that allows to get metrics from the runner
// Collectable is an optional extension to Runnable that allows to get metrics from the runner.
type Collectable interface {
Runnable
// Gets the bytes transferred
Expand Down
12 changes: 6 additions & 6 deletions scaletest/harness/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type testFns struct {
RunFn func(ctx context.Context, id string, logs io.Writer) error
// CleanupFn is optional if no cleanup is required.
CleanupFn func(ctx context.Context, id string, logs io.Writer) error
// CollectableFn is optional if byte transfer tracking is required.
CollectableFn func() (int64, int64)
// getBytesTransferred is optional if byte transfer tracking is required.
getBytesTransferred func() (int64, int64)
}

// Run implements Runnable.
Expand All @@ -28,11 +28,11 @@ func (fns testFns) Run(ctx context.Context, id string, logs io.Writer) error {

// GetBytesTransferred implements Collectable.
func (fns testFns) GetBytesTransferred() (bytesRead int64, bytesWritten int64) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious what's going on with this pattern, but your addition seems totally in line with what's already here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I don't particularly like it, feels odd/reads strangely, but it's already in use for the cleanable interface as well so 🤷

if fns.CollectableFn == nil {
if fns.getBytesTransferred == nil {
return 0, 0
}

return fns.CollectableFn()
return fns.getBytesTransferred()
}

// Cleanup implements Cleanable.
Expand Down Expand Up @@ -65,7 +65,7 @@ func Test_TestRun(t *testing.T) {
atomic.AddInt64(&cleanupCalled, 1)
return nil
},
CollectableFn: func() (int64, int64) {
getBytesTransferred: func() (int64, int64) {
atomic.AddInt64(&collectableCalled, 1)
return 0, 0
},
Expand Down Expand Up @@ -132,7 +132,7 @@ func Test_TestRun(t *testing.T) {
RunFn: func(ctx context.Context, id string, logs io.Writer) error {
return nil
},
CollectableFn: nil,
getBytesTransferred: nil,
})

err := run.Run(context.Background())
Expand Down
Loading
0