Repository navigation
fix(database): inline validated ids in Btrfs and ZFS history queries for InfluxDB OSS (#1111) - #1124
Merged
Merged
Conversation
…for InfluxDB OSS (#1111) Flux query parameters (params.*) are an InfluxDB Cloud feature. InfluxDB OSS, which the omnibus image ships, rejects them with "undefined identifier params", so GetBtrfsMetricsHistory and GetZFSPoolMetricsHistory failed on every call and the detail pages never showed their usage history charts. GetZFSPoolMetricsHistory was fixed in #157 and regressed one day later when merge 98a1b43 resolved a conflict back to the parameterized form. The Btrfs query was added afterwards with the same construct. - Validate the identifier inside each repository function and inline it as a strconv.Quote Flux string literal, the pattern GetMdadmMetricsHistory and the temperature queries already use. - Add a forbidigo rule so QueryWithParams and QueryRawWithParams fail lint, which stops a merge-conflict resolution from restoring the pattern silently. - Add tests that assert the generated query inlines the quoted id, never contains params., and that an invalid id is rejected before any query runs. Closes #1111
Starosdev
pushed a commit
that referenced
this pull request
Nov 5, 2026
## [1.80.0](v1.79.3...v1.80.0) (2026-11-05) ### Features * **btrfs:** notify on degraded filesystems, device errors and scrub errors ([#1127](#1127)) ([36e1e23](36e1e23)), closes [#1110](#1110) * manual release trigger ([44f3e44](44f3e44)) * **notify:** alert when Btrfs or ZFS usage reaches a configurable threshold ([#1133](#1133)) ([6e79118](6e79118)), closes [#1127](#1127) [#1132](#1132) [#1127](#1127) * **zfs:** notify on unhealthy pools, error totals and scrub errors ([#1131](#1131)) ([9c6544c](9c6544c)), closes [#1127](#1127) [#1130](#1130) [#1127](#1127) ### Bug Fixes * **database:** inline validated ids in Btrfs and ZFS history queries for InfluxDB OSS ([#1111](#1111)) ([#1124](#1124)) ([b0a1c69](b0a1c69)), closes [#157](#157) [#155](#155) [#157](#157) [#157](#157) * **mdadm:** honor repeat notifications and retry failed degraded alerts ([#1128](#1128)) ([62f9cef](62f9cef)), closes [#1109](#1109) * **notify:** notify on manufacturer SMART failures at every notify level ([#1126](#1126)) ([5cb3622](5cb3622))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Btrfs filesystem and ZFS pool detail pages never show their usage history charts on InfluxDB OSS.
GetBtrfsMetricsHistoryandGetZFSPoolMetricsHistoryused Flux query parameters (params.uuid,params.guid), which only InfluxDB Cloud supports. OSS rejects every call withundefined identifier params, the handlers log a warning, and the API returnsmetrics_history: null.GetZFSPoolMetricsHistorywas fixed in #157 and regressed one day later: merge98a1b439resolved a conflict back to the parameterized form. The Btrfs query was added in May with the same construct. Nothing in CI caught either.Type of Change
Related Issues
Fixes #1111
Related to #155, #157
Changes Made
scrutiny_repository_btrfs.go,scrutiny_repository_zfs.go: validate the identifier inside the repository function (ValidateUUID/ValidateGUID) and inline it as astrconv.QuoteFlux string literal viaQuery. This is the patternGetMdadmMetricsHistoryand the temperature queries already use. Handler-level validation stays as a second layer..golangci.yml: enableforbidigowith a rule that fails lint onQueryWithParams/QueryRawWithParams, so a future merge-conflict resolution cannot restore the pattern silently. The message points at fix(database): revert parameterized queries for InfluxDB OSS compatibility #157 and [BUG] Btrfs usage history is never shown: parameterized Flux query fails on InfluxDB OSS ("undefined identifier params"), same as #155 #1111.scrutiny_repository_metrics_history_test.go: a recordingQueryAPIstub asserts the generated query inlines the quoted id and never containsparams., and that an invalid id is rejected before any query runs.Testing
Local:
go build ./webapp/backend/pkg/database/andgo vet ./webapp/backend/pkg/database/pass;gofmt -lclean on changed files; pre-commit gofmt and vet hooks pass. The Go test suite andgolangci-lintrun in CI on this PR; I did not run the full suite locally. No Btrfs or ZFS host was available to verify the chart end to end; the issue reporter's reproduction (metrics_history: nullplus theundefined identifier paramswarning) is the failing path these changes remove.Review: not required (change ships through the develop-to-master promotion PR and a manual release, no direct production effect on merge)
Follow-up
Even with the query working, both charts are capped at the main bucket's 15-day retention:
btrfs_filesystemandzfs_poolare not part of the downsampling tasks, andlookupBucketNameroutes month and year ranges to_weekly/_monthlybuckets that hold no data for them. Not addressed here; an enhancement issue for downsampling the capacity fields and adding a range selector on both detail pages is still to be filed.betacarries the same twoparams.*queries (scrutiny_repository_btrfs.go:215,scrutiny_repository_zfs.go:382) and gets this fix through the next master-into-beta sync. Theforbidigorule will flag them there until the sync lands.Checklist