MM-57882 Add metric for the time it takes to open the Threads list (#26983)

* MM-57882 Add metric for the time it takes to open the Threads list

* Clean up mark because the starting mark may be missing

* Pass global threads load duration to Prometheus

* Update mocks
Этот коммит содержится в:
Harrison Healey
2024-05-21 18:04:12 -04:00
коммит произвёл GitHub
родитель 45e3b54b60
Коммит 441f5657c8
8 изменённых файлов: 59 добавлений и 18 удалений

Просмотреть файл

@@ -31,6 +31,7 @@ import LoadingScreen from 'components/loading_screen';
import NoResultsIndicator from 'components/no_results_indicator';
import {PreviousViewedTypes} from 'utils/constants';
import {Mark, Measure, measureAndReport} from 'utils/performance_telemetry';
import type {GlobalState} from 'types/store/index';
import {LhsItemType, LhsPage} from 'types/store/lhs';
@@ -117,6 +118,13 @@ const GlobalThreads = () => {
});
}, [filter, threadIds, unreadThreadIds]);
useEffect(() => {
if (!isLoading) {
measureAndReport(Measure.GlobalThreadsLoad, Mark.GlobalThreadsLinkClicked, undefined, true);
performance.clearMarks(Mark.GlobalThreadsLinkClicked);
}
}, [isLoading]);
useEffect(() => {
if (!selectedThread && !selectedPost && !isLoading) {
clear();

Просмотреть файл

@@ -35,6 +35,7 @@ import Constants, {
RHSStates,
} from 'utils/constants';
import {t} from 'utils/i18n';
import {Mark} from 'utils/performance_telemetry';
import type {GlobalState} from 'types/store';
@@ -67,10 +68,15 @@ const GlobalThreadsLink = () => {
const showTutorialTrigger = isFeatureEnabled && crtTutorialTrigger === Constants.CrtTutorialTriggerSteps.START && !appHaveOpenModal && Boolean(threadsCount) && threadsCount.total >= 1;
const openThreads = useCallback((e) => {
e.stopPropagation();
trackEvent('crt', 'go_to_global_threads');
performance.mark(Mark.GlobalThreadsLinkClicked);
if (showTutorialTrigger) {
dispatch(openModal({modalId: ModalIdentifiers.COLLAPSED_REPLY_THREADS_MODAL, dialogType: CollapsedReplyThreadsModal, dialogProps: {}}));
}
if (rhsOpen && rhsState === RHSStates.EDIT_HISTORY) {
dispatch(closeRightHandSide());
}

Просмотреть файл

@@ -3,6 +3,7 @@
export const enum Mark {
ChannelLinkClicked = 'SidebarChannelLink#click',
GlobalThreadsLinkClicked = 'GlobalThreadsLink#click',
PostListLoaded = 'PostList#component',
PostSelected = 'PostList#postSelected',
TeamLinkClicked = 'TeamLink#click',
@@ -10,6 +11,7 @@ export const enum Mark {
export const enum Measure {
ChannelSwitch = 'channel_switch',
GlobalThreadsLoad = 'global_threads_load',
RhsLoad = 'rhs_load',
TeamSwitch = 'team_switch',
}