How to choose label names

Hey.

I wondered how one should best choose the names of labels in the following scenario (which is a bit made up, but I guess one can get the point):

Consider, that one wants to make metrics about the following objects:

  • hosts
  • filesystems
  • block-devices

Now the metrics for each of these will likely have some labels that uniquely identify the respective object (host, filesystem, block-device), so in an *_info metric one might have the following:

  • host_info{name="foo.example.org"}
  • filesystem_info{host="foo.example.org", block_device="/dev/sda"}
  • block_device_info{host="foo.example.org", file="/dev/sda", name="Seagate Exos 30TB"}

Currently, all label names are chosen purely from the respective metric’s point of view, that is:

  • if the metric name is already host_info,name= may already be enough an one doesn’t have to use the longer hostname=
  • a filesystem is always located on some host and there on some block device
  • a block device is also located on some host and there identified (for example) by a file, it may also have a name

It’s obvious that the name=from host_info is the same as the host= from the other two (which could also be named hostname=), but not the same as the name= from block_device_info.
Similarly, block_device=is the same than file=.

Now the above mess, may obviously cause troubles when joining metrics. Of course one can do label_replace, but I’d guess it’s rather not a cheap operation?!

So the question of this topic is, should one choose rather concise label names (from each single metric’s PoV) like above name= for host_info?

Or should one (try) to choose names that work well over all metrics (like host_name=, device_name=?
Of course, it might be difficult to foresee an possible future metrics/labels and thus it might be hard to choose a name that really works in general. And for some cases, like above block_device= and file=it might be impossible per se, because it depends on the context[0].

So are there any recommendations?

Thanks,
Chris.

[0] Again a bit made up, bit if one would name both (the more generic) file=, then one might want to join block_device_infowith another metric file_info which actually describes files on block devices and where a file=label would perhaps be the name of such file, where the file= from block_device_info would be the name of the device file on which the filesystem is.
If, OTOH, one goes fort he more specific block_device= label, it might “break” again in the same example, namely if one wants to join the block_device_info metric with the file_info metric for the block device file.