node_exporter icon indicating copy to clipboard operation
node_exporter copied to clipboard

Improve sockstat descriptions. Fixes #1856.

Open Hello71 opened this issue 3 years ago • 9 comments

Signed-off-by: Alex Xu (Hello71) [email protected]

Hello71 avatar Apr 11 '22 17:04 Hello71

v2: return error instead of panicking when sockstat has unexpected format

Hello71 avatar Apr 11 '22 18:04 Hello71

v3: fix indentation

Hello71 avatar Apr 11 '22 18:04 Hello71

Not sure we want to maintain such metric name <-> description mapping. My suggestion in #1856 was to just use a g eneric 'value from ' description instead. But open for arguments. @SuperQ wdyt?

discordianfish avatar Apr 14 '22 09:04 discordianfish

I think we can have better metrics names. value from <> makes the user explicly look for extra documentation, while providing direct info avoids that extra indirection.

roidelapluie avatar Apr 14 '22 09:04 roidelapluie

@roidelapluie I'm open to that but if we go down that route of having a mapping of metrics to descriptions, we can also have a mapping for the metric names to make them follow our naming best practices..

discordianfish avatar Apr 14 '22 10:04 discordianfish

we can also have a mapping for the metric names to make them follow our naming best practices..

according to the comment,

	// Previously these metric names were generated directly from the file output.
	// In order to keep the same level of compatibility, we must map the fields
	// to their correct names.

iiuc, you want to rename node_sockstat_TCP_tw to, say, node_time_wait_sockets. how will you maintain backwards compatibility?

Hello71 avatar Apr 14 '22 15:04 Hello71

I think this deserve a more generic discussion first. Currently we explicitly require collectors to not maintain such mapping as in https://github.com/prometheus/node_exporter/blob/master/CONTRIBUTING.md#collector-implementation-guidelines So for now I think we should close this.

discordianfish avatar Jul 25 '22 17:07 discordianfish

Currently we explicitly require collectors to not maintain such mapping as in https://github.com/prometheus/node_exporter/blob/master/CONTRIBUTING.md#collector-implementation-guidelines

This policy says "The metrics should not get transformed"; in this PR, I never suggested changing the metric name or value, only the help text.

If custom help texts are banned, should we remove all of the help texts from https://github.com/prometheus/node_exporter/blob/master/collector/slabinfo_linux.go, https://github.com/prometheus/node_exporter/blob/master/collector/zfs_freebsd.go, https://github.com/prometheus/node_exporter/blob/master/collector/xfs_linux.go, etc? How would that improve the user experience or save maintainer time?

If we look at the context of the policy (#321), "vendor based mappings" means things like SMART values, not Linux proc definitions. This interpretation makes much more sense: it is hardly any more work to add some help text to each already-Linux-specific proc file collection, whereas it would be much more work to keep a list of SMART values for each disk vendor on top of the Linux SMART collection.

Hello71 avatar Aug 28 '22 14:08 Hello71

I agree with @Hello71. The intention of the "not transformed" is about the value, not the naming or help text. Really, we want to provide as much help text as possible for the raw data coming from the kernel. Adding help text makes metrics easier to use.

Clarifying the policy is needed, but I think this PR is worth accepting.

SuperQ avatar Aug 28 '22 16:08 SuperQ