Commit Graph

19 Commits

Author SHA1 Message Date
Jakub Sokołowski 714eb416d2 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>
2021-08-24 11:07:39 +02:00
Andrea Maria Piana b30f671135 Remove metrics test 2021-07-20 10:57:38 +02:00
Andrea Maria Piana d84da4f515 Fix some tests and restore private/public RPC client 2021-07-20 10:57:38 +02:00
Andrea Maria Piana 4685b9eaa9 Handle deadlock in peerpool
There was another deadlock in the peer pool.
Because we made the event handler asynchrnous, another deadlock popped
up, as the loop locks the global peerpool lock before processing events.
But the handlers also take the global look, effectively resulting in the
same situation we had before, i.e the loop is not running.

THE LOOP MUST BE RUNNING AT ALL TIMES OTHERWISE THE SERVER HANGS.
2021-02-02 07:58:17 +01:00
Andrea Maria Piana b4e5bf417b Handle peer event async in metrics
There might be an issue on how we handle metrics, which causes the p2p
server to hang.

updateNodeMetrics calls  a method on the p2p server, which
blocks until the server is available:

e60f425b45/vendor/github.com/ethereum/go-ethereum/p2p/server.go (L301)
e60f425b45/vendor/github.com/ethereum/go-ethereum/p2p/server.go (L746)
If there's back-pressure on the peer event feed
e60f425b45/vendor/github.com/ethereum/go-ethereum/p2p/server.go (L783)

The event channel above might become while updateNodeMetrics
is called, which means is never consumed, the server blocks on publishing on
it, and the two will deadlock (server waits for the channel above to be consumed,
this code waits for the server to respond to peerCount, which is in the same
event loop).

Calling it in a different go-routine will allow this code to keep
processing peer added events, therefore the server will not lock and keep processing requests.
2021-02-02 07:58:17 +01:00
Andrea Maria Piana fd4c627c2e Ignore full node flag when in topic mode 2020-03-23 15:10:07 +01:00
Jakub Sokołowski 7785aecd65
add README for metrics (#1906) 2020-03-17 22:09:21 +01:00
Pedro Pombeiro c8a911ebd1 Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00
Jakub Sokołowski c1f17cb4a3 use prometheus/client_golang for metrics
also re-implement mailserver metrics

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-11-04 13:18:50 +01:00
Adam Babik 26880b83d7
Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
Ivan Daniluk 4f3f5ee574 Gomobile support (#1164) 2019-02-01 18:02:52 +01:00
Adam Babik 04ba4d44e8
fix collecting p2p/Peers metric (#1269) 2018-11-12 10:27:09 +01:00
Pedro Pombeiro 354e23aaf5 Fix issues reported by lint. Part of #1017 2018-06-14 13:52:51 +02:00
Adam Babik 4dfbef3867
Fix p2p/Peers metric (#975)
Do not use server.PeerCount() when getting peers right after receiving add/remove peer event as it does not contain updated info.
2018-05-22 12:26:03 +02:00
Adam Babik 6da469140f
Refactor in-app metrics (#963)
Remove Prometheus and other metric types and use metrics package from go-ethereum.
2018-05-16 17:36:59 +02:00
Alex Kohler 4a01a395b4 Move status-go over to go-ethereum/log #717 (#727) 2018-03-20 19:35:28 +01:00
Adam Babik 24aa1b0f1c add node_peers Prometheus metric 2018-02-13 15:18:29 +01:00
Alex Kohler 365bc662a2 Enable gometalinter on tests and fix static analysis issues #631 (#644)
* Enable gometalinter on tests and fix static analysis issues

* Remove unneeded change

* Fix additional lint errors

* Add nolint directives and error checks

* Add error assertions instead of nolint directives

* Go back to using lint directive for loop.Run goroutine

* Add error check to loop.Run
2018-02-12 13:16:06 +02:00
Adam Babik 89d89681a3
Add support for metrics (#558)
It adds support for metrics (expvar and Prometheus) along with docker-compose files to run a Whisper test cluster.
2018-01-30 12:51:48 +01:00