mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Monitoring service api (#2251)
## Issue Addressed N/A ## Proposed Changes Adds a client side api for collecting system and process metrics and pushing it to a monitoring service.
This commit is contained in:
@@ -232,6 +232,23 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.takes_value(true),
|
||||
)
|
||||
|
||||
/*
|
||||
* Monitoring metrics
|
||||
*/
|
||||
|
||||
.arg(
|
||||
Arg::with_name("monitoring-endpoint")
|
||||
.long("monitoring-endpoint")
|
||||
.value_name("ADDRESS")
|
||||
.help("Enables the monitoring service for sending system metrics to a remote endpoint. \
|
||||
This can be used to monitor your setup on certain services (e.g. beaconcha.in). \
|
||||
This flag sets the endpoint where the beacon node metrics will be sent. \
|
||||
Note: This will send information to a remote sever which may identify and associate your \
|
||||
validators, IP address and other personal information. Always use a HTTPS connection \
|
||||
and never provide an untrusted URL.")
|
||||
.takes_value(true),
|
||||
)
|
||||
|
||||
/*
|
||||
* Standard staking flags
|
||||
*/
|
||||
|
||||
@@ -136,6 +136,17 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.http_metrics.allow_origin = Some(allow_origin.to_string());
|
||||
}
|
||||
|
||||
/*
|
||||
* Explorer metrics
|
||||
*/
|
||||
if let Some(monitoring_endpoint) = cli_args.value_of("monitoring-endpoint") {
|
||||
client_config.monitoring_api = Some(monitoring_api::Config {
|
||||
db_path: None,
|
||||
freezer_db_path: None,
|
||||
monitoring_endpoint: monitoring_endpoint.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
// Log a warning indicating an open HTTP server if it wasn't specified explicitly
|
||||
// (e.g. using the --staking flag).
|
||||
if cli_args.is_present("staking") {
|
||||
|
||||
@@ -63,14 +63,14 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
|
||||
let log = context.log().clone();
|
||||
let datadir = client_config.create_data_dir()?;
|
||||
let db_path = client_config.create_db_path()?;
|
||||
let freezer_db_path_res = client_config.create_freezer_db_path();
|
||||
let freezer_db_path = client_config.create_freezer_db_path()?;
|
||||
let executor = context.executor.clone();
|
||||
|
||||
let builder = ClientBuilder::new(context.eth_spec_instance.clone())
|
||||
.runtime_context(context)
|
||||
.chain_spec(spec)
|
||||
.http_api_config(client_config.http_api.clone())
|
||||
.disk_store(&datadir, &db_path, &freezer_db_path_res?, store_config)?;
|
||||
.disk_store(&datadir, &db_path, &freezer_db_path, store_config)?;
|
||||
|
||||
let builder = if let Some(slasher_config) = client_config.slasher.clone() {
|
||||
let slasher = Arc::new(
|
||||
@@ -82,6 +82,14 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
|
||||
builder
|
||||
};
|
||||
|
||||
let builder = if let Some(monitoring_config) = &mut client_config.monitoring_api {
|
||||
monitoring_config.db_path = Some(db_path);
|
||||
monitoring_config.freezer_db_path = Some(freezer_db_path);
|
||||
builder.monitoring_client(monitoring_config)?
|
||||
} else {
|
||||
builder
|
||||
};
|
||||
|
||||
let builder = builder
|
||||
.beacon_chain_builder(client_genesis, client_config.clone())
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user