Files
pulse/internal/api/types.go
T
rcourtman 4a0a05858d Remove the summary chart routes no client calls
GET /api/charts/workloads-summary has had no first-party caller since
the v6 import: ChartsAPI.getWorkloadsSummaryCharts arrived with it and
nothing ever called it. GET /api/charts/storage-summary lost its last
reader when storageSummaryTrendCache.ts was deleted on 2026-05-26.
Both still cost something. The workloads route carried a payload cache,
an SLO test in the release latency gate and a benchmark, and mock mode
rebuilt the 24-hour storage aggregate on every sampler tick for a cache
nothing read.

No stable release ever requested either route from the browser: v6.0.0
and later carry no caller, and the storage trend reader shipped only in
v6.0.0-rc.1 to rc.5. Neither route is in docs/API.md (a list of common
endpoints, not a complete one), and pulse-pro, pulse-mobile and
pulse-dev-infra never call them. A monitoring:read token could reach
them, so a private script may notice, but nothing known depends on
them. pulse-enterprise names the SLO test only as fixture data, and its
latency gate passes a test that is absent from the candidate as
removed. So the routes go with their clients:
handlers, response types, the monitor trend helpers, the mock aggregate
and its prewarm, the SLO budget, the benchmark, and the ChartsAPI
methods and types. Requests to either path now get 404.
buildMockWorkloadMetricHistorySeries goes too, because the
workloads-summary handler was its only production caller.

A TypeScript reference graph from src/index.tsx finds no production
reference to the removed methods or types. The production build loses
only the two static methods from the ChartsAPI chunk (326 B raw, 49 B
gzip); every other file differs only by chunk hashes and SRI values.
deadcode ./cmd/pulse and golangci unused report nothing newly
unreachable. On private mock stacks the Proxmox overview in Trends, a
guest History drawer and the storage page make the same chart requests
before and after at 1440 and 390 px, and neither build requested the
removed routes.

Contract prose that still described either route as live now records
the retirement, and the workload chart guard pins the per-type metric
sets the surviving /api/charts/workloads route requests.
2026-10-07 23:14:49 +01:00

73 lines
3.0 KiB
Go

package api
import "github.com/rcourtman/pulse-go-rewrite/internal/api/chartapi"
// Common response types for API endpoints
// HealthResponse represents the health check response
type HealthResponse struct {
Status string `json:"status"`
Timestamp int64 `json:"timestamp"`
Uptime float64 `json:"uptime"`
ProxyInstallScriptAvailable bool `json:"proxyInstallScriptAvailable,omitempty"`
DevModeSSH bool `json:"devModeSSH,omitempty"` // DEV/TEST ONLY: SSH keys allowed in containers
Dependencies map[string]bool `json:"dependencies"`
}
func EmptyHealthResponse() HealthResponse {
return HealthResponse{}.NormalizeCollections()
}
func (r HealthResponse) NormalizeCollections() HealthResponse {
if r.Dependencies == nil {
r.Dependencies = map[string]bool{}
}
return r
}
// VersionResponse represents version information
type VersionResponse struct {
Version string `json:"version"`
BuildTime string `json:"buildTime,omitempty"`
Build string `json:"build,omitempty"`
GoVersion string `json:"goVersion,omitempty"`
Runtime string `json:"runtime,omitempty"`
Channel string `json:"channel,omitempty"`
IsDocker bool `json:"isDocker"`
IsSourceBuild bool `json:"isSourceBuild"`
IsDevelopment bool `json:"isDevelopment"`
DeploymentType string `json:"deploymentType,omitempty"`
AgentUpdateTargetVersion string `json:"agentUpdateTargetVersion,omitempty"`
UpdateAvailable bool `json:"updateAvailable"`
LatestVersion string `json:"latestVersion,omitempty"`
Containerized bool `json:"containerized"`
ContainerID string `json:"containerId,omitempty"`
}
type ChartResponse = chartapi.ChartResponse
type InfrastructureChartsResponse = chartapi.InfrastructureChartsResponse
type WorkloadChartsResponse = chartapi.WorkloadChartsResponse
type ChartStats = chartapi.ChartStats
type ChartPointCounts = chartapi.ChartPointCounts
type VMChartData = chartapi.VMChartData
type NodeChartData = chartapi.NodeChartData
type StorageChartData = chartapi.StorageChartData
type StorageChartsResponse = chartapi.StorageChartsResponse
type StoragePoolChartData = chartapi.StoragePoolChartData
type StorageDiskChartData = chartapi.StorageDiskChartData
type MetricPoint = chartapi.MetricPoint
func EmptyChartResponse() ChartResponse { return chartapi.EmptyChartResponse() }
func EmptyInfrastructureChartsResponse() InfrastructureChartsResponse {
return chartapi.EmptyInfrastructureChartsResponse()
}
func EmptyWorkloadChartsResponse() WorkloadChartsResponse {
return chartapi.EmptyWorkloadChartsResponse()
}
func EmptyStorageChartsResponse() StorageChartsResponse { return chartapi.EmptyStorageChartsResponse() }
// AgentVersionResponse represents Docker / Podman module version information.
type AgentVersionResponse struct {
Version string `json:"version"`
}