import { CollectorSet , UsageCollectorOptions , } from '../../plugins/usage_collection/server/collector' ; import { loggerMock } from '../../core/server/logging/logger.mock' ; const collectorSet = new CollectorSet ( { logger : loggerMock . create ( ) , maximumWaitTimeForAllCollectorsInS : 0 , } ) ; interface Usage { locale : string ; } function createCollector ( ) { return { type : 'from_fn_collector' , isReady : ( ) => true , fetch ( ) { return { locale : 'en' , } ; } , schema : { locale : { type : 'keyword' , } , } , } ; } export function defineCollectorFromVariable ( ) { const fromVarCollector = { type : 'from_variable_collector' , isReady : ( ) => true , fetch ( ) { return { locale : 'en' , } ; } , schema : { locale : { type : 'keyword' , } , } , } ; collectorSet . makeUsageCollector < Usage > ( fromVarCollector ) ; } export function defineCollectorFromFn ( ) { const fromFnCollector = createCollector ( ) ; collectorSet . makeUsageCollector < Usage > ( fromFnCollector ) ; }