import { CollectorSet } from '../../plugins/usage_collection/server/collector' ; import { loggerMock } from '../../core/server/logging/logger.mock' ; const { makeUsageCollector } = new CollectorSet ( { logger : loggerMock . create ( ) , maximumWaitTimeForAllCollectorsInS : 0 , } ) ; enum TELEMETRY_LAYER_TYPE { ES_DOCS = 'es_docs' , ES_TOP_HITS = 'es_top_hits' } interface ClusterCountStats { min : number ; max : number ; total : number ; avg : number ; } type TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER = { [ key in TELEMETRY_LAYER_TYPE ] ? : ClusterCountStats ; } ; interface Usage { layerTypes : TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER ; } export const myCollector = makeUsageCollector < Usage > ( { type : 'my_enum_collector' , isReady : ( ) => true , fetch ( ) { return { layerTypes : { es_docs : { avg : 1 , max : 2 , min : 0 , total : 2 , } , } , } ; } , schema : { layerTypes : { es_top_hits : { min : { type : 'long' , _meta : { description : 'min number of es top hits layers per map' } } , max : { type : 'long' , _meta : { description : 'max number of es top hits layers per map' } } , avg : { type : 'float' , _meta : { description : 'avg number of es top hits layers per map' } , } , total : { type : 'long' , _meta : { description : 'total number of es top hits layers in cluster' } , } , } , es_docs : { min : { type : 'long' , _meta : { description : 'min number of es document layers per map' } } , max : { type : 'long' , _meta : { description : 'max number of es document layers per map' } } , avg : { type : 'float' , _meta : { description : 'avg number of es document layers per map' } , } , total : { type : 'long' , _meta : { description : 'total number of es document layers in cluster' } , } , } , } , } , } ) ;