Commit 87485e24 by Torkel Ödegaard Committed by GitHub

MetaAnalytics: Minor fix for meta analytics event (#20888)

* Minor fix for meta analytics event

* Fixed dashboardSrv issue

* Added timeSinceNavigationStart
parent c4c031ef
......@@ -15,7 +15,14 @@ export interface EchoMeta {
userLogin: string;
userId: number;
userSignedIn: boolean;
/**
* A millisecond epoch
*/
ts: number;
/**
* A highres timestamp since navigation start
*/
timeSinceNavigationStart: number;
}
export interface EchoBackend<T extends EchoEvent = any, O = any> {
......
......@@ -82,7 +82,8 @@ export class Echo implements EchoSrv {
height: window.screen.height,
},
userAgent: window.navigator.userAgent,
ts: performance.now(),
ts: new Date().getTime(),
timeSinceNavigationStart: performance.now(),
url: window.location.href,
};
};
......
......@@ -29,9 +29,6 @@ export class DashboardSrv {
appEvents.on(CoreEvents.saveDashboard, this.saveDashboard.bind(this), $rootScope);
appEvents.on(PanelEvents.panelChangeView, this.onPanelChangeView);
appEvents.on(CoreEvents.removePanel, this.onRemovePanel);
// Export to react
setDashboardSrv(this);
}
create(dashboard: any, meta: DashboardMeta) {
......
......@@ -22,7 +22,6 @@ export function getAnalyticsProcessor(datasource: DataSourceApi) {
panelId: data.request.panelId,
dashboardId: data.request.dashboardId,
// app: 'dashboard',
// count: 1,
dataSize: 0,
duration: data.request.endTime - data.request.startTime,
eventName: 'data-request',
......@@ -38,9 +37,9 @@ export function getAnalyticsProcessor(datasource: DataSourceApi) {
eventData.folderName = dashboard.meta.folderTitle;
}
if (data.series.length > 0) {
if (data.series && data.series.length > 0) {
// estimate size
eventData.dataSize = data.series.length * data.series[0].length;
eventData.dataSize = data.series.length;
}
if (data.error) {
......
......@@ -27,6 +27,7 @@ import { UtilSrv } from 'app/core/services/util_srv';
import { ContextSrv } from 'app/core/services/context_srv';
import { BridgeSrv } from 'app/core/services/bridge_srv';
import { PlaylistSrv } from 'app/features/playlist/playlist_srv';
import { DashboardSrv, setDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
import { ILocationService, ITimeoutService, IRootScopeService, IAngularEvent } from 'angular';
import { AppEvent, AppEvents } from '@grafana/data';
......@@ -45,6 +46,7 @@ export class GrafanaCtrl {
linkSrv: LinkSrv,
datasourceSrv: DatasourceSrv,
keybindingSrv: KeybindingSrv,
dashboardSrv: DashboardSrv,
angularLoader: AngularLoader
) {
// make angular loader service available to react components
......@@ -54,6 +56,8 @@ export class GrafanaCtrl {
setTimeSrv(timeSrv);
setLinkSrv(linkSrv);
setKeybindingSrv(keybindingSrv);
setDashboardSrv(dashboardSrv);
const store = configureStore();
setLocationSrv({
update: (opt: LocationUpdate) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment