How to use the @elastic/apm-rum-core.getInstrumentationFlags function in @elastic/apm-rum-core

To help you get started, we’ve selected a few @elastic/apm-rum-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / apm-agent-rum-js / packages / rum / src / apm-base.js View on Github external
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()