You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: rename Metrics gear URL /history → /metrics; clarify the term
The Metrics gear was historically called "history" because the page
shows time-series data. That name leaked into the URL (/history), the
API endpoints (/api/{boxID}/history/*), the templ file
(history.templ), the handler functions (HistoryPage,
APIStatsHistoryHandler, …), and assorted comments / docs / README
entries. With nginx / Apache / Caddy / Traefik detection now landing
(issue #95) and "metric source" / "primary source" terminology in the
new code, the dual naming has become genuinely confusing.
This commit renames the metrics-gear identity end-to-end:
- Page route: /history → /metrics (plugin.go SidebarItem.Path,
base.templ path-prefix match + sidebar links, gears-page.js).
- API routes:
/api/{boxID}/history/stats → /api/{boxID}/metrics/stats
/api/{boxID}/history/metrics → /api/{boxID}/metrics/system
/api/{boxID}/history/backend/{name} → /api/{boxID}/metrics/backend/{name}
(Last one coexists with /metrics/backend/{name}/details — the
time-series endpoint vs the drill-down details endpoint added in #87.)
- Handler functions:
HistoryPage → MetricsPage
APIStatsHistoryHandler → APIMetricsStatsHandler
APIBackendHistoryHandler → APIMetricsBackendHandler
APISystemMetricsHistoryHandler → APIMetricsSystemHandler
- File: pages/history.templ → pages/metrics.templ
(templ component History() → Metrics())
- JS callers: history.templ + details.templ + chart_partials.templ
(8 fetch() URLs updated).
- Docs: metrics gear README routes table + architecture diagram +
development snippet; cmd/server/main.go route-group comment;
pages.go migration-history comment; permissions.go field comment;
docs/gears.md gear list.
Intentionally **kept** as legitimate "history" concepts (per design
discussion):
- DB tables stats_history, system_metrics_history, backend_history —
the rows ARE historical records. Renaming requires a migration with
no user-visible benefit; the names accurately describe what they
contain. The DB query methods that read them (GetStatsHistory,
GetBackendHistory, GetSystemMetricsHistory) keep their names for
the same reason.
- Snapshot interval / retention config: HistoryIntervalSeconds,
store_history, history_retention_days — these control how the
historical record is kept. Same reasoning.
- Local `history` variable names inside the renamed handler functions
— they reflect what the DB methods return.
- OS-update apt/zypper/dnf/pacman history — distinct concept.
/api/v1/system/updates/history on the agent, /os-updates/history on
the dashboard, parseAptHistoryLog, /var/log/apt/history.log, etc.
All untouched.
- HAProxy config change history — distinct concept.
/{boxID}/haproxy/config/history,
templates/pages/haproxy_config/change_history.templ, etc. Untouched.
Agent module: no changes. The agent's "history" references are all
OS-update package-manager history (apt/zypper/dnf/pacman/apk/yum),
which is the legitimate concept.
Tests + build green on both modules.
0 commit comments