github.com/badrootd/celestia-core@v0.0.0-20240305091328-aa4207a4b25d/docs/core/metrics.md (about)

     1  ---
     2  order: 5
     3  ---
     4  
     5  # Metrics
     6  
     7  CometBFT can report and serve the Prometheus metrics, which in their turn can
     8  be consumed by Prometheus collector(s).
     9  
    10  This functionality is disabled by default.
    11  
    12  To enable the Prometheus metrics, set `instrumentation.prometheus=true` in your
    13  config file. Metrics will be served under `/metrics` on 26660 port by default.
    14  Listen address can be changed in the config file (see
    15  `instrumentation.prometheus\_listen\_addr`).
    16  
    17  ## List of available metrics
    18  
    19  The following metrics are available:
    20  
    21  | **Name**                                   | **Type**  | **Tags**         | **Description**                                                        |
    22  |--------------------------------------------|-----------|------------------|------------------------------------------------------------------------|
    23  | consensus\_height                          | Gauge     |                  | Height of the chain                                                    |
    24  | consensus\_validators                      | Gauge     |                  | Number of validators                                                   |
    25  | consensus\_validators\_power               | Gauge     |                  | Total voting power of all validators                                   |
    26  | consensus\_validator\_power                | Gauge     |                  | Voting power of the node if in the validator set                       |
    27  | consensus\_validator\_last\_signed\_height | Gauge     |                  | Last height the node signed a block, if the node is a validator        |
    28  | consensus\_validator\_missed\_blocks       | Gauge     |                  | Total amount of blocks missed for the node, if the node is a validator |
    29  | consensus\_missing\_validators             | Gauge     |                  | Number of validators who did not sign                                  |
    30  | consensus\_missing\_validators\_power      | Gauge     |                  | Total voting power of the missing validators                           |
    31  | consensus\_byzantine\_validators           | Gauge     |                  | Number of validators who tried to double sign                          |
    32  | consensus\_byzantine\_validators\_power    | Gauge     |                  | Total voting power of the byzantine validators                         |
    33  | consensus\_block\_interval\_seconds        | Histogram |                  | Time between this and last block (Block.Header.Time) in seconds        |
    34  | consensus\_rounds                          | Gauge     |                  | Number of rounds                                                       |
    35  | consensus\_num\_txs                        | Gauge     |                  | Number of transactions                                                 |
    36  | consensus\_total\_txs                      | Gauge     |                  | Total number of transactions committed                                 |
    37  | consensus\_block\_parts                    | Counter   | peer\_id         | Number of blockparts transmitted by peer                               |
    38  | consensus\_latest\_block\_height           | Gauge     |                  | /status sync\_info number                                              |
    39  | consensus\_fast\_syncing                   | Gauge     |                  | Either 0 (not fast syncing) or 1 (syncing)                             |
    40  | consensus\_state\_syncing                  | Gauge     |                  | Either 0 (not state syncing) or 1 (syncing)                            |
    41  | consensus\_block\_size\_bytes              | Gauge     |                  | Block size in bytes                                                    |
    42  | consensus\_step\_duration                  | Histogram | step             | Histogram of durations for each step in the consensus protocol         |
    43  | consensus\_block\_gossip\_parts\_received  | Counter   | matches\_current | Number of block parts received by the node                             |
    44  | p2p\_message\_send\_bytes\_total           | Counter   | message\_type    | Number of bytes sent to all peers per message type                     |
    45  | p2p\_message\_receive\_bytes\_total        | Counter   | message\_type    | Number of bytes received from all peers per message type               |
    46  | p2p\_peers                                 | Gauge     |                  | Number of peers node's connected to                                    |
    47  | p2p\_peer\_receive\_bytes\_total           | Counter   | peer\_id, chID   | Number of bytes per channel received from a given peer                 |
    48  | p2p\_peer\_send\_bytes\_total              | Counter   | peer\_id, chID   | Number of bytes per channel sent to a given peer                       |
    49  | p2p\_peer\_pending\_send\_bytes            | Gauge     | peer\_id         | Number of pending bytes to be sent to a given peer                     |
    50  | p2p\_num\_txs                              | Gauge     | peer\_id         | Number of transactions submitted by each peer\_id                      |
    51  | p2p\_pending\_send\_bytes                  | Gauge     | peer\_id         | Amount of data pending to be sent to peer                              |
    52  | mempool\_size                              | Gauge     |                  | Number of uncommitted transactions                                     |
    53  | mempool\_tx\_size\_bytes                   | Histogram |                  | Transaction sizes in bytes                                             |
    54  | mempool\_failed\_txs                       | Counter   |                  | Number of failed transactions                                          |
    55  | mempool\_recheck\_times                    | Counter   |                  | Number of transactions rechecked in the mempool                        |
    56  | state\_block\_processing\_time             | Histogram |                  | Time between BeginBlock and EndBlock in ms                             |
    57  
    58  
    59  ## Useful queries
    60  
    61  Percentage of missing + byzantine validators:
    62  
    63  ```md
    64  ((consensus\_byzantine\_validators\_power + consensus\_missing\_validators\_power) / consensus\_validators\_power) * 100
    65  ```
    66  
    67  ## Profiling with Pyroscope
    68  
    69  Flamegraphs for metrics such as execution time and allocations can be generated
    70  using [Pyroscope](https://pyroscope.io/docs/). To enable pyroscope profiling,
    71  set `pyroscope_trace` to `true`  and add the url of the pyroscope server being
    72  used to `pyroscope_url` in the config file (`config.toml`). The types of
    73  profiling can be refined by removing or adding profile types to the
    74  `pyroscope_profile_types` string list in the same config.