import { UsageCollectionSetup } from 'src/plugins/usage_collection/server' ; interface Config { isCloudEnabled : boolean ; } interface CloudUsage { isCloudEnabled : boolean ; } export function createCloudUsageCollector ( usageCollection , config ) { const { isCloudEnabled } = config ; return usageCollection . makeUsageCollector < CloudUsage > ( { type : 'cloud' , isReady : ( ) => true , schema : { isCloudEnabled : { type : 'boolean' } , } , fetch : ( ) => { return { isCloudEnabled , } ; } , } ) ; } export function registerCloudUsageCollector ( usageCollection , config ) { if ( ! usageCollection ) { return ; } const collector = createCloudUsageCollector ( usageCollection , config ) ; usageCollection . registerCollector ( collector ) ; }