aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/rpcserver
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-10-18 14:10:33 +0200
committerTaras Madan <tarasmadan@google.com>2024-10-25 12:08:02 +0000
commitc0aa87d6da9bb0a5b04e70e4d2bb3cd187c566b6 (patch)
tree623be3ebff9fe881cfabe3f6214e7283429a3a22 /pkg/rpcserver
parent668455c34bb42e5068264dae8ba909be95260c81 (diff)
pkg/manager: support multiple pools in Web UI
Diffstat (limited to 'pkg/rpcserver')
-rw-r--r--pkg/rpcserver/rpcserver.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/pkg/rpcserver/rpcserver.go b/pkg/rpcserver/rpcserver.go
index 76f1ddc68..10455cee7 100644
--- a/pkg/rpcserver/rpcserver.go
+++ b/pkg/rpcserver/rpcserver.go
@@ -8,6 +8,7 @@ import (
"context"
"errors"
"fmt"
+ "net/url"
"slices"
"sort"
"strings"
@@ -103,12 +104,27 @@ type Stats struct {
}
func NewStats() Stats {
+ return NewNamedStats("")
+}
+
+func NewNamedStats(name string) Stats {
+ suffix := name
+ if suffix != "" {
+ suffix = " [" + suffix + "]"
+ }
+ vmsLink := "/vms"
+ if name != "" {
+ vmsLink += "?pool=" + url.QueryEscape(name)
+ }
return Stats{
- StatExecs: stat.New("exec total", "Total test program executions",
- stat.Console, stat.Rate{}, stat.Prometheus("syz_exec_total")),
- StatNumFuzzing: stat.New("fuzzing VMs",
- "Number of VMs that are currently fuzzing", stat.Graph("fuzzing VMs")),
- StatVMRestarts: stat.New("vm restarts", "Total number of VM starts",
+ StatExecs: stat.New("exec total"+suffix, "Total test program executions",
+ stat.Console, stat.Rate{}, stat.Prometheus("syz_exec_total"+name),
+ ),
+ StatNumFuzzing: stat.New("fuzzing VMs"+suffix,
+ "Number of VMs that are currently fuzzing", stat.Graph("fuzzing VMs"),
+ stat.Link(vmsLink),
+ ),
+ StatVMRestarts: stat.New("vm restarts"+suffix, "Total number of VM starts",
stat.Rate{}, stat.NoGraph),
}
}