import { METRIC_TYPE } from '@kbn/analytics' ; import { UsageCollectionSetup } from '../../../../../../../src/plugins/usage_collection/public' ; export class UiMetricService { private usageCollection : UsageCollectionSetup | undefined ; constructor ( private appName ) { } public setup ( usageCollection ) { this . usageCollection = usageCollection ; } private track ( name ) { if ( ! this . usageCollection ) { return ; } this . usageCollection . reportUiCounter ( this . appName , METRIC_TYPE . COUNT , name ) ; } public trackUiMetric ( eventName ) { return this . track ( eventName ) ; } }