import { MetricsInjectionBridge } from './util/MetricsInjectionBridge' ; const debug = require ( 'debug' ) ( 'pandora:metrics:service' ) ; import actuatorConfig from './conf/default' ; import { MetricsActuatorManager } from './MetricsActuatorManager' ; import extend = require ( 'extend' ) ; import { ActuatorServer } from './domain' ; export class MetricsActuatorServer implements ActuatorServer { logger ; metricsManager ; actuatorManager ; constructor ( options ) { this . logger = options . logger ; debug ( 'init metrics manager' ) ; this . metricsManager = options . metricsManager ; this . metricsManager . setLogger ( this . logger ) ; MetricsInjectionBridge . setMetricsManager ( this . metricsManager ) ; debug ( 'init actuator manager' ) ; this . actuatorManager = new MetricsActuatorManager ( { logger : this . logger , config : extend ( true , { } , actuatorConfig , options . config || { } ) , } ) ; } getMetricsManager ( ) { return this . metricsManager ; } getEndPointService ( ) { return this . actuatorManager . endPointService ; } registerEndPoint ( endPoint ) { this . getEndPointService ( ) . register ( endPoint ) ; } stop ( ) { this . metricsManager . setEnabled ( false ) ; } restart ( ) { this . metricsManager . setEnabled ( true ) ; } destroy ( ) { this . metricsManager . destory ( ) ; this . actuatorManager . destory ( ) ; } }