Skip to content

Commit e75199e

Browse files
fix: include per-host and per-client data in web UI live updates
The web UI's "By Host" and "By Client" time-series charts were not rendering because ByHost and ByClient aggregates were not included in live update payloads. This adds them so the UI can display throughput over time for each host and client.
1 parent 4bcc523 commit e75199e

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

pkg/aggregate/live.go

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ type Realtime struct {
4848

4949
Total LiveAggregate `json:"total"`
5050
ByOpType map[string]*LiveAggregate `json:"by_op_type,omitempty"`
51-
// These are really not used.
52-
ByHost map[string]*LiveAggregate `json:"by_host,omitempty"`
53-
ByObjLog2Size map[int]*LiveAggregate `json:"by_obj_log_2_size,omitempty"`
54-
ByClient map[string]*LiveAggregate `json:"by_client,omitempty"`
55-
ByCategory map[bench.Category]*LiveAggregate `json:"by_category,omitempty"`
51+
// Per-host aggregates for time-series visualization.
52+
ByHost map[string]*LiveAggregate `json:"by_host,omitempty"`
53+
ByObjLog2Size map[int]*LiveAggregate `json:"by_obj_log_2_size,omitempty"`
54+
// Per-client aggregates for time-series visualization.
55+
ByClient map[string]*LiveAggregate `json:"by_client,omitempty"`
56+
ByCategory map[bench.Category]*LiveAggregate `json:"by_category,omitempty"`
5657
}
5758

5859
type LiveAggregate struct {
@@ -705,13 +706,31 @@ func Live(ops <-chan bench.Operation, updates chan UpdateReq, clientID string, e
705706
}()
706707
wg.Wait()
707708
if updates != nil && time.Since(lastUpdate) > time.Second {
708-
u := Realtime{Total: a.Total.Update(), ByOpType: make(map[string]*LiveAggregate, len(a.ByOpType)), DataVersion: currentVersion}
709+
u := Realtime{
710+
Total: a.Total.Update(),
711+
ByOpType: make(map[string]*LiveAggregate, len(a.ByOpType)),
712+
ByHost: make(map[string]*LiveAggregate, len(a.ByHost)),
713+
ByClient: make(map[string]*LiveAggregate, len(a.ByClient)),
714+
DataVersion: currentVersion,
715+
}
709716
for k, v := range a.ByOpType {
710717
if v != nil {
711718
clone := v.Update()
712719
u.ByOpType[k] = &clone
713720
}
714721
}
722+
for k, v := range a.ByHost {
723+
if v != nil {
724+
clone := v.Update()
725+
u.ByHost[k] = &clone
726+
}
727+
}
728+
for k, v := range a.ByClient {
729+
if v != nil {
730+
clone := v.Update()
731+
u.ByClient[k] = &clone
732+
}
733+
}
715734
update.Store(&u)
716735
lastUpdate = time.Now()
717736
}

0 commit comments

Comments
 (0)