Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.isEnabled() && !this._initialized) {
this._initialized = true
const configService = this.serviceFactory.getService('ConfigService')
/**
* Set Agent version to be sent as part of metadata to the APM Server
*/
configService.setVersion('4.6.0')
this.config(config)
const loggingService = this.serviceFactory.getService('LoggingService')
/**
* Deactive agent when the active config flag is set to false
*/
if (configService.isActive()) {
this.serviceFactory.init()
const flags = getInstrumentationFlags(
configService.get('instrument'),
configService.get('disableInstrumentations')
)
const performanceMonitoring = this.serviceFactory.getService(
'PerformanceMonitoring'
)
performanceMonitoring.init(flags)
if (flags[ERROR]) {
const errorLogging = this.serviceFactory.getService('ErrorLogging')
errorLogging.registerListeners()
}
const sendPageLoad = () =>
flags[PAGE_LOAD] && this._sendPageLoadMetrics()