DashboardScene: Emit meta analytic view event (#89094)

* DashboardScene: Emit view event

* check fix
This commit is contained in:
Dominik Prokop 2024-06-17 09:14:27 +02:00 committed by GitHub
parent b9812a0784
commit ae80ed02e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { default as localStorageStore } from 'app/core/store';
import { startMeasure, stopMeasure } from 'app/core/utils/metrics';
import { dashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv';
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
import { emitDashboardViewEvent } from 'app/features/dashboard/state/analyticsProcessor';
import {
DASHBOARD_FROM_LS_KEY,
removeDashboardToFetchFromLocalStorage,
@ -185,6 +186,15 @@ export class DashboardScenePageStateManager extends StateManagerBase<DashboardSc
this.setState({ dashboard: dashboard, isLoading: false });
const measure = stopMeasure(LOAD_SCENE_MEASUREMENT);
trackDashboardSceneLoaded(dashboard, measure?.duration);
if (options.route !== DashboardRoutes.New) {
emitDashboardViewEvent({
meta: dashboard.state.meta,
uid: dashboard.state.uid,
title: dashboard.state.title,
id: dashboard.state.id,
});
}
} catch (err) {
this.setState({ isLoading: false, loadError: String(err) });
}

View File

@ -2,7 +2,7 @@ import { reportMetaAnalytics, MetaAnalyticsEventName, DashboardViewEventPayload
import { DashboardModel } from './DashboardModel';
export function emitDashboardViewEvent(dashboard: DashboardModel) {
export function emitDashboardViewEvent(dashboard: Pick<DashboardModel, 'id' | 'title' | 'uid' | 'meta'>) {
const eventData: DashboardViewEventPayload = {
/** @deprecated */
dashboardId: dashboard.id,