Skip to content

monitoring: aggregate cluster-wide filesystem gauges with max - #1274

Merged
bootjp merged 3 commits into
mainfrom
fix/filesystem-dashboard-max
Oct 15, 2026
Merged

bootjp merged 3 commits into
mainfrom
fix/filesystem-dashboard-max

Conversation

@bootjp

@bootjp bootjp commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up to the finding Codex raised on #1271: ListFilePlacementStats scans 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_inflight was not a pure scan gauge: it was max(node-local active jobs, last scan), so max across nodes undercounted when two nodes resumed different jobs before a scan, and sum overcounted the shared scan value. The second commit separates the two sources.

Behavior change

  • monitoring/filesystem.go: elastickv_fs_file_move_inflight is set only from the placement scan (cluster-wide). New per-node gauge elastickv_fs_file_move_active_local exports the move jobs this process is executing. updateMoveInflightLocked and lastMoveInflight are gone.
  • monitoring/grafana/dashboards/elastickv-filesystem.json: the five scan-derived gauge panels use max(...) / max by (group_id) (...) instead of sum; the "Moves In Flight" panel shows max(elastickv_fs_file_move_inflight) ("durable") and sum(elastickv_fs_file_move_active_local) ("running on nodes"). The per-node counters (chunk I/O rates, _total rates, latency histograms) keep sum.
  • monitoring/prometheus/rules/filesystem.yml: ElastickvFilesystemMultiShardFile and ElastickvFilesystemOrphanGCPending use max; ElastickvFilesystemMoveStuck fires when either max(elastickv_fs_file_move_inflight) or sum(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 max and sum are identical, and the stuck-move alert's or keeps 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 requires elastickv_fs_file_move_active_local to 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-lint could 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

  1. Data loss — no issues; no storage or replication code is touched.
  2. Concurrency / distributed failures — ObserveMoveJob and ObservePlacementStats still take m.mu; the local gauge is set under the lock from len(activeMoveJobs). Two nodes resuming distinct jobs are now counted by sum of the local gauge; the same job resumed on two nodes is counted twice there, which the durable max series corrects once a scan runs.
  3. Performance — no issues; one extra gauge Set per job start/stop, and max and sum cost the same in PromQL.
  4. Data consistency — the cluster gauges are produced by ListFilePlacementStats on every mounted node; max returns the most recently scanned node's value, which is the correct cluster-wide reading. The local gauge is per node by construction.
  5. Test coverage — the dashboard test locks the aggregation for the five cluster-wide gauges and the per-node move gauge in both the dashboard and the alert rules; the metrics test locks the separation of local and scan-derived move counts; the existing placement test still asserts that the durable scan is authoritative for the cluster gauge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E7SRUUmVE4Xx7zhWr83amV

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

bootjp commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d878f639-4d2d-40f5-beee-637746d8de03
📥 Commits

Reviewing files that changed from the base of the PR and between 00801b4 and b1e989e.

📒 Files selected for processing: 6
  • docs/filesystem.md
  • monitoring/filesystem.go
  • monitoring/filesystem_dashboard_test.go
  • monitoring/filesystem_test.go
  • monitoring/grafana/dashboards/elastickv-filesystem.json
  • monitoring/prometheus/rules/filesystem.yml
+----------------------------------------------------------------------------------+
| This is the beginning of a beautiful friendship...between you and bug-free code. |
+----------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T14:37:49.645146Z b1e989e Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

bootjp commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: b1e989e57b

ℹ️ 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".

@bootjp
bootjp marked this pull request as ready for review October 15, 2026 14:35
@bootjp
bootjp merged commit 5143b82 into main Oct 15, 2026
10 of 11 checks passed
@bootjp
bootjp deleted the fix/filesystem-dashboard-max branch October 15, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants