mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
MetaAnalytics: Minor fix for meta analytics event (#20888)
* Minor fix for meta analytics event * Fixed dashboardSrv issue * Added timeSinceNavigationStart
This commit is contained in:
parent
c4c031ef43
commit
87485e24a4
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user