import { EndPointService } from './service/EndPointService' ; import { ActuatorRestService } from './service/ActuatorRestService' ; export class MetricsActuatorManager { endPointService ; actuatorRestService ; actuatorConfig = { endPoint : { } } ; logger ; constructor ( options ) { this . logger = options . logger ; this . actuatorConfig = options . config ; this . initEndPoints ( ) ; this . initRestService ( ) ; } initEndPoints ( ) { this . endPointService = new EndPointService ( ) ; this . endPointService . setLogger ( this . logger ) ; let instances = [ ] ; const endPoints = this . actuatorConfig [ 'endPoint' ] ; for ( let endPointName in endPoints ) { if ( endPoints [ endPointName ] . enabled ) { let ins = new endPoints [ endPointName ] . target ( ) ; if ( endPoints [ endPointName ] . initConfig ) { ins . setConfig ( endPoints [ endPointName ] . initConfig ) ; } instances . push ( ins ) ; } } this . endPointService . setEndPointIns ( instances ) ; this . endPointService . start ( ) ; } initRestService ( ) { this . actuatorRestService = new ActuatorRestService ( this . endPointService ) ; this . actuatorRestService . start ( this . actuatorConfig ) ; } destory ( ) { this . actuatorRestService . stop ( ) ; this . endPointService . stop ( ) ; } }