github.com/status-im/status-go@v1.1.0/metrics/README.md (about)

     1  # Description
     2  
     3  This package configures Prometheus metrics for the node.
     4  
     5  # Technical Details
     6  
     7  We use a trick to combine our metrics with Geth ones.
     8  
     9  The `NewMetricsServer()` function in [`metrics.go`](./metrics.go) calls our own `Handler()` function which in turn calls two handlers:
    10  
    11  * `promhttp.HandlerFor()` - Our own custom metrics from this package.
    12  * `gethprom.Handler(reg)` - Geth metrics defined in [`metrics`](https://github.com/ethereum/go-ethereum/tree/master/metrics)
    13  
    14  By calling both we can extend existing metrics.
    15  
    16  # Metrics
    17  
    18  We add a few extra metrics on top of the normal Geth ones in [`node/metrics.go`](./node/metrics.go):
    19  
    20  * `p2p_peers_count` - Current numbers of peers split by name.
    21  * `p2p_peers_absolute` - Absolute number of connected peers.
    22  * `p2p_peers_max` - Maximum number of peers that can connect.
    23  
    24  The `p2p_peers_count` metrics includes 3 labels:
    25  
    26  * `type` - Set to `StatusIM` for mobile and `Statusd` for daemon.
    27  * `version` - Version of `status-go`, always with the `v` prefix.
    28  * `platform` - Host platform, like `android-arm64` or `darwin-arm64`
    29  
    30  The way this data is acquired is using node names, which look like this:
    31  ```
    32  StatusIM/vrelease-0.30.1-beta.2/android-arm/go1.11.5
    33  Statusd/v0.34.0-beta.3/linux-amd64/go1.13.1
    34  Geth/v1.9.9-stable-5aa131ca/linux-amd64/go1.13.3
    35  ```
    36  This 4 segment format is standard for Ethereum as you can see on https://ethstats.net/.
    37  
    38  We parse the names using `labelsFromNodeName()` from [`node/metrics.go`](./node/metrics.go).
    39  
    40  # Links
    41  
    42  * https://github.com/status-im/infra-misc/issues/26
    43  * https://github.com/status-im/status-go/pull/1648