Skip to content

fix(infra): read host filesystem utilization from the used state only - #1385

Merged
Makisuo merged 1 commit into
mainfrom
fix/host-filesystem-used-state
Oct 10, 2026
Merged

Makisuo merged 1 commit into
mainfrom
fix/host-filesystem-used-state

Conversation

@Makisuo

@Makisuo Makisuo commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

system.filesystem.utilization reports one row per state (used, free, reserved) for each mountpoint. Two readers didn't filter on state:

  • Host page filesystem chart (/infra/hosts/$hostName): hostMetricSpec("filesystem") runs hostGaugeTimeseriesQuery grouped by mountpoint, which averaged the three states. HostDetailChart plots the rows as returned, so every disk showed about 33%.
  • Host Metrics dashboard template, "Filesystem Utilization" widget: grouped by attr.mountpoint with no state filter. Same bug.

CPU and memory are correct. Both group by state, and the host page stacks them (stacked = metric === "cpu" || metric === "memory"), so each state is its own series and they sum to 100%. The host summary/list queries already pin state = 'used' for disk.

Fix

  • hostGaugeTimeseriesQuery takes an optional attributeEquals: { key, value } that adds an Attributes[key] = value condition.
  • hostMetricSpec("filesystem") sets attributeEquals: { key: "state", value: "used" }, and the API query passes it through.
  • The template widget's where clause now includes attr.state = "used".

Tests

  • infra.test.ts: compiled SQL contains Attributes['state'] = 'used' when the pin is set, and no state filter when it isn't.
  • query-helpers.test.ts (new): the filesystem spec compiles with the used pin, and the CPU/memory specs keep every state.
  • query-specs.test.ts: the template's filesystem widget carries attr.state = "used".

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

system.filesystem.utilization reports used, free and reserved rows per
mountpoint. The host page's filesystem chart and the Host Metrics
dashboard template averaged all three, so every disk read about a third
full. hostGaugeTimeseriesQuery takes an attributeEquals pin and the
filesystem spec sets state = 'used'; the template adds the same filter.
CPU and memory stay per-state stacked breakdowns.
@maple-review-bot

maple-review-bot Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 9/10 · safe to merge
The pin reaches both compile paths and the template where-clause mirrors the existing RabbitMQ attr.state precedent; tests assert the SQL in both directions.
quality 100/100 · no findings · tests covered · risk medium

Host filesystem utilization now reads only the state = 'used' data points, in both the host page timeseries and the "Host Metrics" template widget. The pin is threaded through the shared spec and query builder, and CPU/memory are untouched. Safe to merge.

  • hostGaugeTimeseriesQuery takes an optional attributeEquals { key, value } where condition
  • hostMetricSpec("filesystem") pins state = "used"; cpu/memory/load15/network pass undefined
  • hostInfraGaugeTimeseries compile forwards spec.attributeEquals to the builder
  • Host Metrics template's filesystem widget adds attr.state = "used" to its where clause
What was checked
  • Internal route hostInfraTimeseries runs the same modified registry query (query-engine.http.ts:1441, queries.ts:424), so both readers get the pin
  • The undefined where-condition entry follows the existing filtering pattern (errors.ts:125, infra.ts:528)
  • combineWhere(where, attr.state = "used") matches the RabbitMQ template's existing attr.state = "ready" idiom

6ef6dd1 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8562ceff-dc44-4899-a662-1a4e61a1204e

📥 Commits

Reviewing files that changed from the base of the PR and between cce3e33 and 6ef6dd1.


📒 Files selected for processing (7)
  • apps/api/src/routes/queries.ts
  • packages/backend/src/dashboard-templates/infrastructure/host-metrics.ts
  • packages/backend/src/dashboard-templates/query-specs.test.ts
  • packages/backend/src/queries/query-helpers.test.ts
  • packages/backend/src/queries/query-helpers.ts
  • packages/query-engine/src/ch/queries/infra.test.ts
  • packages/query-engine/src/ch/queries/infra.ts

  • 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.

@Makisuo
Makisuo merged commit 56be9f1 into main Oct 10, 2026
41 checks passed
@Makisuo
Makisuo deleted the fix/host-filesystem-used-state branch October 10, 2026 23:34
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.

1 participant