import config , { AgentConfig , finalizeConfig } from './config/AgentConfig' ; import GrpcProtocol from './agent/protocol/grpc/GrpcProtocol' ; import { createLogger } from './logging' ; import PluginInstaller from './core/PluginInstaller' ; const logger = createLogger ( __filename ) ; class Agent { private started = false ; start ( options = { } ) { if ( process . env . SW_DISABLE === 'true' ) { logger . info ( 'SkyWalking agent is disabled by `SW_DISABLE=true`' ) ; return ; } if ( this . started ) { logger . warn ( 'SkyWalking agent started more than once, subsequent options to start ignored.' ) ; return ; } Object . assign ( config , options ) ; finalizeConfig ( config ) ; logger . debug ( 'Starting SkyWalking agent' ) ; this . started = true ; new PluginInstaller ( ) . install ( ) ; new GrpcProtocol ( ) . heartbeat ( ) . report ( ) ; } } export default new Agent ( ) ; export { default as ContextManager } from './trace/context/ContextManager' ; export { default as AzureHttpTriggerPlugin } from './azure/AzureHttpTriggerPlugin' ;