Observability Best Practices

Chapter 2 · Practice 1 of 4

Name metrics with base units and standard suffixes

From Metrics that stay useful and affordable

Why it matters

A metric called request_time leaves everyone guessing: milliseconds or seconds, a total or a histogram? The Prometheus naming guide removes the guesswork:

  • Use base units: seconds, bytes, meters. Not milliseconds or megabytes.
  • Put the unit at the end, plural: http_request_duration_seconds, node_memory_usage_bytes.
  • End counters with _total, after the unit if there is one: http_requests_total, process_cpu_seconds_total.
  • Express ratios as 0 to 1, not percentages.
  • Use _info for metadata metrics and _timestamp_seconds for timestamps.

OpenTelemetry has its own naming rules in its semantic conventions (for example http.server.request.duration in seconds). When you export OpenTelemetry metrics to Prometheus, the exporter translates names and adds unit suffixes, so follow the semantic conventions in OpenTelemetry code and let the exporter handle the rest.

Do

  • Use seconds and bytes everywhere
  • Add _total to every counter

Avoid

  • Mixing milliseconds and seconds across services