mirror of
https://github.com/grafana/grafana.git
synced 2025-01-02 12:17:01 -06:00
DashboardScene: Emit meta analytic view event (#89094)
* DashboardScene: Emit view event * check fix
This commit is contained in:
parent
b9812a0784
commit
ae80ed02e4
@ -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) });
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user