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