mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-24 20:52:51 +00:00
4a0a05858d
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.
51 lines
2.4 KiB
Go
51 lines
2.4 KiB
Go
package api
|
|
|
|
import "time"
|
|
|
|
// API latency SLO targets per critical endpoint.
|
|
//
|
|
// These define the maximum acceptable p95 latencies for each endpoint under
|
|
// representative benchmark conditions (see slo_bench_test.go). Production
|
|
// latencies should stay well below these; violations in benchmarks signal a
|
|
// performance regression requiring investigation before merge.
|
|
//
|
|
// Targets are based on baseline measurements from the existing benchmarks in
|
|
// router_bench_test.go and store_bench_test.go, with headroom for CI variance.
|
|
//
|
|
// Endpoint categories:
|
|
// - Chart data (metrics-store/history): Drives the dashboard sparkline/chart
|
|
// rendering path. Must be fast enough for concurrent multi-resource loads.
|
|
// - Stats/metadata (metrics-store/stats): Lightweight queries for dashboard
|
|
// status indicators.
|
|
// - Resource listing (/api/resources): Primary dashboard data source.
|
|
// Includes cache lookup, filtering, sorting, pagination, and JSON encoding.
|
|
const (
|
|
// SLOMetricsHistoryStoreP95 is the p95 target for /api/metrics-store/history
|
|
// when serving from the SQLite store (single metric, 1h window, ~500 points).
|
|
SLOMetricsHistoryStoreP95 = 5 * time.Millisecond
|
|
|
|
// SLOMetricsHistoryMemoryP95 is the p95 target for /api/metrics-store/history
|
|
// when falling back to the in-memory MetricsHistory (single metric, 1h window).
|
|
SLOMetricsHistoryMemoryP95 = 2 * time.Millisecond
|
|
|
|
// SLOMetricsStoreStatsP95 is the p95 target for /api/metrics-store/stats
|
|
// (lightweight SQLite stat queries).
|
|
SLOMetricsStoreStatsP95 = 3 * time.Millisecond
|
|
|
|
// SLOResourcesListP95 is the p95 target for GET /api/resources with ~85
|
|
// resources in state (5 nodes + 50 VMs + 30 containers), default pagination
|
|
// (limit=50 per page), including cache lookup, snapshot comparison, filtering,
|
|
// sorting, pagination, pruning, and JSON encoding.
|
|
SLOResourcesListP95 = 3 * time.Millisecond
|
|
|
|
// SLOInfrastructureChartsP95 is the p95 target for GET /api/charts/infrastructure
|
|
// with a store-backed 4h window across nodes, docker hosts, and agents.
|
|
// This is the infrastructure summary sparkline hot path.
|
|
SLOInfrastructureChartsP95 = 70 * time.Millisecond
|
|
|
|
// SLOWorkloadChartsP95 is the p95 target for GET /api/charts/workloads
|
|
// with a store-backed 4h window across VMs, system containers, and docker
|
|
// containers. This is the workloads summary sparkline hot path.
|
|
SLOWorkloadChartsP95 = 90 * time.Millisecond
|
|
)
|