- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8.5k
Closed
Labels
Description
On Cloud we want to register which Gold+ features are being used. We already do this for the Service Map:
Register:
kibana/x-pack/plugins/apm/server/plugin.ts
Lines 129 to 132 in 6c3b900
| plugins.licensing.featureUsage.register( | |
| APM_SERVICE_MAPS_FEATURE_NAME, | |
| APM_SERVICE_MAPS_LICENSE_TYPE | |
| ); | 
Notify:
| context.licensing.featureUsage.notifyUsage(APM_SERVICE_MAPS_FEATURE_NAME); | 
There are two steps required: featureUsage.register to register the feature (happens during setup lifecycle), and  featureUsage.notifyUsage which should be called whenever the feature is actively used.
public async setup(core: CoreSetup, { licensing }: PluginSetupDependencies) {
    licensing.featureUsage.register('Foo feature', 'gold');
  }
  public async start(core: CoreSetup, { licensing }: PluginStartDependencies) {
    // elsewhere where license checking is done prior to a feature being consumed
      if (check.isValid) {
        licensing.featureUsage.notifyUsage('Foo feature');
      }    
    }
  }Gold+ features in APM which are tracked:
- Service Maps
- Machine learning (notify when a new job is added)
- Custom Links (notify when a new link is added)