-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use uint64 in the ZFS collector #714
Use uint64 in the ZFS collector #714
Conversation
This looks good to me, thanks for the catch. We saw cases like this in our Lustre Exporter, but hadn't in the ZFS code. |
The travis error is unrelated. Travis was apparently rate-limited by |
Rather than changing to |
@SuperQ Any particular reason you'd advise avoiding the use of floats by default? We've erred on the side of just creating floats by default to prevent this sort of problem in other Go code. I haven't done any performance analysis comparing the two, curious if you have particularly strong reasons for what you suggested. |
Mainly, I am aiming for correctness of parsing the files exposed by the kernel. It's not something that will happen any time soon, but there are vague ideas that we may support |
An example of how we want to go is the xfs parser. |
Sounds reasonable, thanks for the explanation! I'll change this PR accordingly. |
If you want some real fun, you could port this code over to the procfs library. 😜 |
@fpletz As @SuperQ said, happy to merge it with uin64 but even better if you would move it to https://github.com/prometheus/procfs |
@fpletz Can you change it to uint64 so we can merge it. |
db2edaa
to
959878d
Compare
ZFS metrics can also be unsigned 64-bit integers that won't fit in int64 and causes the whole collector to fail.
959878d
to
07180f3
Compare
@discordianfish Thanks for the reminder. Rebased and changed to uint64. Tests are green. Ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Great, thanks! LGTM! |
ZFS metrics can also be unsigned 64-bit integers that won't fit in int64 and causes the whole collector to fail.
ZFS metrics can also be unsigned 64-bit integers that won't fit in int64 and causes the whole collector to fail.
Example
time="2017-10-25T17:28:16Z" level=error msg="ERROR: zfs collector failed after 0.000335s: could not parse expected integer value for \"kstat.zfs.misc.zil.zil_itx_needcopy_bytes\"" source="collector.go:123"
The internal ZFS datatype
kstat_named_t
can have an uint64 value: https://github.com/zfsonlinux/zfs/blob/master/lib/libspl/include/sys/kstat.h#L472Why float64 and not uint64?Prometheus uses float64 internally and the metrics would be converted to float64 eventually anyway.