import { UiCounterMetricType } from '@kbn/analytics' ; import { UsageCollectionSetup } from 'src/plugins/usage_collection/public' ; export const UIM_APP_NAME = 'upgrade_assistant' ; export const UIM_ES_DEPRECATIONS_PAGE_LOAD = 'es_deprecations_page_load' ; export const UIM_KIBANA_DEPRECATIONS_PAGE_LOAD = 'kibana_deprecations_page_load' ; export const UIM_OVERVIEW_PAGE_LOAD = 'overview_page_load' ; export const UIM_ES_DEPRECATION_LOGS_PAGE_LOAD = 'es_deprecation_logs_page_load' ; export const UIM_REINDEX_OPEN_FLYOUT_CLICK = 'reindex_open_flyout_click' ; export const UIM_REINDEX_CLOSE_FLYOUT_CLICK = 'reindex_close_flyout_click' ; export const UIM_REINDEX_START_CLICK = 'reindex_start_click' ; export const UIM_REINDEX_STOP_CLICK = 'reindex_stop_click' ; export const UIM_BACKUP_DATA_CLOUD_CLICK = 'backup_data_cloud_click' ; export const UIM_BACKUP_DATA_ON_PREM_CLICK = 'backup_data_on_prem_click' ; export const UIM_RESET_LOGS_COUNTER_CLICK = 'reset_logs_counter_click' ; export const UIM_OBSERVABILITY_CLICK = 'observability_click' ; export const UIM_DISCOVER_CLICK = 'discover_click' ; export const UIM_ML_SNAPSHOT_UPGRADE_CLICK = 'ml_snapshot_upgrade_click' ; export const UIM_ML_SNAPSHOT_DELETE_CLICK = 'ml_snapshot_delete_click' ; export const UIM_INDEX_SETTINGS_DELETE_CLICK = 'index_settings_delete_click' ; export const UIM_KIBANA_QUICK_RESOLVE_CLICK = 'kibana_quick_resolve_click' ; export class UiMetricService { private usageCollection : UsageCollectionSetup | undefined ; public setup ( usageCollection ) { this . usageCollection = usageCollection ; } private track ( metricType , eventName ) { if ( ! this . usageCollection ) { return ; } return this . usageCollection . reportUiCounter ( UIM_APP_NAME , metricType , eventName ) ; } public trackUiMetric ( metricType , eventName ) { return this . track ( metricType , eventName ) ; } } export const uiMetricService = new UiMetricService ( ) ;