diff --git a/internal/web/dashboard.go b/internal/web/dashboard.go index b2a5484..4706627 100644 --- a/internal/web/dashboard.go +++ b/internal/web/dashboard.go @@ -2,7 +2,6 @@ package web import ( "context" - "fmt" "html/template" "log/slog" "net/http" @@ -37,9 +36,7 @@ type DashboardData struct { RequestSpark template.HTML TokenSpark template.HTML - UserChart template.HTML - ModelChart template.HTML - HasPeople bool + HasPeople bool // Charts are pre-rendered rather than assembled in the template: building // SVG out of template fragments is how a chart ends up unescaped. @@ -203,16 +200,7 @@ func (d *DashboardData) addPeopleAndModels(ctx context.Context, usage UsageSourc log.Warn("could not read per-user usage", "err", err) } else { d.Users = users - rows := make([]Row, 0, len(users)) - for _, u := range topUsers(users, 8) { - rows = append(rows, Row{ - Label: userLabel(u), - Value: float64(u.Tokens()), - Note: fmt.Sprintf("%d req", u.Requests), - }) - } - d.UserChart = HBarChart(rows, "--viz-1", "tok") - d.HasPeople = len(rows) > 0 + d.HasPeople = len(users) > 0 } models, err := usage.UsageByModel(ctx, since) @@ -221,45 +209,6 @@ func (d *DashboardData) addPeopleAndModels(ctx context.Context, usage UsageSourc return } d.Models2 = models - rows := make([]Row, 0, len(models)) - for i, m := range models { - if i >= 8 { - break - } - rows = append(rows, Row{ - Label: m.Model, - Value: float64(m.Requests), - Note: humanLatency(m.AvgLatency), - }) - } - d.ModelChart = HBarChart(rows, "--viz-3", "req") -} - -// userLabel names a person the way they would recognise themselves. -// -// A key with no owner predates accounts, and calling it "unknown" would imply -// something is wrong; it is an operator-issued key doing its job. -func userLabel(u store.UserUsage) string { - switch { - case u.Email != "": - return u.Email - case u.Name != "": - return u.Name - default: - return "operator-issued keys" - } -} - -// topUsers keeps the chart readable. -// -// Eight, because a ranked bar chart stops being a comparison somewhere around -// there and becomes a table drawn slowly. The full list is in the table below -// it, which is the right form for twenty rows. -func topUsers(users []store.UserUsage, n int) []store.UserUsage { - if len(users) > n { - return users[:n] - } - return users } // addCharts draws the last day of traffic. diff --git a/internal/web/static/base.css b/internal/web/static/base.css index 795d64c..c6729a5 100644 --- a/internal/web/static/base.css +++ b/internal/web/static/base.css @@ -532,3 +532,5 @@ table.repo-files td:last-child .opt { display: block; margin-bottom: .2rem; } .budget.over .budget-bar > span { background: var(--bad); } .budget.over .budget-head b { color: var(--bad); } .own-use .tile { min-width: 9rem; } +/* Between what the cluster is and how it is being used, on the cluster page. */ +hr.part { border: 0; border-top: 1px solid var(--line); margin: 2.25rem 0 .5rem; } diff --git a/internal/web/templates/dashboard.html b/internal/web/templates/dashboard.html index 9c1bc24..cd70387 100644 --- a/internal/web/templates/dashboard.html +++ b/internal/web/templates/dashboard.html @@ -1,7 +1,8 @@ {{define "dashboard"}}
- + +No nodes have registered.
{{end}} -{{if .Summary.Fabrics}} -| Fabric | Nodes | Fully free | Weights |
|---|---|---|---|
{{.Fabric}} |
- {{.Nodes}} | -{{.LargestFreeBlock}} | -{{if .NodesWithWeights}}{{.Models}} model(s) on {{.NodesWithWeights}}/{{.Nodes}} nodes{{else}}not reported{{end}} | -
Fully free counts whole unused nodes, which is what decides whether a -replica spanning nodes can land: free cards on the wrong fabric are not capacity -for a model that needs this one.
-{{end}} - -{{if .Summary.IdleReplicas}} -| Replica | Model | GPUs | Unused for |
|---|---|---|---|
{{.ID}} |
- {{.Model}} | -{{.GPUs}} | -{{duration .IdleSec}} | -
| Person | Keys | Requests | Tokens | Errors | Spend | Last seen |
|---|---|---|---|---|---|---|
| {{if .Email}}{{.Email}}{{else}}operator-issued keys{{end}} | -{{.Keys}} | -{{.Requests}} | -{{compact .Tokens}} | -{{if .Errors}}{{.Errors}}{{else}}—{{end}} | -{{units .CostMicros}} | -{{ago .LastSeen}} | -
| Model | Requests | Tokens | Errors | Mean latency |
|---|---|---|---|---|
{{.Model}} |
- {{.Requests}} | -{{compact .Tokens}} | -{{if .Errors}}{{.Errors}}{{else}}—{{end}} | -{{latency .AvgLatency}} | -
Counted by the model that actually answered, which differs from the one -requested whenever a fallback served it.
-{{end}} -| Node | State | GPUs | RAM | Disk | Engines | Classes | Fabrics | Models | Replicas | Last seen |
|---|
No agents have registered.
{{end}} -{{with .Fleet}} -No history: {{.Err}}
-{{else}} -No replicas.
{{end}} +{{if .Summary.IdleReplicas}} +| Replica | Model | GPUs | Unused for |
|---|---|---|---|
{{.ID}} |
+ {{.Model}} | +{{.GPUs}} | +{{duration .IdleSec}} | +
| Fabric | Nodes | Fully free | Weights |
|---|---|---|---|
{{.Fabric}} |
+ {{.Nodes}} | +{{.LargestFreeBlock}} | +{{if .NodesWithWeights}}{{.Models}} model(s) on {{.NodesWithWeights}}/{{.Nodes}} nodes{{else}}not reported{{end}} | +
Fully free counts whole unused nodes, which is what decides whether a +replica spanning nodes can land: free cards on the wrong fabric are not capacity +for a model that needs this one.
+{{end}} + +{{with .Fleet}} +No history: {{.Err}}
+{{else}} +Requests
{{.RequestChart}} @@ -198,6 +176,34 @@ requested whenever a fallback served it.No traffic recorded yet.
{{end}} +{{if .HasPeople}} +| Person | Keys | Requests | Tokens | Errors | Spend | Last seen |
|---|---|---|---|---|---|---|
| {{if .Email}}{{.Email}}{{else}}operator-issued keys{{end}} | +{{.Keys}} | +{{.Requests}} | +{{compact .Tokens}} | +{{if .Errors}}{{.Errors}}{{else}}—{{end}} | +{{units .CostMicros}} | +{{ago .LastSeen}} | +
| Model | Requests | Tokens | Errors | Mean latency |
|---|---|---|---|---|
{{.Model}} |
+ {{.Requests}} | +{{compact .Tokens}} | +{{if .Errors}}{{.Errors}}{{else}}—{{end}} | +{{latency .AvgLatency}} | +
Counted by the model that actually answered, which differs from the one +requested whenever a fallback served it.
+{{end}} +ssh -L 9090:127.0.0.1:9090 <control-plane>
{{end}}
+