From 9ef02dc9ec743ed8dc523dc628eedbd627a9cccf Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sun, 27 Sep 2026 18:29:19 +0200 Subject: [PATCH] Give the charts to both copies of the dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page is served twice — on the admin listener, and at /admin behind a session — and the history source reached only the second. The first version built it after the admin listener's copy was already registered and passed that one an empty NavExtras, so the page an operator reaches by SSH tunnel had no charts and no explanation. Built before either is registered, and handed to both. Co-Authored-By: Claude Opus 5 (1M context) --- internal/cli/server.go | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/internal/cli/server.go b/internal/cli/server.go index f3adefd..f9ca2a4 100644 --- a/internal/cli/server.go +++ b/internal/cli/server.go @@ -182,22 +182,32 @@ func newServerCmd() *cobra.Command { if st := rt.Store(); st != nil { usage = st } + // The dashboard's operational charts. llmgw publishes these + // metrics; what it cannot do is remember them, so the history + // is read back from wherever they were scraped to. + // + // Built before either copy of the page is registered, and given + // to both. The first version built it afterwards and handed it + // only to the one on the client port, so the copy an operator + // reaches by SSH tunnel — the one on this very listener — had + // no charts at all and said nothing about why. + var history web.History + if h := promq.New(cfg.Monitoring.Prometheus, cfg.Monitoring.Timeout); h != nil { + history = h + log.Info("dashboard history configured", + "prometheus", cfg.Monitoring.Prometheus) + } + rt.SetHistory(history, cfg.Monitoring.Window) + adminMux.HandleFunc("GET /", web.Dashboard( - api, usage, version.Version, 5*time.Second, true, web.NavExtras{}, log)) + api, usage, version.Version, 5*time.Second, true, + web.NavExtras{History: history, Window: cfg.Monitoring.Window}, log)) adminMux.Handle("GET /_static/", web.Static()) // The same page on the client-facing port at /admin, behind a // session and an admin flag. Handing the router the data rather // than the port keeps pprof where it is. rt.SetClusterView(api, usage) - // The dashboard's operational charts. llmgw publishes these - // metrics; what it cannot do is remember them, so the history - // is read back from wherever they were scraped to. - if h := promq.New(cfg.Monitoring.Prometheus, cfg.Monitoring.Timeout); h != nil { - rt.SetHistory(h, cfg.Monitoring.Window) - log.Info("dashboard history configured", - "prometheus", cfg.Monitoring.Prometheus) - } } // The model mirror, when one is configured. Built here and not at