-
-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support client monitoring by a remote service (e.g. beaconcha.in) (#5037
) * Initial client monitoring implementation * Add monitoring to beacon node * Add monitoring to validator * Ensure that monitoring endpoint is a valid URL * Improve validation of monitoring endpoint * Improve error handling and timeout of remote server request * Wait for pending request before sending next one * Update request error handling * Update monitoring endpoint parsing * Export monitoring package * Fix process cpu seconds total metric Use "process_cpu_user_seconds_total" instead of "process_cpu_seconds_total" as it properly reports the CPU usage of the process and more importantly also triggers the collect method of the metric which ensures that always the latest value is shown. * Add option to collect system stats * Define system stats * Improve logs when monitoring service is started * Use the term "remote service" instead of "remote server" * Move Client type to service * Add monitoring args to beacon node test * Update description of monitoring cli args * Update monitoring service * Add metrics for collecting and sending data * Add monitoring panels to VM + host dashboard * Update send data metric buckets * Print out machine when starting monitoring service * Refactoring * Add unit tests * Add metric values for sync_eth1_connected and sync_eth1_fallback_configured * Use setTimeout instead of sleep for initial delay * Use milliseconds instead of seconds for time values * Add description to client stats properties * Remove sinon spies after tests are finished * Document client monitoring usage * Add enum to check status of monitoring service * Reduce info log when monitoring service is started Only print out information which is configurable by non-hidden CLI options and properly documented.
- Loading branch information
Showing
24 changed files
with
1,894 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Client monitoring | ||
|
||
Lodestar has the ability to send client stats to a remote service for collection. | ||
At the moment, the main service offering remote monitoring is [beaconcha.in](https://beaconcha.in/). | ||
|
||
Instructions for setting up client monitoring with *beaconcha.in* can be found in their docs about | ||
[Mobile App <> Node Monitoring](https://kb.beaconcha.in/beaconcha.in-explorer/mobile-app-less-than-greater-than-beacon-node) | ||
and in your [account settings](https://beaconcha.in/user/settings#app). | ||
|
||
## Configuration | ||
|
||
Lodestar provides CLI options to configure monitoring on both the beacon node and validator client. | ||
|
||
### Remote endpoint URL | ||
|
||
Client monitoring can be enabled by setting the `--monitoring.endpoint` flag to a remote service endpoint URL. | ||
As monitoring relies on metrics data, it is required that metrics are also enabled by supplying the `--metrics` flag. | ||
|
||
```bash | ||
lodestar beacon --monitoring.endpoint "https://beaconcha.in/api/v1/client/metrics?apikey={apikey}&machine={machineName}" --metrics | ||
``` | ||
|
||
In case of *beaconcha.in*, the API key can be found in your [account settings](https://beaconcha.in/user/settings#api). | ||
Setting the machine is optional but it is especially useful if you are monitoring multiple nodes. | ||
|
||
<!-- prettier-ignore-start --> | ||
!!! note | ||
When sending data to a remote service you should be conscious about security: | ||
|
||
- Only use a service that you trust as this will send information which may identify you | ||
and associate your validators, IP address and other personal information. | ||
- Always use a HTTPS connection (i.e. a URL starting with `https://`) to prevent the traffic | ||
from being intercepted in transit and leaking information. | ||
<!-- prettier-ignore-end --> | ||
|
||
More details about the data sent to the remote service can be found in the [specification](https://docs.google.com/document/d/1qPWAVRjPCENlyAjUBwGkHMvz9qLdd_6u9DPZcNxDBpc). | ||
|
||
It is also possible to print out the data sent to the remote service by enabling debug logs which can be done by supplying the `--logLevel debug` flag. | ||
|
||
### Monitoring interval | ||
|
||
It is possible to adjust the interval between sending client stats to the remote service by | ||
setting the `--monitoring.interval` flag. It takes an integer value in milliseconds, the default is `60000` which means data is sent once a minute. | ||
|
||
```bash | ||
lodestar beacon --monitoring.interval 60000 | ||
``` | ||
|
||
Increasing the monitoring interval can be useful if you are running into rate limit errors when posting large amounts of data for multiple nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.