@@ -14,6 +14,7 @@ use environment::RuntimeContext;
1414use eth1:: { Config as Eth1Config , Service as Eth1Service } ;
1515use eth2_libp2p:: NetworkGlobals ;
1616use genesis:: { interop_genesis_state, Eth1GenesisService } ;
17+ use monitoring_api:: { MonitoringHttpClient , ProcessType } ;
1718use network:: { NetworkConfig , NetworkMessage , NetworkService } ;
1819use slasher:: Slasher ;
1920use slasher_service:: SlasherService ;
@@ -374,6 +375,22 @@ where
374375 SlasherService :: new ( beacon_chain, network_send) . run ( & context. executor )
375376 }
376377
378+ /// Start the explorer client which periodically sends beacon
379+ /// and system metrics to the configured endpoint.
380+ pub fn monitoring_client ( self , config : & monitoring_api:: Config ) -> Result < Self , String > {
381+ let context = self
382+ . runtime_context
383+ . as_ref ( )
384+ . ok_or ( "monitoring_client requires a runtime_context" ) ?
385+ . service_context ( "monitoring_client" . into ( ) ) ;
386+ let monitoring_client = MonitoringHttpClient :: new ( config, context. log ( ) . clone ( ) ) ?;
387+ monitoring_client. auto_update (
388+ context. executor ,
389+ vec ! [ ProcessType :: BeaconNode , ProcessType :: System ] ,
390+ ) ;
391+ Ok ( self )
392+ }
393+
377394 /// Immediately starts the service that periodically logs information each slot.
378395 pub fn notifier ( self ) -> Result < Self , String > {
379396 let context = self
0 commit comments