From 04b29a189865f29e924d7320508487e6b3d1801d Mon Sep 17 00:00:00 2001 From: Jim Lin Date: Fri, 11 Sep 2026 22:47:32 +0800 Subject: [PATCH 1/2] fix(metrics): read the per-VM series from telegraf, not monasca Twelve Flux queries still read from bucket "monasca" -- six history queries in internal/cubecos/metric.go and six Top-Instances rank queries in internal/apis/v1/handlers/metrics/stmt.go. bigstack-oss/cubecos#672 removed monasca, so on a freshly installed cluster that bucket does not exist and every per-VM chart and rank in the UI comes back empty. On an upgraded cluster it is worse than empty: the database is deliberately kept so an operator can still read history, so the queries succeed and silently return data that stops at the upgrade. hex_sdk instance_metrics_collect writes the replacement series, and it was written to be a drop-in: same measurement names, same tag names, same field name. Only the database moved. So this is a bucket rename and nothing else -- no measurement, tag, field or unit changes anywhere in the twelve queries. Verified against a live cluster rather than by inspection. Running the exact query these statements generate, against bucket "telegraf" on jim-1cc: _value 0.282257, _field value, _measurement vm.cpu.utilization_norm_perc, resource_id e1997ae2-..., tenant_id 6e6449b..., tenant_name admin, vm_name p3test-vm which is every tag the rank queries group by -- resource_id, vm_name -- plus the device tag the storage and network queries add, confirmed present on vm.io.* and vm.net.*. Two other leftovers go with it: the monasca module entry in the metrics group (module.go), which matches the group list in cubecos' cli_cluster.cpp -- prometheus and thanos already moved out to metricsDb, this is the rest of that change. MonascaDebugEnabled and its role mapping (tuning.go), a tuning for a service with nothing left to configure. go vet clean. The schema half is in cube-cos-openapi and arrives with the submodule bump. Signed-off-by: Jim Lin Co-authored-by: Eandalf Co-Authored-By: Claude Opus 5 (1M context) --- internal/apis/v1/handlers/metrics/stmt.go | 12 ++++++------ internal/cubecos/metric.go | 12 ++++++------ internal/cubecos/module.go | 1 - internal/cubecos/tuning.go | 2 -- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/internal/apis/v1/handlers/metrics/stmt.go b/internal/apis/v1/handlers/metrics/stmt.go index 789ef746..3c9e003a 100644 --- a/internal/apis/v1/handlers/metrics/stmt.go +++ b/internal/apis/v1/handlers/metrics/stmt.go @@ -214,7 +214,7 @@ func (h *helper) genHostNetworkEgressHistoryStmt() string { func (h *helper) genVmsCpuUsageRankStmt() string { query := influx.Query{} - return query.Bucket("monasca"). + return query.Bucket("telegraf"). Range("start: -5m"). Filter(`fn: (r) => r._measurement == "vm.cpu.utilization_norm_perc" and r._field == "value"`). Group(`columns: ["resource_id", "vm_name"]`). @@ -228,7 +228,7 @@ func (h *helper) genVmsCpuUsageRankStmt() string { func (h *helper) genVmsMemoryRankStmt() string { query := influx.Query{} - return query.Bucket("monasca"). + return query.Bucket("telegraf"). Range("start: -5m"). Measurement("vm.mem.free_perc"). Filter(`fn: (r) => r._field == "value"`). @@ -243,7 +243,7 @@ func (h *helper) genVmsMemoryRankStmt() string { func (h *helper) genVmsStorageIopsReadRankStmt() string { query := influx.Query{} - return query.Bucket("monasca"). + return query.Bucket("telegraf"). Range("start: -5m"). Measurement("vm.io.read_bytes_sec"). Filter(`fn: (r) => r._field == "value"`). @@ -258,7 +258,7 @@ func (h *helper) genVmsStorageIopsReadRankStmt() string { func (h *helper) genVmsStorageIopsWriteRankStmt() string { query := influx.Query{} - return query.Bucket("monasca"). + return query.Bucket("telegraf"). Range("start: -5m"). Measurement("vm.io.write_bytes_sec"). Filter(`fn: (r) => r._field == "value"`). @@ -273,7 +273,7 @@ func (h *helper) genVmsStorageIopsWriteRankStmt() string { func (h *helper) genVmsNetworkIngressRankStmt() string { query := influx.Query{} - return query.Bucket("monasca"). + return query.Bucket("telegraf"). Range("start: -5m"). Filter(`fn: (r) => r._measurement == "vm.net.in_bytes_sec" and r._field == "value"`). Group(`columns: ["resource_id", "vm_name", "device"]`). @@ -286,7 +286,7 @@ func (h *helper) genVmsNetworkIngressRankStmt() string { func (h *helper) genVmsNetworkEgressRankStmt() string { query := influx.Query{} - return query.Bucket("monasca"). + return query.Bucket("telegraf"). Range("start: -5m"). Filter(`fn: (r) => r._measurement == "vm.net.out_bytes_sec" and r._field == "value"`). Group(`columns: ["resource_id", "vm_name", "device"]`). diff --git a/internal/cubecos/metric.go b/internal/cubecos/metric.go index d58874f3..e11be274 100644 --- a/internal/cubecos/metric.go +++ b/internal/cubecos/metric.go @@ -135,7 +135,7 @@ var ( ` vmCpuUsageHistoryStmt = ` - from(bucket: "monasca") + from(bucket: "telegraf") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "vm.cpu.utilization_norm_perc" and @@ -145,7 +145,7 @@ var ( ` vmMemoryUsageHistoryStmt = ` - from(bucket: "monasca") + from(bucket: "telegraf") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "vm.mem.free_perc" and @@ -158,7 +158,7 @@ var ( ` vmStorageIopsReadHistoryStmt = ` - from(bucket: "monasca") + from(bucket: "telegraf") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "vm.io.read_bytes_sec" and @@ -169,7 +169,7 @@ var ( ` vmStorageIopsWriteHistoryStmt = ` - from(bucket: "monasca") + from(bucket: "telegraf") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "vm.io.write_bytes_sec" and @@ -180,7 +180,7 @@ var ( ` vmNetworkIngressHistoryStmt = ` - from(bucket: "monasca") + from(bucket: "telegraf") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "vm.net.in_bytes_sec" and @@ -192,7 +192,7 @@ var ( ` vmNetworkEgressHistoryStmt = ` - from(bucket: "monasca") + from(bucket: "telegraf") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "vm.net.out_bytes_sec" and diff --git a/internal/cubecos/module.go b/internal/cubecos/module.go index f0875f85..38025f7f 100644 --- a/internal/cubecos/module.go +++ b/internal/cubecos/module.go @@ -202,7 +202,6 @@ var ( Name: "metrics", Category: "infrascope", Modules: []services.Module{ - {Name: "monasca", IsRepairable: true}, {Name: "telegraf", IsRepairable: true}, {Name: "grafana", IsRepairable: true}, }, diff --git a/internal/cubecos/tuning.go b/internal/cubecos/tuning.go index 4022068a..045b2a6b 100644 --- a/internal/cubecos/tuning.go +++ b/internal/cubecos/tuning.go @@ -86,7 +86,6 @@ const ( ManilaVolumeType = "manila.volume.type" MasakariHostEvacuateAll = "masakari.host.evacuate_all" MasakariWaitPeriod = "masakari.wait.period" - MonascaDebugEnabled = "monasca.debug.enabled" MysqlBackupCuratorRp = "mysql.backup.curator.rp" NetIfMtuName = "net.if.mtu." NetIpv4TcpSyncookies = "net.ipv4.tcp_syncookies" @@ -189,7 +188,6 @@ func setTuningToRoles() { tuningToRoles[ManilaVolumeType] = nodes.AllRoles tuningToRoles[MasakariHostEvacuateAll] = nodes.AllRoles tuningToRoles[MasakariWaitPeriod] = nodes.ControlRoles - tuningToRoles[MonascaDebugEnabled] = nodes.AllRoles tuningToRoles[MysqlBackupCuratorRp] = nodes.AllRoles tuningToRoles[NetIfMtuName] = nodes.AllRoles tuningToRoles[NetIpv4TcpSyncookies] = nodes.AllRoles From ee34714039db6a7e3da70e1a05d793f471f36df6 Mon Sep 17 00:00:00 2001 From: Jim Lin Date: Fri, 11 Sep 2026 22:55:30 +0800 Subject: [PATCH 2/2] build(deps): bump cube-cos-openapi to drop monasca and senlin from the schema Picks up cube-cos-openapi 6217dc4, which removes both retired services from docs.yaml: monasca the module entry in the metrics group, the two module-name enums, and the monasca.debug.enabled tuning. Removed from CubeCOS by bigstack-oss/cubecos#672 phase 4. senlin the module entry in the businessLogic group and the senlin.debug.enabled tuning. Removed from CubeCOS by d4550c91 back on the yoga train; the schema was only half-updated at the time, so senlin came out of the module enums but stayed in those two. Pairs with the Go change in the previous commit. Without it the generated api/docs.json still advertises monasca as a queryable module and a settable tuning, while the code behind both has gone -- a client could ask the API to repair a module it no longer knows about. api/docs.json is not tracked; it is generated from the submodule by task generateApiDocs and embedded into the binary by api/docs.go's go:embed, so the bump does change the shipped artifact even though no tracked file moves. Verified: after the bump, yq produces a docs.json with zero monasca and zero senlin references. The pointer targets the openapi branch rather than its develop, since that PR has not merged yet; it wants re-bumping to the merged SHA before this lands. Signed-off-by: Jim Lin Co-authored-by: Eandalf Co-Authored-By: Claude Opus 5 (1M context) --- api/cube-cos-openapi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/cube-cos-openapi b/api/cube-cos-openapi index a34418d3..6217dc43 160000 --- a/api/cube-cos-openapi +++ b/api/cube-cos-openapi @@ -1 +1 @@ -Subproject commit a34418d338c775429c3405fdb80813fd5bbda2aa +Subproject commit 6217dc43032e8bb170200d646313b4b01e144eec