github.com/koko1123/flow-go-1@v0.29.6/module/metrics/convention.md (about)

     1  # Metrics Conventions
     2  Rough overview of how metrics should be named and used
     3  
     4  ## Naming
     5  ### Namespace
     6  The component of code this metric is under.
     7  - If it's under a module, use the module name.
     8    eg: `hotstuff`, `network`, `storage`, `mempool`, `interpreter`, `crypto`
     9  - If it's a core metric from a node, use the node type.
    10    eg: `consensus`, `verification`, `access`
    11  
    12  ### Subsystem
    13  Within the component, describe the part or function referred to.
    14  
    15  Subsystem is optional if the entire namespace is small enough to not be segmented further.
    16  
    17  eg: under `hotstuff`: `follower`, `...`
    18  
    19  eg: under `storage`: `badger`, `trie`, `cache`
    20  
    21  ### Naming
    22  The actual metric name should clearly identify what's actually being collected.
    23  The name should be like an inverse domain, and get more specific left to right.
    24  
    25  eg: `transaction_size_bytes` rather than `size_of_transaction`
    26  
    27  If the metric is in the form of a verb, it should be in the past tense.
    28  `finalized`, `issued`, `sent`
    29  
    30  Metrics should always be suffixed with the unit the metric is in, pluralized.
    31  `seconds`, `bytes`, `messages`, `transactions`, `chunks`
    32  
    33  Use the [Prometheus standard base units](https://prometheus.io/docs/practices/naming/#base-units).
    34  Avoid `milliseconds`, `bits`, etc
    35  
    36  If the metrics is an ever accumulating counter, it should be additionally suffixed with `total` after the unit.
    37  `seconds_total`, `transations_total`
    38  
    39  Do not repeat any of the terms used in `Namespace` or `Subsystem` in the metric name.
    40  
    41  ## Constant Labels
    42  Add labels for constant information
    43  
    44  Const Label | Value
    45  ------------|------
    46  node_role   | [collection, consensus, execution, verification, access]
    47  beta_metric | `true` *only set if the metric is in beta