metrics: fix p2p_peers_count metrics labels

Because `p2p.Server.Name()` function started returning an abbreviated
name of the node this broke the parsing of the name in order to fill in
the labels for `p2p_peers_count` metric, resulting in metrics like this:
```sh
 > curl -sS localhost:9090/metrics | grep '^p2p_peers_count'
p2p_peers_count{platform="v0.79.0",type="Statusd",version="unknown"} 3
```
Caused by value returned from `Name()` to look like this:
```
Statusd/v0.79.0/linu...
```
By using `Fullname()` we are sure we are pasing all the segments.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-08-24 10:18:42 +02:00 committed by Jakub
parent 0e54d04e67
commit 714eb416d2
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ func calculatePeerCounts(server *p2p.Server) {
nodePeersGauge.Reset() nodePeersGauge.Reset()
for _, p := range peers { for _, p := range peers {
labels, err := labelsFromNodeName(p.Name()) labels, err := labelsFromNodeName(p.Fullname())
if err != nil { if err != nil {
logger.Warn("failed parsing peer name", "error", err, "name", p.Name()) logger.Warn("failed parsing peer name", "error", err, "name", p.Name())
continue continue