Repository navigation
monitoring: aggregate cluster-wide filesystem gauges with max - #1274
Conversation
Every mounted node exports the same cluster-wide value for the scan-derived filesystem gauges, so summing them across nodes multiplies the real count by the number of mounts. Assert that the dashboard and the alert rules aggregate them with max. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7SRUUmVE4Xx7zhWr83amV
ListFilePlacementStats scans the whole store from every mounted node, so open_handle_lease_active, orphan_inode_gc_pending, files_by_group, file_multi_shard_current and file_move_inflight carry the same cluster-wide value on each node. The filesystem dashboard summed them, showing N times the real count with N mounted nodes; the matching alert rules compared a sum against zero. Both now use max, and the guide no longer warns about the dashboard. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7SRUUmVE4Xx7zhWr83amV
|
@codex review Generated by Claude Code |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 6
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d4be5efca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
elastickv_fs_file_move_inflight was max(local active jobs, last scan), so it was neither a pure cluster-wide scan gauge (max across nodes undercounts when two nodes resume different jobs before a scan) nor a per-node gauge (sum across nodes overcounts the shared scan value). It is now set only from the placement scan; the jobs this node is executing are exported on the new per-node gauge elastickv_fs_file_move_active_local. The dashboard shows both (max and sum), and the stuck-move alert fires on either. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7SRUUmVE4Xx7zhWr83amV
|
@codex review Generated by Claude Code |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Follow-up to the finding Codex raised on #1271:
ListFilePlacementStatsscans the whole store from every mounted node, so the scan-derived filesystem gauges (elastickv_fs_open_handle_lease_active,elastickv_fs_orphan_inode_gc_pending,elastickv_fs_files_by_group,elastickv_fs_file_multi_shard_current,elastickv_fs_file_move_inflight) carry the same cluster-wide value on each node. The filesystem dashboard summed them across nodes, so three mounted nodes showed three times the real count; three alert rules compared a sum against zero.Codex's review of this PR found that
elastickv_fs_file_move_inflightwas not a pure scan gauge: it wasmax(node-local active jobs, last scan), somaxacross nodes undercounted when two nodes resumed different jobs before a scan, andsumovercounted the shared scan value. The second commit separates the two sources.Behavior change
monitoring/filesystem.go:elastickv_fs_file_move_inflightis set only from the placement scan (cluster-wide). New per-node gaugeelastickv_fs_file_move_active_localexports the move jobs this process is executing.updateMoveInflightLockedandlastMoveInflightare gone.monitoring/grafana/dashboards/elastickv-filesystem.json: the five scan-derived gauge panels usemax(...)/max by (group_id) (...)instead ofsum; the "Moves In Flight" panel showsmax(elastickv_fs_file_move_inflight)("durable") andsum(elastickv_fs_file_move_active_local)("running on nodes"). The per-node counters (chunk I/O rates,_totalrates, latency histograms) keepsum.monitoring/prometheus/rules/filesystem.yml:ElastickvFilesystemMultiShardFileandElastickvFilesystemOrphanGCPendingusemax;ElastickvFilesystemMoveStuckfires when eithermax(elastickv_fs_file_move_inflight)orsum(elastickv_fs_file_move_active_local)stays above zero for 30 minutes, so clusters with placement scans disabled still alert from the local gauges.docs/filesystem.md: the metrics table documents both move gauges and which aggregation each needs; the Monitoring paragraph no longer warns that the dashboard sums the cluster-wide gauges.Risk
Low. One new gauge; no storage, replication or request-path code is touched. With a single mounted node
maxandsumare identical, and the stuck-move alert'sorkeeps its previous trigger (the local jobs) while adding the durable count.Evidence
monitoring/filesystem_dashboard_test.go(first commit) parses the dashboard JSON and the alert rules; it failed on the previous expressions (dashboard sums cluster-wide gauge elastickv_fs_open_handle_lease_active across nodes) and passes after the fix. It now also requireselastickv_fs_file_move_active_localto be summed and never maxed, and to have a dashboard panel.TestFileSystemMetricsSeparateLocalMoveJobsFromScan(third commit) models two nodes resuming different jobs with no scan: the cluster gauge stays 0 on both, the local gauge is 1 on each, a scan reporting 2 sets the cluster gauge on both, and releasing a job only changes the local gauge. It did not compile against the previous code (no local gauge) and passes after the split.go test ./monitoring/: ok.go vet ./monitoring/,gofmt -l: clean. The dashboard JSON still parses.golangci-lintcould not run locally (the installed binary was built with go1.25 and refuses the repo's go1.26 target); CI's golangci-lint passed on 2d4be5e and runs again on b1e989e.Self-review
ObserveMoveJobandObservePlacementStatsstill takem.mu; the local gauge is set under the lock fromlen(activeMoveJobs). Two nodes resuming distinct jobs are now counted bysumof the local gauge; the same job resumed on two nodes is counted twice there, which the durablemaxseries corrects once a scan runs.Setper job start/stop, andmaxandsumcost the same in PromQL.ListFilePlacementStatson every mounted node;maxreturns the most recently scanned node's value, which is the correct cluster-wide reading. The local gauge is per node by construction.🤖 Generated with Claude Code
https://claude.ai/code/session_01E7SRUUmVE4Xx7zhWr83amV