prometheus / prometheus/node_exporter
ZFS collector misparses dataset values that occur in the kstat field prefix
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13.8k
- Forks
- 2.7k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 8
Description
Host operating system
Linux 7.0.14-4-pve x86_64, OpenZFS 2.4.3
node_exporter version
Reproduced with both:
node_exporter1.9.1node_exporter1.12.1
The same parsing code is present on the current default branch.
What did you do?
Created/read the root dataset of a pool named data. Its objset kstat contains
a valid string field:
dataset_name 7 data
The child dataset data/vm-1101-disk-0 is parsed correctly, so this is specific
to a dataset value that occurs earlier in the complete input line.
What did you expect to see?
node_zfs_zpool_dataset_nwritten{dataset="data",zpool="data"} ...
What did you see instead?
node_zfs_zpool_dataset_nwritten{dataset="dataset_name 7 data",zpool="data"} ...
Cause
parsePoolObjsetFile currently extracts the dataset with:
datasetName = line[strings.Index(line, parts[2]):]
For the value data, strings.Index matches the data at the beginning of
dataset_name, rather than the value in the third column. The resulting label
is therefore the entire input line. Joining parts[2:] would retain dataset
names containing spaces without searching the field-name/type prefix.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with parsePoolObjsetFile, using the reported root dataset case where the value is data and also appears in dataset_name. Check the parsing and add or update coverage for the resulting node_zfs_zpool_dataset_nwritten label; done means the root dataset is labeled dataset="data" while child dataset parsing remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100