blackbox_exporter icon indicating copy to clipboard operation
blackbox_exporter copied to clipboard

Consider adding unit to probe_http_content_length metric

Open invidian opened this issue 5 years ago • 4 comments

According to Prometheus naming convention, metrics should end with unit, so perhaps probe_http_content_length metric could be renamed to probe_http_content_length_bytes, so it is immediately obvious with what kind of data you work with.

According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length, Content-Length header is always expressed in bytes though, so feel free to close this issue if it does not make sense.

invidian avatar Jun 25 '20 21:06 invidian

This makes sense, the blackbox exporter is kinda old and many of the metric names and semantics aren't the best given we now have things like staleness. I'd prefer to fix them all up in one go, rather than breaking things in dribs and drabs.

brian-brazil avatar Jun 25 '20 22:06 brian-brazil

Yeah, while going trough output of HTTP probes, I found a bit more:

  • probe_http_content_length and probe_http_uncompressed_body_length should be unified, I think body_length and content_length is the same
  • I'm not sure if probe is good prefix for the metrics, Maybe blackbox_probe? I'm not sure :)
  • probe_failed_due_to_regex could be made into something like probe_failed{reason="regex"}, so there can also be reason="tls_handshake", reason="nxdomain"

I could perhaps come up with more ideas if that make sense. I'm just starting working with blackbox exporter, but so far, it looks great :)

invidian avatar Jun 25 '20 22:06 invidian

I think body_length and content_length is the same

They're different.

I'm not sure if probe is good prefix for the metrics

It's fine.

probe_failed{reason="regex"}

That's a bit messy semantically, as some entries may not always be present.

brian-brazil avatar Jun 25 '20 22:06 brian-brazil

I think it would be a breaking change to change metric names underneath users.

if we do this, it should be done in a opt-in style where users who wish to get units can enable a flag and get the metric names with units and avoid breaking it for users who wish to keep using the existing names.

@invidian checking in to see if still you wish to work on it. if you don't wish to work on it, feel free to close this issue.

electron0zero avatar Oct 29 '25 19:10 electron0zero