feat(metrics): extend history bucket options to include 12h, 24h, and 48h intervals (#5467)

This commit is contained in:
shazzreab
2026-06-21 23:29:22 +08:00
committed by GitHub
parent 6f05c0a492
commit 648fc69cb1
3 changed files with 16 additions and 11 deletions
@@ -213,6 +213,9 @@ export default function SystemHistoryModal({ open, status, onClose }: SystemHist
{ value: 120, label: '2h' },
{ value: 180, label: '3h' },
{ value: 300, label: '5h' },
{ value: 720, label: '12h' },
{ value: 1440, label: '24h' },
{ value: 2880, label: '48h' },
]}
/>
</div>
+4 -5
View File
@@ -19,11 +19,10 @@ type MetricSample struct {
V float64 `json:"v"`
}
// metricCapacityDefault caps each ring buffer at ~5h worth of @2s samples
// or ~25h worth of @10s samples. Plenty for the bucketed aggregation
// view and small enough that the working set per metric stays under
// ~150 KiB.
const metricCapacityDefault = 9000
// metricCapacityDefault caps each ring buffer at 48h worth of @2s samples.
// Node metrics arrive less frequently, so they fit the same retention window
// with room to spare.
const metricCapacityDefault = 86400
// metricHistory is a thread-safe, in-memory ring buffer keyed by
// arbitrary strings. Two singletons live below: one for system-wide
+9 -6
View File
@@ -158,12 +158,15 @@ const xrayVersionsCacheTTL = 15 * time.Minute
// callers from triggering arbitrary aggregation work and keeps the
// frontend's bucket selector self-documenting.
var allowedHistoryBuckets = map[int]bool{
2: true, // Real-time view
30: true, // 30s intervals
60: true, // 1m intervals
120: true, // 2m intervals
180: true, // 3m intervals
300: true, // 5m intervals
2: true, // Real-time view
30: true, // 30s intervals
60: true, // 1m intervals
120: true, // 2m intervals
180: true, // 3m intervals
300: true, // 5m intervals
720: true, // 12m intervals
1440: true, // 24m intervals
2880: true, // 48m intervals
}
// IsAllowedHistoryBucket reports whether a bucket-seconds value is in the