10000 [Antithesis] Refactor recording client management · Issue #19893 · etcd-io/etcd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Antithesis] Refactor recording client management #19893

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

Open
serathius opened this issue May 8, 2025 · 3 comments
Open

[Antithesis] Refactor recording client management #19893

serathius opened this issue May 8, 2025 · 3 comments

Comments

@serathius
Copy link
Member

What would you like to be added?

Current recording client management has a problem. It's easy to create a client and then forget to collect report from it.

Would be better if we had some higher level structure for creating clients that collects all clients and is able to return report for all clients constructed.

Why is this needed?

Make it harder to forget collecting report from client.

@nwnt
Copy link
nwnt commented May 9, 2025

Not sure if you want to discuss this in the weekly robustness call, but I can have a look at this in the meantime too.

@serathius
Copy link
Member Author

Goal is to replace something like:

reports := []report.ClientReport{}
var mux sync.Mutex
var wg sync.WaitGroup
for i:=0;i<6;i++{
  c := client.NewRecordingClient(hosts[i%len(hosts)], ids, baseTime)
  defer c.Close()
  wg.Add(1)
  go func() {
    defer wg.Done()
    traffic.RunTraffic(c...)
    mux.Lock()
    reports = append(reports, c.Report())
    mux.Unlock()
  }()
}
wg.Wait()
return reports

With

clientSet := client.NewSet(ids, baseTime)
defer clientSet.Close()
var wg sync.WaitGroup
for i:=0;i<6;i++{
  c := clientSet.NewClient(hosts[i%len(hosts)])
  wg.Add(1)
  go func() {
    defer wg.Done()
    traffic.RunTraffic(c...)
  }()
}
wg.Wait()
return clientSet.Reports()

@serathius
Copy link
Member Author

So:

  • Add a ClientSet struct that manages livecycle of clients
  • Move common arguments like ids, baseTime to ClientSet
  • All clients created are recorded within clientSet, allowing as to collect reports via clientset for all clients created by it.
  • [optional] Allow for closing clients directly or via clientset.
  • [optional] Safeguard collecting reports before all clients are closed. Prevent Creation of new clients after clientset is closed.

Note, RecordingClient is used around the code, but we don't need to refactor everything at once. Let's do it in smaller steps.

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

No branches or pull requests

2 participants
0