Skip to content
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

Inconsistent encoding of units in metric names #186

Closed
streadway opened this Issue Apr 25, 2013 · 8 comments

Comments

Projects
None yet
4 participants
@streadway
Copy link

streadway commented Apr 25, 2013

The lack of units for the counter scalars has lead to encoding them in the docstring, or metric name itself. Does it make sense to use a label for units? It seems we have a metric level special meaning for the "name" label, does this extend also to "units"?

Examples of confusing names with the units encoded in different locations in the names, and in the docstring.

namespace_metric_units vs. namespace_units_metric

  • "http_request_durations_microseconds", "The amounts of time the default multiplexor has spent answering HTTP requests (microseconds)."
  • "http_request_bytes_total", "The total volume of content body sizes received (bytes)."
@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Apr 25, 2013

Since labels do come at a cost, IMO they should not be used for "documentation" purposes, i.e. for cases where they don't actually introduce new dimensionality. Unless you are exporting the same metric with different units (uncommon), a unit label wouldn't add any new dimension, so I'd rather advise against this and keep using a naming convention.

@streadway

This comment has been minimized.

Copy link
Author

streadway commented Apr 25, 2013

I would suggest documenting a grammar for the naming convention then so we don't mix up "bytes_total" with "total_bytes", or "ms_elapsed" with "elapsed_milliseconds".

{namespace (lowercase, shared with any --flags)}_{metric name lowercase, underscore delimited}_{units in full, lower case SI notation with no underscores}

@matttproud

This comment has been minimized.

Copy link
Member

matttproud commented Apr 25, 2013

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 23, 2014

Labels for units don't make sense, having them as metadata (similar to whether something is a counter or gauge) would be useful though.

If we can get everyone on un-prefixed SI units as much as possible that'd be good. We already seem to have a mix of microseconds, milliseconds, and seconds.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented May 23, 2014

@brian-brazil If you use unprefixed SI units (seconds in case of time) and you want to measure something in the nanosecond range, the result becomes much less readable though?

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 23, 2014

I think that everything should be exported, stored and calculated in seconds - and only when rendering for human display to change to nanoseconds. This is similar logic to why you should always use unixtime when processing, and only apply timezones when rendering.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jan 8, 2015

This got resolved a while ago, closing.

@juliusv juliusv closed this Jan 8, 2015

simonpasquier pushed a commit to simonpasquier/prometheus that referenced this issue Oct 12, 2017

Merge pull request prometheus#186 from dln/patch-1
Document meta label for serverset shard discovery
@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.