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"}} - + + llmgw — cluster
@@ -14,6 +15,11 @@ {{else}}{{template "nav" .Menu}}{{end}}
+{{/* The page refreshes this part in place rather than reloading: a reload + every few seconds threw away the scroll position of anyone reading the + bottom of it. Paused while the tab is hidden. Without script, the meta + refresh in the head does the old thing. */}} +
{{if .HasCharts}}
{{.Requests24h}}
requests · 24h
{{.RequestSpark}}
@@ -43,61 +49,6 @@
{{else}}

No nodes have registered.

{{end}} -{{if .Summary.Fabrics}} -

Fabrics

- -{{range .Summary.Fabrics}} - - - - -{{end}}
FabricNodesFully freeWeights
{{.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}} -

Holding hardware nothing is asking for

- -{{range .Summary.IdleReplicas}} - - - - -{{end}}
ReplicaModelGPUsUnused for
{{.ID}}{{.Model}}{{.GPUs}}{{duration .IdleSec}}
-{{end}} - -{{if .HasPeople}} -

People

-{{.UserChart}} - -{{range .Users}} - - - - - - - -{{end}}
PersonKeysRequestsTokensErrorsSpendLast seen
{{if .Email}}{{.Email}}{{else}}operator-issued keys{{end}}{{.Keys}}{{.Requests}}{{compact .Tokens}}{{if .Errors}}{{.Errors}}{{else}}—{{end}}{{units .CostMicros}}{{ago .LastSeen}}
-{{end}} - -{{if .Models2}} -

What is being run

-{{.ModelChart}} - -{{range .Models2}} - - - - - -{{end}}
ModelRequestsTokensErrorsMean 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}} -

Nodes

{{if .Nodes}} @@ -123,28 +74,6 @@ requested whenever a fallback served it.

{{end}}
NodeStateGPUsRAMDiskEnginesClassesFabricsModelsReplicasLast seen
{{else}}

No agents have registered.

{{end}} -{{with .Fleet}} -

What the cluster is doing last {{.Window}}

-{{if .Err}} -{{/* Said outright. An empty panel reads as a healthy cluster with nothing - happening, which is the opposite of not knowing. */}} -

No history: {{.Err}}

-{{else}} -
- {{template "tschart" dict "t" .Saturation "title" "Pool saturation, by model" - "note" "The worse of queue depth and cache pressure. 1 is the limit measured as healthy, not the point of failure."}} - {{template "tschart" dict "t" .Ready "title" "Replicas ready, by model" - "note" "A model deliberately stopped has no line at all, which is why an on-demand catalogue looks quiet here."}} -
-
- {{template "tschart" dict "t" .Queue "title" "Engine queue depth, by replica" - "note" "Requests accepted and not yet started. The first thing to move when a replica is falling behind."}} - {{template "tschart" dict "t" .KV "title" "KV cache occupancy, by replica" - "note" "How full the attention cache is. Long contexts fill it with an empty queue, which is why saturation reads both."}} -
-{{end}} -{{end}} -

Models

{{if .Models}} @@ -187,6 +116,55 @@ requested whenever a fallback served it.

{{end}} {{else}}

No replicas.

{{end}} +{{if .Summary.IdleReplicas}} +

Holding hardware nothing is asking for

+ +{{range .Summary.IdleReplicas}} + + + + +{{end}}
ReplicaModelGPUsUnused for
{{.ID}}{{.Model}}{{.GPUs}}{{duration .IdleSec}}
+{{end}} + +{{if .Summary.Fabrics}} +

Fabrics

+ +{{range .Summary.Fabrics}} + + + + +{{end}}
FabricNodesFully freeWeights
{{.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}} +

What the cluster is doing last {{.Window}}

+{{if .Err}} +{{/* Said outright. An empty panel reads as a healthy cluster with nothing + happening, which is the opposite of not knowing. */}} +

No history: {{.Err}}

+{{else}} +
+ {{template "tschart" dict "t" .Saturation "title" "Pool saturation, by model" + "note" "The worse of queue depth and cache pressure. 1 is the limit measured as healthy, not the point of failure."}} + {{template "tschart" dict "t" .Ready "title" "Replicas ready, by model" + "note" "A model deliberately stopped has no line at all, which is why an on-demand catalogue looks quiet here."}} +
+
+ {{template "tschart" dict "t" .Queue "title" "Engine queue depth, by replica" + "note" "Requests accepted and not yet started. The first thing to move when a replica is falling behind."}} + {{template "tschart" dict "t" .KV "title" "KV cache occupancy, by replica" + "note" "How full the attention cache is. Long contexts fill it with an empty queue, which is why saturation reads both."}} +
+{{end}} +{{end}} + +
+

Traffic — last 24 hours, hourly

{{if .HasCharts}}

Requests

{{.RequestChart}} @@ -198,6 +176,34 @@ requested whenever a fallback served it.

No traffic recorded yet.

{{end}} +{{if .HasPeople}} +

People

+ +{{range .Users}} + + + + + + + +{{end}}
PersonKeysRequestsTokensErrorsSpendLast seen
{{if .Email}}{{.Email}}{{else}}operator-issued keys{{end}}{{.Keys}}{{.Requests}}{{compact .Tokens}}{{if .Errors}}{{.Errors}}{{else}}—{{end}}{{units .CostMicros}}{{ago .LastSeen}}
+{{end}} + +{{if .Models2}} +

What is being run

+ +{{range .Models2}} + + + + + +{{end}}
ModelRequestsTokensErrorsMean 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}} +

Usage — last 24 hours

{{if .AuthEnabled}} {{if .Usage}} @@ -228,6 +234,8 @@ exposed: ssh -L 9090:127.0.0.1:9090 <control-plane>

{{end}} +
+