All structured logs and metrics measured in units should include a suffix in their name

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Structured logs and metrics should have an appropriate suffix.

For Prometheus metrics, we should stick to the prometheus naming conventions:

  • ..should have a suffix describing the unit, in plural form. Note that an accumulating count has total as a suffix, in addition to the unit if applicable.
    • http_request_duration_seconds
    • node_memory_usage_bytes
    • http_requests_total (for a unit-less accumulating count)
    • process_cpu_seconds_total (for an accumulating count with unit)
    • foobar_build_info (for a pseudo-metric that provides metadata about the running binary)

For structured logging, the unit should be abbreviated (to save bandwidth) and use the following unit prefixes:

  • duration_s Duration in seconds
  • duration_ms Duration in milliseconds (discouraged, prefer seconds)
  • size_b Size in bytes

For structured logging, unit-less values should not have a prefix:

  • gitaly_calls
  • db_calls

The following discussion from !18066 (merged) should be addressed:

  • @ayufan started a discussion: (+1 comment)

    Make it clear: in _ms.

    Should we create an issue to change the duration to be duration_s for the consistency purposes and deprecate duration?

Edited Sep 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading