diff --git a/x-pack/plugins/observability_solution/apm/public/analytics/register_service_inventory_view_type_context.ts b/x-pack/plugins/observability_solution/apm/public/analytics/register_service_inventory_view_type_context.ts new file mode 100644 index 0000000000000..c26a84bb07b6c --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/analytics/register_service_inventory_view_type_context.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { AnalyticsServiceSetup } from '@kbn/core/public'; +import { BehaviorSubject } from 'rxjs'; +import { ServiceInventoryView } from '../context/entity_manager_context/entity_manager_context'; + +export const SERVICE_INVENTORY_STORAGE_KEY = 'apm.service.inventory.view'; + +export let serviceInventoryViewType$: BehaviorSubject<{ serviceInventoryViewType: string }>; + +export function registerServiceInventoryViewTypeContext(analytics: AnalyticsServiceSetup) { + const serviceInventoryLocalStorageValue = window.localStorage.getItem( + SERVICE_INVENTORY_STORAGE_KEY + ); + serviceInventoryViewType$ = new BehaviorSubject({ + serviceInventoryViewType: + serviceInventoryLocalStorageValue === null + ? ServiceInventoryView.classic + : JSON.parse(serviceInventoryLocalStorageValue), + }); + analytics.registerContextProvider({ + name: 'serviceInventoryViewType', + context$: serviceInventoryViewType$, + schema: { + serviceInventoryViewType: { + type: 'keyword', + _meta: { description: 'The APM service inventory view type' }, + }, + }, + }); +} diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/entities/logs/add_apm_callout.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/entities/logs/add_apm_callout.tsx index 77bec8cebb188..276ed47d68b67 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/entities/logs/add_apm_callout.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/entities/logs/add_apm_callout.tsx @@ -20,11 +20,21 @@ import { } from '@elastic/eui'; import { apmLight } from '@kbn/shared-svg'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; +import { useHistory } from 'react-router-dom'; +import { useKibana } from '../../../../context/kibana_context/use_kibana'; +import { ApmPluginStartDeps, ApmServices } from '../../../../plugin'; export function AddAPMCallOut() { - const { core } = useApmPluginContext(); const { euiTheme } = useEuiTheme(); + const { services } = useKibana(); + const history = useHistory(); + + function handleClick() { + services.telemetry.reportEntityInventoryAddData({ + view: 'add_apm_cta', + }); + history.push('/tutorial'); + } return ( @@ -68,10 +78,7 @@ export function AddAPMCallOut() {
- + {i18n.translate('xpack.apm.logsServiceOverview.callout.addApm', { defaultMessage: 'Add APM', })} diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/index.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/index.tsx index 004599c31357f..eea4168b73c92 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/index.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/index.tsx @@ -6,7 +6,7 @@ */ import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React from 'react'; +import React, { useEffect } from 'react'; import { v4 as uuidv4 } from 'uuid'; import { ApmDocumentType } from '../../../../../common/document_type'; import { APIReturnType } from '../../../../services/rest/create_call_apm_api'; @@ -27,6 +27,8 @@ import { ServiceListItem } from '../../../../../common/service_inventory'; import { usePreferredDataSourceAndBucketSize } from '../../../../hooks/use_preferred_data_source_and_bucket_size'; import { useProgressiveFetcher } from '../../../../hooks/use_progressive_fetcher'; import { NoEntitiesEmptyState } from './table/no_entities_empty_state'; +import { useKibana } from '../../../../context/kibana_context/use_kibana'; +import { ApmPluginStartDeps, ApmServices } from '../../../../plugin'; type MainStatisticsApiResponse = APIReturnType<'GET /internal/apm/entities/services'>; @@ -143,6 +145,7 @@ function useServicesEntitiesDetailedStatisticsFetcher({ export function MultiSignalInventory() { const [searchQuery, setSearchQuery] = React.useState(''); + const { services } = useKibana(); const { mainStatisticsData, mainStatisticsStatus } = useServicesEntitiesMainStatisticsFetcher(); const mainStatisticsFetch = useServicesEntitiesMainStatisticsFetcher(); @@ -163,6 +166,12 @@ export function MultiSignalInventory() { return callApmApi('GET /internal/apm/has_entities'); }, []); + useEffect(() => { + if (data?.hasData) { + services.telemetry.reportEntityInventoryPageState({ state: 'available' }); + } + }, [services.telemetry, data?.hasData]); + if (!data?.hasData && status === FETCH_STATUS.SUCCESS) { return ; } diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/get_service_columns.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/get_service_columns.tsx index 01350075c6bf6..251bc3771f60c 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/get_service_columns.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/get_service_columns.tsx @@ -46,13 +46,11 @@ type ServicesDetailedStatisticsAPIResponse = export function getServiceColumns({ query, breakpoints, - link, timeseriesDataLoading, timeseriesData, }: { query: TypeOf['query']; breakpoints: Breakpoints; - link: any; timeseriesDataLoading: boolean; timeseriesData?: ServicesDetailedStatisticsAPIResponse; }): Array> { diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/multi_signal_services_table.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/multi_signal_services_table.tsx index 12980917d82c0..eede4b2ef346c 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/multi_signal_services_table.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/multi_signal_services_table.tsx @@ -9,7 +9,6 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { omit } from 'lodash'; import React, { useMemo } from 'react'; import { useApmParams } from '../../../../../hooks/use_apm_params'; -import { useApmRouter } from '../../../../../hooks/use_apm_router'; import { useBreakpoints } from '../../../../../hooks/use_breakpoints'; import { FETCH_STATUS, isFailure, isPending } from '../../../../../hooks/use_fetcher'; import { APIReturnType } from '../../../../../services/rest/create_call_apm_api'; @@ -53,18 +52,16 @@ export function MultiSignalServicesTable({ }: Props) { const breakpoints = useBreakpoints(); const { query } = useApmParams('/services'); - const { link } = useApmRouter(); const serviceColumns = useMemo(() => { return getServiceColumns({ // removes pagination and sort instructions from the query so it won't be passed down to next route query: omit(query, 'page', 'pageSize', 'sortDirection', 'sortField'), breakpoints, - link, timeseriesDataLoading, timeseriesData, }); - }, [query, breakpoints, link, timeseriesDataLoading, timeseriesData]); + }, [query, breakpoints, timeseriesDataLoading, timeseriesData]); return ( diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/no_entities_empty_state.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/no_entities_empty_state.tsx index 7a04cea29dc16..e3472aecd0f61 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/no_entities_empty_state.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/multi_signal_inventory/table/no_entities_empty_state.tsx @@ -5,23 +5,27 @@ * 2.0. */ -import React from 'react'; -import { i18n } from '@kbn/i18n'; import { EuiCallOut, - EuiLink, EuiEmptyPrompt, - EuiImage, + EuiFlexGroup, + EuiFlexItem, EuiHorizontalRule, + EuiImage, + EuiLink, EuiText, EuiTextColor, - EuiFlexGroup, - EuiFlexItem, } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; import { dashboardsLight } from '@kbn/shared-svg'; +import useEffectOnce from 'react-use/lib/useEffectOnce'; import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context'; +import { useKibana } from '../../../../../context/kibana_context/use_kibana'; import { useLocalStorage } from '../../../../../hooks/use_local_storage'; +import { ApmPluginStartDeps, ApmServices } from '../../../../../plugin'; +import { EntityInventoryAddDataParams } from '../../../../../services/telemetry'; import { AddApmAgent, AssociateServiceLogs, @@ -30,12 +34,24 @@ import { export function NoEntitiesEmptyState() { const { core } = useApmPluginContext(); + const { services } = useKibana(); const { basePath } = core.http; const [userHasDismissedCallout, setUserHasDismissedCallout] = useLocalStorage( 'apm.uiNewExperienceCallout', false ); + useEffectOnce(() => { + services.telemetry.reportEntityInventoryPageState({ state: 'empty_state' }); + }); + + function reportButtonClick(journey: EntityInventoryAddDataParams['journey']) { + services.telemetry.reportEntityInventoryAddData({ + view: 'empty_state', + journey, + }); + } + return ( @@ -76,9 +92,23 @@ export function NoEntitiesEmptyState() { actions={ - - - + { + reportButtonClick('add_apm_agent'); + }} + /> + { + reportButtonClick('associate_existing_service_logs'); + }} + /> + { + reportButtonClick('collect_new_service_logs'); + }} + /> {!userHasDismissedCallout && ( diff --git a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/apm_header_action_menu/add_data_context_menu.tsx b/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/apm_header_action_menu/add_data_context_menu.tsx index 32019f60aa09f..f7d8110d8aa79 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/apm_header_action_menu/add_data_context_menu.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/apm_header_action_menu/add_data_context_menu.tsx @@ -14,6 +14,9 @@ import { import { i18n } from '@kbn/i18n'; import React, { useState } from 'react'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; +import { useKibana } from '../../../../context/kibana_context/use_kibana'; +import { ApmPluginStartDeps, ApmServices } from '../../../../plugin'; +import { EntityInventoryAddDataParams } from '../../../../services/telemetry'; import { associateServiceLogs, collectServiceLogs, @@ -26,6 +29,7 @@ const addData = i18n.translate('xpack.apm.addDataContextMenu.link', { export function AddDataContextMenu() { const [popoverOpen, setPopoverOpen] = useState(false); + const { services } = useKibana(); const { core: { http: { basePath }, @@ -44,6 +48,13 @@ export function AddDataContextMenu() { ); + function reportButtonClick(journey: EntityInventoryAddDataParams['journey']) { + services.telemetry.reportEntityInventoryAddData({ + view: 'add_data_button', + journey, + }); + } + const panels: EuiContextMenuPanelDescriptor[] = [ { id: 0, @@ -53,17 +64,28 @@ export function AddDataContextMenu() { name: associateServiceLogs.name, href: associateServiceLogs.link, 'data-test-subj': 'apmAddDataAssociateServiceLogs', + target: '_blank', + onClick: () => { + reportButtonClick('associate_existing_service_logs'); + }, }, { name: collectServiceLogs.name, href: basePath.prepend(collectServiceLogs.link), 'data-test-subj': 'apmAddDataCollectServiceLogs', + target: '_blank', + onClick: () => { + reportButtonClick('collect_new_service_logs'); + }, }, { name: addApmAgent.name, href: basePath.prepend(addApmAgent.link), icon: 'plusInCircle', 'data-test-subj': 'apmAddDataApmAgent', + onClick: () => { + reportButtonClick('add_apm_agent'); + }, }, ], }, diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/add_data_buttons/buttons.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/add_data_buttons/buttons.tsx index e02934897b69f..6b37614261174 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/shared/add_data_buttons/buttons.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/add_data_buttons/buttons.tsx @@ -30,40 +30,43 @@ export const collectServiceLogs = { link: '/app/observabilityOnboarding/?category=logs', }; -export function AddApmAgent({ basePath }: { basePath: IBasePath }) { +export function AddApmAgent({ basePath, onClick }: { basePath: IBasePath; onClick?: () => void }) { + function handleClick() { + window.open(basePath.prepend(addApmAgent.link), '_blank'); + onClick?.(); + } return ( - + {addApmAgent.name} ); } -export function AssociateServiceLogs() { +export function AssociateServiceLogs({ onClick }: { onClick?: () => void }) { + function handleClick() { + window.open(associateServiceLogs.link, '_blank'); + onClick?.(); + } return ( - + {associateServiceLogs.name} ); } -export function CollectServiceLogs({ basePath }: { basePath: IBasePath }) { +export function CollectServiceLogs({ + basePath, + onClick, +}: { + basePath: IBasePath; + onClick?: () => void; +}) { + function handleClick() { + window.open(basePath.prepend(collectServiceLogs.link), '_blank'); + onClick?.(); + } return ( - + {collectServiceLogs.name} ); diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/not_available_apm_metrics.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/not_available_apm_metrics.tsx index 03253fa4282d4..4576fde756828 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/shared/not_available_apm_metrics.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/not_available_apm_metrics.tsx @@ -8,11 +8,21 @@ import React from 'react'; import { EuiButton } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { useHistory } from 'react-router-dom'; import { PopoverBadge } from './popover_badge'; -import { useApmPluginContext } from '../../context/apm_plugin/use_apm_plugin_context'; +import { useKibana } from '../../context/kibana_context/use_kibana'; +import { ApmPluginStartDeps, ApmServices } from '../../plugin'; -export const NotAvailableApmMetrics = () => { - const { core } = useApmPluginContext(); +export function NotAvailableApmMetrics() { + const { services } = useKibana(); + const history = useHistory(); + + function handleClick() { + services.telemetry.reportEntityInventoryAddData({ + view: 'add_apm_n/a', + }); + history.push('/tutorial'); + } return ( { 'Understand key metrics like transaction latency, throughput and error rate by instrumenting your service with APM.', })} footer={ - + {i18n.translate('xpack.apm.servicesTable.notAvailableApmMetrics.footer', { defaultMessage: 'Add APM', })} @@ -34,4 +41,4 @@ export const NotAvailableApmMetrics = () => { } /> ); -}; +} diff --git a/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx b/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx index 14ff0fecc8878..f68ca17bb8dad 100644 --- a/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx +++ b/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx @@ -9,6 +9,12 @@ import { entityCentricExperience } from '@kbn/observability-plugin/common'; import { ENTITY_FETCH_STATUS, useEntityManager } from '../../hooks/use_entity_manager'; import { useLocalStorage } from '../../hooks/use_local_storage'; import { useApmPluginContext } from '../apm_plugin/use_apm_plugin_context'; +import { + SERVICE_INVENTORY_STORAGE_KEY, + serviceInventoryViewType$, +} from '../../analytics/register_service_inventory_view_type_context'; +import { useKibana } from '../kibana_context/use_kibana'; +import { ApmPluginStartDeps, ApmServices } from '../../plugin'; export interface EntityManagerEnablementContextValue { isEntityManagerEnabled: boolean; @@ -25,8 +31,6 @@ export enum ServiceInventoryView { entity = 'entity', } -export const serviceInventoryStorageKey = 'apm.service.inventory.view'; - export const EntityManagerEnablementContext = createContext( {} as EntityManagerEnablementContextValue ); @@ -37,10 +41,11 @@ export function EntityManagerEnablementContextProvider({ children: React.ReactChild; }) { const { core } = useApmPluginContext(); + const { services } = useKibana(); const { isEnabled: isEntityManagerEnabled, status, refetch } = useEntityManager(); const [serviceInventoryViewLocalStorageSetting, setServiceInventoryViewLocalStorageSetting] = - useLocalStorage(serviceInventoryStorageKey, ServiceInventoryView.classic); + useLocalStorage(SERVICE_INVENTORY_STORAGE_KEY, ServiceInventoryView.classic); const isEntityCentricExperienceSettingEnabled = core.uiSettings.get( entityCentricExperience, @@ -60,7 +65,14 @@ export function EntityManagerEnablementContextProvider({ isEnablementPending: status === ENTITY_FETCH_STATUS.LOADING, refetch, serviceInventoryViewLocalStorageSetting, - setServiceInventoryViewLocalStorageSetting, + setServiceInventoryViewLocalStorageSetting: (nextView) => { + setServiceInventoryViewLocalStorageSetting(nextView); + // Updates the telemetry context variable every time the user switches views + serviceInventoryViewType$.next({ serviceInventoryViewType: nextView }); + services.telemetry.reportEntityExperienceStatusChange({ + status: nextView === ServiceInventoryView.entity ? 'enabled' : 'disabled', + }); + }, isEntityCentricExperienceViewEnabled, }} > diff --git a/x-pack/plugins/observability_solution/apm/public/plugin.ts b/x-pack/plugins/observability_solution/apm/public/plugin.ts index a07c8c5f4c206..c45d8f7abba64 100644 --- a/x-pack/plugins/observability_solution/apm/public/plugin.ts +++ b/x-pack/plugins/observability_solution/apm/public/plugin.ts @@ -82,6 +82,7 @@ import { getLazyAPMPolicyEditExtension } from './components/fleet_integration/la import { featureCatalogueEntry } from './feature_catalogue_entry'; import { APMServiceDetailLocator } from './locator/service_detail_locator'; import { ITelemetryClient, TelemetryService } from './services/telemetry'; +import { registerServiceInventoryViewTypeContext } from './analytics/register_service_inventory_view_type_context'; export type ApmPluginSetup = ReturnType; export type ApmPluginStart = void; @@ -273,6 +274,7 @@ export class ApmPlugin implements Plugin { }; this.telemetry.setup({ analytics: core.analytics }); + registerServiceInventoryViewTypeContext(core.analytics); // Registers a status check callback for the tutorial to call and verify if the APM integration is installed on fleet. pluginSetupDeps.home?.tutorials.registerCustomStatusCheck( diff --git a/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_client.ts b/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_client.ts index ecbe95355e241..4b1d645fab78c 100644 --- a/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_client.ts +++ b/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_client.ts @@ -6,7 +6,14 @@ */ import { AnalyticsServiceSetup } from '@kbn/core-analytics-server'; -import { TelemetryEventTypes, ITelemetryClient, SearchQuerySubmittedParams } from './types'; +import { + ITelemetryClient, + SearchQuerySubmittedParams, + EntityExperienceStatusParams, + TelemetryEventTypes, + EntityInventoryPageStateParams, + EntityInventoryAddDataParams, +} from './types'; export class TelemetryClient implements ITelemetryClient { constructor(private analytics: AnalyticsServiceSetup) {} @@ -22,4 +29,16 @@ export class TelemetryClient implements ITelemetryClient { action, }); }; + + public reportEntityExperienceStatusChange = (params: EntityExperienceStatusParams) => { + this.analytics.reportEvent(TelemetryEventTypes.ENTITY_EXPERIENCE_STATUS, params); + }; + + public reportEntityInventoryPageState = (params: EntityInventoryPageStateParams) => { + this.analytics.reportEvent(TelemetryEventTypes.ENTITY_INVENTORY_PAGE_STATE, params); + }; + + public reportEntityInventoryAddData = (params: EntityInventoryAddDataParams) => { + this.analytics.reportEvent(TelemetryEventTypes.ENTITY_INVENTORY_ADD_DATA, params); + }; } diff --git a/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_events.ts b/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_events.ts index e4f4878342133..9cc3cc772a621 100644 --- a/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_events.ts +++ b/x-pack/plugins/observability_solution/apm/public/services/telemetry/telemetry_events.ts @@ -33,4 +33,54 @@ const searchQuerySubmittedEventType: TelemetryEvent = { }, }; -export const apmTelemetryEventBasedTypes = [searchQuerySubmittedEventType]; +const entityExperienceStatusEventType: TelemetryEvent = { + eventType: TelemetryEventTypes.ENTITY_EXPERIENCE_STATUS, + schema: { + status: { + type: 'keyword', + _meta: { + description: 'The status of the Entity experience (Enabled or Disabled)', + }, + }, + }, +}; + +const entityInventoryPageStateEventType: TelemetryEvent = { + eventType: TelemetryEventTypes.ENTITY_INVENTORY_PAGE_STATE, + schema: { + state: { + type: 'keyword', + _meta: { + description: 'The current entity inventory page state (empty_state or available)', + }, + }, + }, +}; + +const entityInventoryAddDataEventType: TelemetryEvent = { + eventType: TelemetryEventTypes.ENTITY_INVENTORY_ADD_DATA, + schema: { + view: { + type: 'keyword', + _meta: { + description: + 'Where the action was initiated (empty_state or add_data_button or add_apm_cta)', + }, + }, + journey: { + type: 'keyword', + _meta: { + optional: true, + description: + 'Which action was performed (add_apm_agent or associate_existing_service_logs or collect_new_service_logs)', + }, + }, + }, +}; + +export const apmTelemetryEventBasedTypes = [ + searchQuerySubmittedEventType, + entityExperienceStatusEventType, + entityInventoryPageStateEventType, + entityInventoryAddDataEventType, +]; diff --git a/x-pack/plugins/observability_solution/apm/public/services/telemetry/types.ts b/x-pack/plugins/observability_solution/apm/public/services/telemetry/types.ts index 5592974de2d40..173831bbf0d7c 100644 --- a/x-pack/plugins/observability_solution/apm/public/services/telemetry/types.ts +++ b/x-pack/plugins/observability_solution/apm/public/services/telemetry/types.ts @@ -21,17 +21,40 @@ export interface SearchQuerySubmittedParams { action: SearchQueryActions; } -export type TelemetryEventParams = SearchQuerySubmittedParams; +export interface EntityExperienceStatusParams { + status: 'enabled' | 'disabled'; +} + +export interface EntityInventoryPageStateParams { + state: 'empty_state' | 'available'; +} + +export interface EntityInventoryAddDataParams { + view: 'empty_state' | 'add_data_button' | 'add_apm_cta' | 'add_apm_n/a'; + journey?: 'add_apm_agent' | 'associate_existing_service_logs' | 'collect_new_service_logs'; +} + +export type TelemetryEventParams = + | SearchQuerySubmittedParams + | EntityExperienceStatusParams + | EntityInventoryPageStateParams + | EntityInventoryAddDataParams; export interface ITelemetryClient { reportSearchQuerySubmitted(params: SearchQuerySubmittedParams): void; + reportEntityExperienceStatusChange(params: EntityExperienceStatusParams): void; + reportEntityInventoryPageState(params: EntityInventoryPageStateParams): void; + reportEntityInventoryAddData(params: EntityInventoryAddDataParams): void; } export enum TelemetryEventTypes { SEARCH_QUERY_SUBMITTED = 'Search Query Submitted', + ENTITY_EXPERIENCE_STATUS = 'entity_experience_status', + ENTITY_INVENTORY_PAGE_STATE = 'entity_inventory_page_state', + ENTITY_INVENTORY_ADD_DATA = 'entity_inventory_add_data', } export interface TelemetryEvent { - eventType: TelemetryEventTypes.SEARCH_QUERY_SUBMITTED; - schema: RootSchema; + eventType: TelemetryEventTypes; + schema: RootSchema; }