Statistics page: the statistics database's size, and a fullness bar on the disk tiles
The server section shows the statistics database's size (with its -wal and -shm) and how many answers the query log holds, linking to the dashboard's Storage panel; the disk tiles get the same bar as the dashboard. GET /stats/server has database {path, bytes, query_log_rows}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
01ec37b9b2
commit
1b102a78f6
8 files changed
+78
-13
No files matched your search
@@ -283,6 +283,16 @@ func (s *Server) statsServer(w http.ResponseWriter, r *http.Request, p *auth.Pri
|
||||
labels = append(labels, "statistics database")
|
||||
}
|
||||
out["disks"] = stats.DiskUsage(labels, dirs)
|
||||
// The statistics database: what the statistics cost on disk.
|
||||
if db := s.cfg.Stats.Store().Path(); db != "" && db != ":memory:" {
|
||||
info := map[string]any{"path": db, "bytes": dbBytes(db)}
|
||||
if keep := s.cfg.Stats.Options().RetainQueries; keep > 0 && s.cfg.Stats.Options().QueryLog {
|
||||
if n, err := s.cfg.Stats.Store().QueryLogSize(r.Context()); err == nil {
|
||||
info["query_log_rows"] = n
|
||||
}
|
||||
}
|
||||
out["database"] = info
|
||||
}
|
||||
writeJSON(w, http.StatusOK, out)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user