diff --git a/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx b/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
index fa4a723f1747..98b94df9937f 100644
--- a/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
+++ b/frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
@@ -24,6 +24,10 @@ import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import ROUTES from 'constants/routes';
import ExportPanelContainer from 'container/ExportPanel/ExportPanelContainer';
+import {
+ MetricsExplorerEventKeys,
+ MetricsExplorerEvents,
+} from 'container/MetricsExplorer/events';
import { useOptionsMenu } from 'container/OptionsMenu';
import {
defaultLogsSelectedColumns,
@@ -140,7 +144,9 @@ function ExplorerOptions({
panelType,
});
} else if (isMetricsExplorer) {
- logEvent('Metrics Explorer: Save view clicked', {
+ logEvent(MetricsExplorerEvents.SaveViewClicked, {
+ [MetricsExplorerEventKeys.Tab]: 'explorer',
+ [MetricsExplorerEventKeys.OneChartPerQueryEnabled]: isOneChartPerQuery,
panelType,
});
}
@@ -184,8 +190,10 @@ function ExplorerOptions({
panelType,
});
} else if (isMetricsExplorer) {
- logEvent('Metrics Explorer: Create alert', {
+ logEvent(MetricsExplorerEvents.AddToAlertClicked, {
panelType,
+ [MetricsExplorerEventKeys.Tab]: 'explorer',
+ [MetricsExplorerEventKeys.OneChartPerQueryEnabled]: isOneChartPerQuery,
});
}
@@ -218,11 +226,14 @@ function ExplorerOptions({
panelType,
});
} else if (isMetricsExplorer) {
- logEvent('Metrics Explorer: Add to dashboard clicked', {
+ logEvent(MetricsExplorerEvents.AddToDashboardClicked, {
panelType,
+ [MetricsExplorerEventKeys.Tab]: 'explorer',
+ [MetricsExplorerEventKeys.OneChartPerQueryEnabled]: isOneChartPerQuery,
});
}
setIsExport(true);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLogsExplorer, isMetricsExplorer, panelType, setIsExport, sourcepage]);
const {
diff --git a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
index 1f04fcd9c6d8..d20b18dc0ee5 100644
--- a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
+++ b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
@@ -2,6 +2,7 @@ import './Explorer.styles.scss';
import * as Sentry from '@sentry/react';
import { Switch } from 'antd';
+import logEvent from 'api/common/logEvent';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import ExplorerOptionWrapper from 'container/ExplorerOptions/ExplorerOptionWrapper';
import RightToolbarActions from 'container/QueryBuilder/components/ToolbarActions/RightToolbarActions';
@@ -10,7 +11,7 @@ import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl';
import { useSafeNavigate } from 'hooks/useSafeNavigate';
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
-import { useCallback, useMemo, useState } from 'react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
import { useSearchParams } from 'react-router-dom-v5-compat';
import { Dashboard } from 'types/api/dashboard/getAll';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
@@ -18,6 +19,7 @@ import { DataSource } from 'types/common/queryBuilder';
import { generateExportToDashboardLink } from 'utils/dashboard/generateExportToDashboardLink';
import { v4 as uuid } from 'uuid';
+import { MetricsExplorerEventKeys, MetricsExplorerEvents } from '../events';
import QuerySection from './QuerySection';
import TimeSeries from './TimeSeries';
import { ExplorerTabs } from './types';
@@ -93,6 +95,12 @@ function Explorer(): JSX.Element {
[stagedQuery],
);
+ useEffect(() => {
+ logEvent(MetricsExplorerEvents.TabChanged, {
+ [MetricsExplorerEventKeys.Tab]: 'explorer',
+ });
+ }, []);
+
return (