Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Reuse bounded rollup query parameters
rcourtmane9dbca7c2b71
diff --git a/docs/release-control/v6/internal/records/workload-chart-idle-proof-2026-10-18.md b/docs/release-control/v6/internal/records/workload-chart-idle-proof-2026-10-18.mdindex 250df28938..bf598bd46c 100644--- a/docs/release-control/v6/internal/records/workload-chart-idle-proof-2026-10-18.md+++ b/docs/release-control/v6/internal/records/workload-chart-idle-proof-2026-10-18.md@@ -193,3 +193,64 @@ medians of 4.735637/5.7315405 ms for the small rollup andare retained without substituting for the revised paired CI result or thestill-pending strict idle-worker chart proof. The previous executable andinitial adverse CI results are preserved.++## Revised paired result and shared bindings++The revised comparison in+[run 39177248750](https://github.com/rcourtman/Pulse/actions/runs/39177248750)+used PR head `fc58c597caf0051389c7bb3a5a6e10e7dfb3ac9b` through synthetic merge+`e79e0546086124d96ee75bd64722c8fc3f8ed6bf`, tree+`2143d881c0c8cbcb7d8696c204f42149623a3d5b`. Its other parent was current main+`6209d03d5a3895005f48b365cc2eeb8f1483f072`; the main advance changed only+Proxmox guest-test fixtures. The paired baseline remained+`ed4a2c6b54ee1d139d5f198950c53b403596c17c`.++The small rollup improved from 4.309 to 4.254 ms (-1.28%, p = 0.011), and the+500-node rollup from 121.2 to 112.1 ms (-7.48%, p < 0.001). The four-hour cold+chart improved from 113.97 to 78.69 ms (-30.96%, p < 0.001), with unchanged+21.47 MiB and approximately 508,200 allocations. The remaining benchmark flag+was the small rollup's 3.117 to 3.453 KiB (+10.76%, p < 0.001). Its allocation+count rose from 100 to 105. The 500-node case likewise gained five allocations+and about 352 bytes, below that case's relative flag threshold. Artifact+[12155027036](https://github.com/rcourtman/Pulse/actions/runs/39177248750/artifacts/12155027036)+has GitHub digest+`f238c3230b214064fde984765b81c6f93f22f7addb410f7aad43d5ba404a69cd`.++The duplicated discovery tier/window arguments caused those extra allocations.+Both stages now reuse the ordinary aggregate's same six SQLite binding slots,+removing the second argument array and repeated boxing without changing+resource discovery, primary ranges or aggregation semantics. The existing+cross-layout aggregate and query-plan tests exercise the shared bindings.++The hosted strict test in that revised run passed its latency assertion:+p50 50.135919 ms, p95 67.674439 ms and p99 74.205989 ms, explicit SLO 90 ms.+It still failed capacity validation. Two of 12 concurrent capacity samples+recorded `provjobd1628928` at 21.0% and 25.25% total CPU. The four-vCPU runner+was an AMD EPYC 9V45, with GOMAXPROCS=2 and Go 1.26.9. This is different+hardware from the prior public attempt; their absolute timings are not a+source-only comparison. Admission/after receipts, both adverse intervals and+the passing test remain retained. Fixed executable SHA-256:+`89dfcd17f28ccd16d88d1b663ff8266975486adb5804876ae65c1269a4952b98`.+Artifact+[12155196024](https://github.com/rcourtman/Pulse/actions/runs/39177248750/artifacts/12155196024)+has GitHub digest+`65d01e1a1614836a025f747869d577daa21032a6a362a621413807d4b2c1e150`.+The test establishes a passing latency assertion on that runner; the failed+capacity guard still prevents an idle-worker qualification claim.++The shared-binding executable passed the complete targeted rollup correctness+and plan suite and the rollup race suite (6.010 s). SHA-256:+`ce878df8c9df1193b457742ef913dac8073f29777b53aeb9148fecfd8b9a1686`.+Its five source hashes are retained in `rollup-bindings/source.sha256`.+Ten native samples per case measured small-rollup median allocation volume+3,204.5 versus 3,532.5 bytes, and 500-node volume 3,896 versus 4,248 bytes.+Median allocation counts were 106 versus 105 and 113 versus 112 respectively;+reused numbered bindings reduce volume while the driver handles their names.+Sequential shared-worker median times were 7.8832245 versus 6.780017 ms and+164.7742585 versus 149.3372525 ms. These adverse timing observations are+retained without attributing them to the binding change or substituting for+fresh paired CI. The full metrics suite passed before the binding-only change;+the final native proof exercises all affected rollup paths and boundaries.+All nine required source checks for `fc58c597caf0051389c7bb3a5a6e10e7dfb3ac9b`+ultimately passed, including REST-0 at 23:57:41Z. Its allocation flag and+capacity-invalidated SLO are preserved separately from those source checks.diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 87e05ed6e2..15cd7d7fe8 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -2778,7 +2778,10 @@ the current production schema. Clustered rollups first discover resourceidentities within the bounded source window through the covering tier/timeindex, then read each resource through its primary-key time range. They mustnot seek the primary table once per source observation through the secondary-index. A statement-local resource number gives the aggregate an integer group+index. Discovery and value reads share the same bound source tier and time+window. Reuse the ordinary aggregate's binding slots so constructing that+indexed query does not duplicate argument arrays or boxing per window.+A statement-local resource number gives the aggregate an integer groupkey without changing stored resource identity, bucket boundaries, nullableextrema fallback or `INSERT OR IGNORE` idempotence. It is neither persisted norcached. Legacy rowid databases retain their existing aggregate query untildiff --git a/pkg/metrics/clustered_layout.go b/pkg/metrics/clustered_layout.goindex ee2623e8e6..b96b47ea35 100644--- a/pkg/metrics/clustered_layout.go+++ b/pkg/metrics/clustered_layout.go@@ -22,10 +22,12 @@ const clusteredMetricsIndex = "sqlite_autoindex_metrics_1"// ranges. Group by a statement-local resource number to avoid comparing both// identity strings for every input row; the number is unique within this query// and never becomes a persisted or externally visible resource identity.+// Reuse the ordinary rollup's six binding slots in both read stages. Repeating+// the tier/window arguments would allocate another argument slice per window.const clusteredMetricsRollupSQL = `WITH selected_resources AS MATERIALIZED (SELECT DISTINCT resource_type, resource_id FROM metrics- WHERE tier = ? AND timestamp >= ? AND timestamp < ?+ WHERE tier = ?4 AND timestamp >= ?5 AND timestamp < ?6), resources AS MATERIALIZED (SELECT ROW_NUMBER() OVER (ORDER BY resource_type, resource_id) AS resource_number,resource_type, resource_id FROM selected_resources@@ -34,10 +36,10 @@ const clusteredMetricsRollupSQL = `(resource_type, resource_id, metric_type, value, min_value, max_value, timestamp, tier)SELECT r.resource_type, r.resource_id, m.metric_type, AVG(m.value),MIN(COALESCE(m.min_value, m.value)), MAX(COALESCE(m.max_value, m.value)),- (m.timestamp / ?) * ? AS bucket_ts, ?+ (m.timestamp / ?1) * ?2 AS bucket_ts, ?3FROM resources AS r CROSS JOIN metrics AS mWHERE m.resource_type = r.resource_type AND m.resource_id = r.resource_id- AND m.tier = ? AND m.timestamp >= ? AND m.timestamp < ?+ AND m.tier = ?4 AND m.timestamp >= ?5 AND m.timestamp < ?6GROUP BY r.resource_number, bucket_ts, m.metric_typeORDER BY r.resource_number, bucket_ts, m.metric_type`diff --git a/pkg/metrics/clustered_layout_test.go b/pkg/metrics/clustered_layout_test.goindex d61082f284..86f8c4b0a4 100644--- a/pkg/metrics/clustered_layout_test.go+++ b/pkg/metrics/clustered_layout_test.go@@ -67,7 +67,6 @@ func TestClusteredMetricsRollupPlanUsesBoundedPrimaryRanges(t *testing.T) {}t.Cleanup(func() { _ = store.Close() })rows, err := store.db.Query("EXPLAIN QUERY PLAN "+clusteredMetricsRollupSQL,- "raw", int64(1_700_000_000), int64(1_700_000_120),int64(60), int64(60), "minute", "raw", int64(1_700_000_000), int64(1_700_000_120))if err != nil {t.Fatal(err)diff --git a/pkg/metrics/store.go b/pkg/metrics/store.goindex dacc21032f..3d73865290 100644--- a/pkg/metrics/store.go+++ b/pkg/metrics/store.go@@ -2377,7 +2377,6 @@ func (s *Store) rollupTierWindow(fromTier, toTier Tier, bucketSecs, startTs, endparams := []interface{}{bucketSecs, bucketSecs, string(toTier), string(fromTier), startTs, endTs}if s.clusteredMetrics.Load() {query = clusteredMetricsRollupSQL- params = append([]interface{}{string(fromTier), startTs, endTs}, params...)}_, err = tx.Exec(query, params...)if err != nil {