prometheus / prometheus/node_exporter

ZFS collector misparses dataset values that occur in the kstat field prefix

Open Beginner friendly
#3,761 0 comments 0 reactions 0 assignees View on GitHub

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_exporter 1.9.1
  • node_exporter 1.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.