chore: fix metrics explorer events (#8411)

This commit is contained in:
Amlan Kumar Nandy 2025-07-07 23:34:17 +07:00 committed by GitHub
parent b1864ee328
commit 26d55875f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 10 deletions

View File

@ -75,15 +75,14 @@ function Summary(): JSX.Element {
useEffect(() => {
logEvent(MetricsExplorerEvents.TabChanged, {
[MetricsExplorerEventKeys.Tab]: 'summary',
[MetricsExplorerEventKeys.TimeRange]: {
startTime: convertNanoToMilliseconds(minTime),
endTime: convertNanoToMilliseconds(maxTime),
},
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
logEvent(MetricsExplorerEvents.TimeUpdated, {
[MetricsExplorerEventKeys.Tab]: 'summary',
});
}, [maxTime, minTime]);
// This is used to avoid the filters from being serialized with the id
const queryFiltersWithoutId = useMemo(() => {
const filtersWithoutId = {
@ -168,9 +167,11 @@ function Summary(): JSX.Element {
[SUMMARY_FILTERS_KEY]: JSON.stringify(value),
});
setCurrentPage(1);
logEvent(MetricsExplorerEvents.FilterApplied, {
[MetricsExplorerEventKeys.Tab]: 'summary',
});
if (value.items.length > 0) {
logEvent(MetricsExplorerEvents.FilterApplied, {
[MetricsExplorerEventKeys.Tab]: 'summary',
});
}
},
[setSearchParams, searchParams],
);

View File

@ -6,7 +6,6 @@ export enum MetricsExplorerEvents {
ModalOpened = 'Metrics Explorer: Modal opened',
MetricClicked = 'Metrics Explorer: Metric clicked',
FilterApplied = 'Metrics Explorer: Filter applied',
TimeUpdated = 'Metrics Explorer: Time updated',
TreemapViewChanged = 'Metrics Explorer: Treemap view changed',
PageNumberChanged = 'Metrics Explorer: Page number changed',
PageSizeChanged = 'Metrics Explorer: Page size changed',
@ -48,4 +47,5 @@ export enum MetricsExplorerEventKeys {
YAxisUnit = 'yAxisUnit',
ViewName = 'viewName',
Filters = 'filters',
TimeRange = 'timeRange',
}